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

[Solved] Problem with spawning unit at target of replenish life

Status
Not open for further replies.
Level 4
Joined
Dec 21, 2019
Messages
51
Hello, i use the undead "blight" as an autocast for a healing tower. on heal chance to proc a dummy (at casters target, or target of ability being cast) that, then, uses tranquility.
[edit: the unit keeps spawning at the caster]
Why does the dummy not spawn at the target of ability being cast, where did i go wrong? Thanks in advance

Cheers

  • ORiley
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Casting unit)) Equal to |cff00ff00Xavuz O'riley|r
        • Then - Actions
          • Set VariableSet ORileyProc = (Random integer number between 1 and 10)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ORileyProc Greater than or equal to 4
              • ORileyProc Less than or equal to 5
            • Then - Actions
              • Set VariableSet ORileyOwner = (Owner of (Casting unit))
              • Set VariableSet ORileyPoint = (Position of (Target unit of ability being cast))
              • Unit - Create 1 BarrelDummy for ORileyOwner at ORileyPoint facing Default building facing degrees
              • Set VariableSet ORileyUnit = (Last created unit)
              • Unit - Order ORileyUnit to Night Elf Keeper Of The Grove - Tranquility.
              • Custom script: call RemoveLocation (udg_ORileyPoint)
              • Unit - Add a 1.01 second Generic expiration timer to ORileyUnit
            • Else - Actions
        • Else - Actions
 
Last edited:
Level 4
Joined
Dec 21, 2019
Messages
51
I think the event is wrong - at the time a unit finishes casting an ability, there is no longer a target point/target unit of ability begin cast.
Try the "unit starts the effect of an ability" if it works
Hey @Nichilus thanks for reaching in, appreciate it!
I tried it, but the barrels still appeared on the caster. (see below)
could this be because it is replenish life (undead statues heal ability) autocast?
edit*the duration of the healing effect is only 0.1 sec. maybe could that be an issue?
  • ORiley
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Casting unit)) Equal to |cff00ff00Xavuz O'riley|r
        • Then - Actions
          • Set VariableSet ORileyProc = (Random integer number between 1 and 10)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ORileyProc Greater than or equal to 4
              • ORileyProc Less than or equal to 5
            • Then - Actions
              • Set VariableSet ORileyOwner = (Owner of (Casting unit))
              • Set VariableSet ORileyPoint = (Position of (Target unit of ability being cast))
              • Unit - Create 1 BarrelDummy for ORileyOwner at ORileyPoint facing Default building facing degrees
              • Set VariableSet ORileyUnit = (Last created unit)
              • Unit - Order ORileyUnit to Night Elf Keeper Of The Grove - Tranquility.
              • Custom script: call RemoveLocation (udg_ORileyPoint)
              • Unit - Add a 1.01 second Generic expiration timer to ORileyUnit
            • Else - Actions
        • Else - Actions
 
Last edited:
Level 25
Joined
Sep 26, 2009
Messages
2,378
It is as Wrda wrote - there is no target point nor target unit of ability being cast, since this spell is an AoE spell centered around the caster.

Couple of things you can do in your trigger:
1. Move the condition "(Unit-type of (Casting unit)) Equal to |cff00ff00Xavuz O'riley|r" to the condition block under events. This way you can avoid that first If/then/else block entirely
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Unit-type of (Casting unit)) Equal to |cff00ff00Xavuz O'riley|r
  • Actions
    • ...

2. Instead of checking if ORileyProc >= 4 and ORileyProc <= 5, you can check if ORileyProc >= 9 ... this will achieve the same thing with less code.
3. Last but not least, you could pick every unit around the caster and set "ORileyPoint = (Position of (Picked unit))". The remainder of your trigger would remain the same
 
Level 4
Joined
Dec 21, 2019
Messages
51
It is as Wrda wrote - there is no target point nor target unit of ability being cast, since this spell is an AoE spell centered around the caster.

Couple of things you can do in your trigger:
1. Move the condition "(Unit-type of (Casting unit)) Equal to |cff00ff00Xavuz O'riley|r" to the condition block under events. This way you can avoid that first If/then/else block entirely
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Unit-type of (Casting unit)) Equal to |cff00ff00Xavuz O'riley|r
  • Actions
    • ...

2. Instead of checking if ORileyProc >= 4 and ORileyProc <= 5, you can check if ORileyProc >= 9 ... this will achieve the same thing with less code.
3. Last but not least, you could pick every unit around the caster and set "ORileyPoint = (Position of (Picked unit))". The remainder of your trigger would remain the same
I think i go with solution 3, thanks for the explanation and possibilities! It works just perfect.
Below, the working trigger. Thanks for everybodys help!

  • ORiley
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Casting unit)) Equal to |cff00ff00Xavuz O'riley|r
        • Then - Actions
          • Set VariableSet ORileyProc = (Random integer number between 1 and 10)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ORileyProc Greater than or equal to 4
              • ORileyProc Less than or equal to 5
            • Then - Actions
              • Set VariableSet ORileyOwner = (Owner of (Casting unit))
              • Set VariableSet ORileyPoint = (Position of (Random unit from (Units within 1100.00 of (Position of (Casting unit)).)))
              • Unit - Create 1 BarrelDummy for ORileyOwner at ORileyPoint facing Default building facing degrees
              • Set VariableSet ORileyUnit = (Last created unit)
              • Unit - Order ORileyUnit to Night Elf Keeper Of The Grove - Tranquility.
              • Custom script: call RemoveLocation (udg_ORileyPoint)
              • Unit - Add a 1.01 second Generic expiration timer to ORileyUnit
            • Else - Actions
        • Else - Actions
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Well, all three points aren't exclusive :D

Anyway this action:
  • Set VariableSet ORileyPoint = (Position of (Random unit from (Units within 1100.00 of (Position of (Casting unit)).)))
leaks the position of casting unit. And I believe also a unit group
You should have something like
  • Custom script: set bj_wantDestroyGroup = true
  • Set VariableSet ORileyCasterPoint = (Position of (Casting unit))
  • Set VariableSet ORileyPoint = (Position of (Random unit from (Units within 1100.00 of ORileyCasterPoint .)))
  • ...
  • Custom script: call RemoveLocation (udg_ORileyPoint)
  • Custom script: call RemoveLocation (udg_ORileyCasterPoint )
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,509
This is what an effective design would look like aiming to have as little variables as possible. I don't really like using "set bj_wantDestroyGroup" because it doesn't always work. I'm sure it works here just fine but the fact that it isn't 100% consistent makes me prefer a method that is:
  • Example
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to YourUnit
    • Actions
      • -------- 20% Chance: --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 10) Less than or equal to 2
        • Then - Actions
          • Set VariableSet ORileyPoint = (Position of (Triggering unit))
          • Set VariableSet ORileyGroup = (Units within 1100.00 of ORileyPoint.)
          • Custom script: call RemoveLocation (udg_ORileyPoint)
          • Set VariableSet ORileyPoint = (Position of (Random unit from ORileyGroup))
          • Custom script: call DestroyGroup (udg_ORileyGroup)
          • Unit - Create 1 YourDummy for (Triggering player) at ORileyPoint facing Default building facing degrees
          • Custom script: call RemoveLocation (udg_ORileyPoint)
          • Unit - Add a 1.01 second Generic expiration timer to (Last created unit)
          • Unit - Order (Last created unit) to Night Elf Keeper Of The Grove - Tranquility.
        • Else - Actions
 
Status
Not open for further replies.
Top