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

Help - Siphon Mana + Explosion

Status
Not open for further replies.
Level 8
Joined
Aug 17, 2013
Messages
112
Hey guys, i'm having some trouble with this trigger:

  • Event
  • Unit - A unit finishes casting an ability
  • Conditions
  • (Ability being cast) Equal to Siphon Mana
  • Actions
  • Special effect - Create a special effect at (Random point in (Region centered at (Position of (Targeted Unit)) With size (300.00,300.00))) using <Special effect>
  • Special effect - Destroy (last created special effect)
  • Unit - Make triggering unit invulnerable
  • Unit - Cause (casting unit) to damage circular area after 0.00 seconds of radius 300.00 at (Center of (Region centered at (Position of (Targeted unit)) with size (300.00,300.00) dealing 300 damage of attack type spells and damage type universal
  • Unit - Make Triggering unit vulnerable
The
  • Unit - Make triggering unit invulnerable
is for security reasons, and has worked well in other variations (the damage and effect being at casting unit, instead of targeted unit).

But in this variation it gives the following bug:
1: Makes a special effect at a fixed point of the map, not on the target unit.
2: The aoe damage never comes, but often my hero will die instantly after casting the spell, and he has more than 300 health i assure you...

Do you know what i can do to fix these 2 things?? keep in mind that i do not know how to set up variables and putting them into work in triggers (to messy and complicated to understand), so keep it simple.

Hope you can give me a hand
Yours truly
Mr. Plunders. :ogre_hurrhurr:
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
#1
"(Targeted Unit)" is a response to the event "A unit acquires a target" not to a "Unit finishes casting an ability" event.

#2
When "Unit finishes casting an ability" event fires, there is no longer any point of ability being cast, no target, no nothing. You will have to save the target into unit variable when the caster "starts the effect of an ability" and then when the caster "finishes casting an ability", you create the effect at around the unit you saved beforehand. If you want to make this MUI, you will have to learn indexing and deindexing to prevent bugs.

#3
As far as I know, Casting unit = Triggering unit, however using Triggering Unit is faster

#4
You damage everyone via the "Damage circular area" - even allies of the caster. If that is not your intention, you will have to create unit group by picking nearby units and filtering through them to pick up enemies only.

#5
You leak locations (and maybe even regions)
  • (Random point in (Region centered at (Position of (Targeted Unit)) With size (300.00,300.00)))
This is terribly wrong. You have to learn how to
1) clear leaks and prevent leaks - look here: http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/
You basically have to save the location beforehand and then create special effect at that saved location and then remove that location.
2) Don't do it the way you did when choosing random point, use polar offset instead - you save the location of the target and then create and save new location, offset by <random number between X and Y> and at random angle.
 
Level 8
Joined
Aug 17, 2013
Messages
112
#1
"(Targeted Unit)" is a response to the event "A unit acquires a target" not to a "Unit finishes casting an ability" event.

#2
When "Unit finishes casting an ability" event fires, there is no longer any point of ability being cast, no target, no nothing. You will have to save the target into unit variable when the caster "starts the effect of an ability" and then when the caster "finishes casting an ability", you create the effect at around the unit you saved beforehand. If you want to make this MUI, you will have to learn indexing and deindexing to prevent bugs.

#3
As far as I know, Casting unit = Triggering unit, however using Triggering Unit is faster

#4
You damage everyone via the "Damage circular area" - even allies of the caster. If that is not your intention, you will have to create unit group by picking nearby units and filtering through them to pick up enemies only.

#5
You leak locations (and maybe even regions)
  • (Random point in (Region centered at (Position of (Targeted Unit)) With size (300.00,300.00)))
This is terribly wrong. You have to learn how to
1) clear leaks and prevent leaks - look here: http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/
You basically have to save the location beforehand and then create special effect at that saved location and then remove that location.
2) Don't do it the way you did when choosing random point, use polar offset instead - you save the location of the target and then create and save new location, offset by <random number between X and Y> and at random angle.

Hey there really like your response! I have to write a report today, but i'll be sure to see if i can learn something from the guide and your wise words in the evening.
in other words, check in tonight, might have a new question :)
Thanks a lot so far.
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
All like Nichilus said ;).

I'll attach the map and post the trigger:

  • Execution
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Siphon Mana
    • Actions
      • -------- This is like a mini tutorial in your spell. --------
      • -------- You should read carefully. --------
      • -------- * --------
      • -------- Variable Informations --------
      • -------- Note: All of this variables are Non- Arrays --------
      • -------- SM_Caster = ( Unit Variable ) --------
      • -------- SM_Target = ( Unit Variable ) --------
      • -------- SM_Effect = ( String Variable ) --------
      • -------- SM_Area = ( Real Variable ) --------
      • -------- SM_DamageExplosion = ( Real Variable ) --------
      • -------- SM_TargetPosition = ( Point Variable ) --------
      • -------- SM_PickedUnits = ( Unit Variable ) --------
      • -------- * --------
      • -------- The effects of the Explosion. --------
      • Set SM_Effect = Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
      • -------- * --------
      • -------- The area of the explosion when the siphon mana casts. --------
      • Set SM_Area = 300.00
      • -------- * --------
      • -------- The damage in the area of the explosion --------
      • Set SM_DamageExplosion = 300.00
      • -------- * --------
      • -------- The casting unit or the triggering unit that will cast a spell --------
      • Set SM_Caster = (Triggering unit)
      • -------- * --------
      • -------- Making the caster invulnerable. --------
      • Unit - Make SM_Caster Invulnerable
      • -------- * --------
      • -------- The targeted unit enemy. --------
      • Set SM_Target = (Target unit of ability being cast)
      • -------- * --------
      • -------- The position of targeted enemy --------
      • Set SM_TargetPosition = (Position of SM_Target)
      • -------- * --------
      • -------- Creating a special effect to the position of the unit. --------
      • Special Effect - Create a special effect at SM_TargetPosition using SM_Effect
      • -------- * --------
      • -------- Ofc Destroying the special effect. --------
      • Special Effect - Destroy (Last created special effect)
      • -------- * --------
      • -------- Cleaning leaks of unit group variable --------
      • -------- This is used for instant destroying group --------
      • Custom script: set bj_wantDestroyGroup = true
      • -------- * --------
      • -------- Creating group --------
      • Unit Group - Pick every unit in (Units within SM_Area of SM_TargetPosition) and do (Actions)
        • Loop - Actions
          • -------- * --------
          • -------- The picked units in that area/group. --------
          • Set SM_PickedUnits = (Picked unit)
          • -------- * --------
          • -------- Filtering the picked units that will damaged. --------
          • -------- It will filter the enemy of the caster. --------
          • -------- It will filter the alive units in that area. --------
          • -------- It will filter out the magic immune units in the area. --------
          • -------- It will filter out the flying units in the area. --------
          • -------- * --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (SM_PickedUnits belongs to an enemy of (Owner of SM_Caster)) Equal to True
              • (SM_PickedUnits is alive) Equal to True
              • (SM_PickedUnits is Magic Immune) Not equal to True
              • (SM_PickedUnits is A flying unit) Not equal to True
            • Then - Actions
              • -------- Damaging the picked units. --------
              • Unit - Cause SM_Caster to damage SM_PickedUnits, dealing SM_DamageExplosion damage of attack type Spells and damage type Normal
              • -------- * --------
            • Else - Actions
      • -------- * --------
      • -------- Making the caster Vulnerable --------
      • Unit - Make SM_Caster Vulnerable
      • -------- Actually making the caster invulnerable and vulnerable in the instance cast or executing cast is seems pointless. --------
      • -------- because you add the caster a invulnerable then you make it vulnerable. --------
      • -------- * --------
      • -------- Cleaning the leak of the position of the target. --------
      • -------- Cleaning leaks is always needed. --------
      • Custom script: call RemoveLocation(udg_SM_TargetPosition)
      • -------- * --------
      • -------- That's all I can tell if you have any more problem pls tell to me ;). --------
      • -------- ~Sincerely jakeZinc. --------
      • -------- * --------
 

Attachments

  • Siphon Mana + Explosion.w3x
    15 KB · Views: 46
Level 8
Joined
Aug 17, 2013
Messages
112
All like Nichilus said ;).

I'll attach the map and post the trigger:

  • Execution
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Siphon Mana
    • Actions
      • -------- This is like a mini tutorial in your spell. --------
      • -------- You should read carefully. --------
      • -------- * --------
      • -------- Variable Informations --------
      • -------- Note: All of this variables are Non- Arrays --------
      • -------- SM_Caster = ( Unit Variable ) --------
      • -------- SM_Target = ( Unit Variable ) --------
      • -------- SM_Effect = ( String Variable ) --------
      • -------- SM_Area = ( Real Variable ) --------
      • -------- SM_DamageExplosion = ( Real Variable ) --------
      • -------- SM_TargetPosition = ( Point Variable ) --------
      • -------- SM_PickedUnits = ( Unit Variable ) --------
      • -------- * --------
      • -------- The effects of the Explosion. --------
      • Set SM_Effect = Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
      • -------- * --------
      • -------- The area of the explosion when the siphon mana casts. --------
      • Set SM_Area = 300.00
      • -------- * --------
      • -------- The damage in the area of the explosion --------
      • Set SM_DamageExplosion = 300.00
      • -------- * --------
      • -------- The casting unit or the triggering unit that will cast a spell --------
      • Set SM_Caster = (Triggering unit)
      • -------- * --------
      • -------- Making the caster invulnerable. --------
      • Unit - Make SM_Caster Invulnerable
      • -------- * --------
      • -------- The targeted unit enemy. --------
      • Set SM_Target = (Target unit of ability being cast)
      • -------- * --------
      • -------- The position of targeted enemy --------
      • Set SM_TargetPosition = (Position of SM_Target)
      • -------- * --------
      • -------- Creating a special effect to the position of the unit. --------
      • Special Effect - Create a special effect at SM_TargetPosition using SM_Effect
      • -------- * --------
      • -------- Ofc Destroying the special effect. --------
      • Special Effect - Destroy (Last created special effect)
      • -------- * --------
      • -------- Cleaning leaks of unit group variable --------
      • -------- This is used for instant destroying group --------
      • Custom script: set bj_wantDestroyGroup = true
      • -------- * --------
      • -------- Creating group --------
      • Unit Group - Pick every unit in (Units within SM_Area of SM_TargetPosition) and do (Actions)
        • Loop - Actions
          • -------- * --------
          • -------- The picked units in that area/group. --------
          • Set SM_PickedUnits = (Picked unit)
          • -------- * --------
          • -------- Filtering the picked units that will damaged. --------
          • -------- It will filter the enemy of the caster. --------
          • -------- It will filter the alive units in that area. --------
          • -------- It will filter out the magic immune units in the area. --------
          • -------- It will filter out the flying units in the area. --------
          • -------- * --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (SM_PickedUnits belongs to an enemy of (Owner of SM_Caster)) Equal to True
              • (SM_PickedUnits is alive) Equal to True
              • (SM_PickedUnits is Magic Immune) Not equal to True
              • (SM_PickedUnits is A flying unit) Not equal to True
            • Then - Actions
              • -------- Damaging the picked units. --------
              • Unit - Cause SM_Caster to damage SM_PickedUnits, dealing SM_DamageExplosion damage of attack type Spells and damage type Normal
              • -------- * --------
            • Else - Actions
      • -------- * --------
      • -------- Making the caster Vulnerable --------
      • Unit - Make SM_Caster Vulnerable
      • -------- Actually making the caster invulnerable and vulnerable in the instance cast or executing cast is seems pointless. --------
      • -------- because you add the caster a invulnerable then you make it vulnerable. --------
      • -------- * --------
      • -------- Cleaning the leak of the position of the target. --------
      • -------- Cleaning leaks is always needed. --------
      • Custom script: call RemoveLocation(udg_SM_TargetPosition)
      • -------- * --------
      • -------- That's all I can tell if you have any more problem pls tell to me ;). --------
      • -------- ~Sincerely jakeZinc. --------
      • -------- * --------

Oh my god, you actually made this :p

I'll have to study the whole Variables theme, i will try my best to learn it, but know that it might be too complicated for me, so i might fail.

I'll read some guides and work my arse off, if i should succeed in understanding the triggers and advices from you and Nichilus, i will +rep you both. Seems you put a LOT of work into this.

Thanks for helpful hints so far :)

-Plunders
 
Level 8
Joined
Aug 17, 2013
Messages
112

Thanks for the link really :) now i can understand the trigger Jake sent me, thanks a lot Nichilus!

Now Jake i get why you ask:

"Actually making the caster invulnerable and vulnerable in the instance cast or executing cast is seems pointless."

"because you add the caster a invulnerable then you make it vulnerable."

But know that i used that because i didn't really think i could filter the damage, now i know otherwise. :)

Thanks you guys for the help, i wanna +rep you both, it says i need to spread more rep to give it to you... So i gotta answer other peoples posts or?

- Plunders

PS: Now that i read a basic guide on variables, i feel stupid over having had such a problem with understanding it.
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
Thanks for the link really :) now i can understand the trigger Jake sent me, thanks a lot Nichilus!

Now Jake i get why you ask:

"Actually making the caster invulnerable and vulnerable in the instance cast or executing cast is seems pointless."

"because you add the caster a invulnerable then you make it vulnerable."

But know that i used that because i didn't really think i could filter the damage, now i know otherwise. :)

Thanks you guys for the help, i wanna +rep you both, it says i need to spread more rep to give it to you... So i gotta answer other peoples posts or?

- Plunders

PS: Now that i read a basic guide on variables, i feel stupid over having had such a problem with understanding it.

It is okay if you don't rep or credit us because we are happy in helping others without expecting in return :)).
 
Level 8
Joined
Aug 17, 2013
Messages
112
Here is the map with the spell Jake..
(know that being forced to share an incomplete map really annoys me, but i guess i can understand why you need to see this...)
You'll see that i use the exact trigger that you gave me... Anyway, the spell is called "siphon soul" and it's the last hero that has it...
 
Last edited:
Status
Not open for further replies.
Top