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

GUI Passive ability that creates unit from the corps

Status
Not open for further replies.
Level 3
Joined
Apr 18, 2018
Messages
58
The idea of a spell is kind of based on Black Arrow ability.

With every attack hero puts a buff on enemy target (that lasts about 20 seconds, buff reapplies with each basic attack), if during this time target is killed then there is a chance (15/30/45) to create a certain unit from the corps (like Black Arrow).

I checked many posts with similar to Black Arrow skills and didn't find what I was looking for. I would appreciate some ideas and thoughts regarding this.
 
Level 7
Joined
Jul 4, 2007
Messages
249
There is already a passive ability for this, shadow orb. "Item Attack Black Arrow Bonus" and "Item Black Arrow". The chance has to be triggered though, you could do something like this
  • Black Arrow
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Name of (Summoned unit)) Equal to Dark Minion
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Summoned unit)) Equal to Dark Minion (Level 1)
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random real number between 0.00 and 1.00) Greater than 0.15
            • Then - Actions
              • Unit - Kill (Summoned unit)
              • Unit - Hide (Summoned unit)
            • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Summoned unit)) Equal to Dark Minion (Level 2)
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Random real number between 0.00 and 1.00) Greater than 0.30
                • Then - Actions
                  • Unit - Kill (Summoned unit)
                  • Unit - Hide (Summoned unit)
                • Else - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Summoned unit)) Equal to Dark Minion (Level 3)
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random real number between 0.00 and 1.00) Greater than 0.45
                    • Then - Actions
                      • Unit - Kill (Summoned unit)
                      • Unit - Hide (Summoned unit)
                    • Else - Actions
                • Else - Actions
 
Level 3
Joined
Apr 18, 2018
Messages
58
There is already a passive ability for this, shadow orb. "Item Attack Black Arrow Bonus" and "Item Black Arrow". The chance has to be triggered though, you could do something like this

Theoretically, I could create shadow orb ability for my hero. Then change the chance to affect a unit (it has 100% by default), then I would change summoned unit type to the type I need. Let's say I would set a chance to 15% at level 1, wouldn't it mean, that with every hero basic attack the chance would reapply, resulting in creating that skeleton for example.

And with Your trigger that chance wouldn't be reapplied with every hit, but with the death of unit? (Because that's what I need) I am just trying to understand Your trigger. Sorry, I am not very experienced in triggering.
 
Level 7
Joined
Jul 4, 2007
Messages
249
Theoretically, I could create shadow orb ability for my hero. Then change the chance to affect a unit (it has 100% by default), then I would change summoned unit type to the type I need. Let's say I would set a chance to 15% at level 1, wouldn't it mean, that with every hero basic attack the chance would reapply, resulting in creating that skeleton for example.

And with Your trigger that chance wouldn't be reapplied with every hit, but with the death of unit? (Because that's what I need) I am just trying to understand Your trigger. Sorry, I am not very experienced in triggering.
Yes exactly, I haven't tried it but it should work. All it does is that, depending on what level the summoned unit is, it has a chance(15,30,45) to not kill and hide the unit. Otherwise it will kill and hide the unit, making it look like nothing happened.

So you will have to use a different unit-type on each level (like with regular Black Arrow)
 
Level 24
Joined
Feb 9, 2009
Messages
1,787
Lethal damage event from Damage Engine, but you need to store the source of the buff ahead of time to be able to keep ownership, give me a moment to shuffle something up.

Edit:
First hit of Touch of Carrion AKA "Envenomed weapons"
  • Touch of Carrion First hit
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • (Level of Touch of Carrion (Neutral Hostile) for DamageEventSource) Greater than 0
    • Actions
      • For each (Integer ToCa_Loop) from 1 to ToCa_Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ToCa_Target[ToCa_Loop] Equal to DamageEventTarget
              • ToCa_Caster[ToCa_Loop] Equal to DamageEventSource
            • Then - Actions
              • Skip remaining actions
            • Else - Actions
      • Set ToCa_Index = (ToCa_Index + 1)
      • Set ToCa_Target[ToCa_Index] = DamageEventTarget
      • Set ToCa_Caster[ToCa_Index] = DamageEventSource
      • Set ToCa_Buff[ToCa_Index] = Touch of Carrion
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ToCa_Index Equal to 1
        • Then - Actions
          • Trigger - Turn on Touch of Carrion Periodic <gen>
        • Else - Actions

Periodic
  • Touch of Carrion Periodic
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • For each (Integer ToCa_Loop) from 1 to ToCa_Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (ToCa_Target[ToCa_Loop] has buff Touch of Carrion ) Equal to False
            • Then - Actions
              • Set ToCa_Target[ToCa_Loop] = ToCa_Target[ToCa_Index]
              • Set ToCa_Caster[ToCa_Loop] = ToCa_Caster[ToCa_Index]
              • Set ToCa_Buff[ToCa_Loop] = ToCa_Buff[ToCa_Index]
              • Set ToCa_Loop = (ToCa_Loop - 1)
              • Set ToCa_Index = (ToCa_Index - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ToCa_Index Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions

Lethal Damage Event
  • Touch of Carrion Lethal damage event
    • Events
      • Game - LethalDamageEvent becomes Equal to 1.00
    • Conditions
      • (DamageEventTarget has buff Touch of Carrion ) Equal to True
    • Actions
      • For each (Integer ToCa_Loop) from 1 to ToCa_Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ToCa_Target[ToCa_Loop] Equal to DamageEventTarget
            • Then - Actions
              • Special Effect - Create a special effect attached to the chest of DamageEventTarget using Objects\Spawnmodels\Critters\Albatross\CritterBloodAlbatross.mdl
              • Special Effect - Destroy (Last created special effect)
              • Set WB_Point[57] = (Position of DamageEventTarget)
              • Unit - Create 1 Carrion Beetle (Level 1) for (Owner of ToCa_Caster[ToCa_Loop]) at WB_Point[57] facing (Facing of DamageEventTarget) degrees
              • Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
              • Unit - Add classification of Summoned to (Last created unit)
              • Custom script: call RemoveLocation(udg_WB_Point[57])
            • Else - Actions
 
Last edited:
Level 7
Joined
Jul 4, 2007
Messages
249
Lethal damage event from Damage Engine, but you need to store the source of the buff ahead of time to be able to keep ownership, give me a moment to shuffle something up.

Edit:
First hit of Touch of Carrion AKA "Envenomed weapons"
  • Touch of Carrion First hit
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • (Level of Touch of Carrion (Neutral Hostile) for DamageEventSource) Greater than 0
    • Actions
      • For each (Integer ToCa_Loop) from 1 to ToCa_Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ToCa_Target[ToCa_Loop] Equal to DamageEventTarget
              • ToCa_Caster[ToCa_Loop] Equal to DamageEventSource
            • Then - Actions
              • Skip remaining actions
            • Else - Actions
      • Set ToCa_Index = (ToCa_Index + 1)
      • Set ToCa_Target[ToCa_Index] = DamageEventTarget
      • Set ToCa_Caster[ToCa_Index] = DamageEventSource
      • Set ToCa_Buff[ToCa_Index] = Touch of Carrion
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ToCa_Index Equal to 1
        • Then - Actions
          • Trigger - Turn on Touch of Carrion Periodic <gen>
        • Else - Actions

Periodic
  • Touch of Carrion Periodic
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • For each (Integer ToCa_Loop) from 1 to ToCa_Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (ToCa_Target[ToCa_Loop] has buff Touch of Carrion ) Equal to False
            • Then - Actions
              • Set ToCa_Target[ToCa_Loop] = ToCa_Target[ToCa_Index]
              • Set ToCa_Caster[ToCa_Loop] = ToCa_Caster[ToCa_Index]
              • Set ToCa_Buff[ToCa_Loop] = ToCa_Buff[ToCa_Index]
              • Set ToCa_Loop = (ToCa_Loop - 1)
              • Set ToCa_Index = (ToCa_Index - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ToCa_Index Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions

Lethal Damage Event
  • Touch of Carrion Lethal damage event
    • Events
      • Game - LethalDamageEvent becomes Equal to 1.00
    • Conditions
      • (DamageEventTarget has buff Touch of Carrion ) Equal to True
    • Actions
      • For each (Integer ToCa_Loop) from 1 to ToCa_Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ToCa_Target[ToCa_Loop] Equal to DamageEventTarget
            • Then - Actions
              • Special Effect - Create a special effect attached to the chest of DamageEventTarget using Objects\Spawnmodels\Critters\Albatross\CritterBloodAlbatross.mdl
              • Special Effect - Destroy (Last created special effect)
              • Set WB_Point[57] = (Position of DamageEventTarget)
              • Unit - Create 1 Carrion Beetle (Level 1) for (Owner of ToCa_Caster[ToCa_Loop]) at WB_Point[57] facing (Facing of DamageEventTarget) degrees
              • Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
              • Unit - Add classification of Summoned to (Last created unit)
              • Custom script: call RemoveLocation(udg_WB_Point[57])
            • Else - Actions
This indexing you're using is it more effective than using a unit group? Or is it just a preference you have?
 
Level 39
Joined
Feb 27, 2007
Messages
5,023
Edit: I didn't actually read @Sk0gsHu[GG]arN 's response until I posted and I think I just repeated what they said the other option is. This way is simpler to understand if you don't 'get' indexing but as far as "better"...? Either is acceptable, though this way avoids an explicit requirement of a unit indexer.


Instead of indexing by caster you could keep a single unit group for each player and store targets that that player has put the buff on in that group. Then you check what group the unit is in (when it dies) to see who to give the newly spawned unit to. When the buff is applied remove it from all other groups (since only the most recent application should count), and if the unit takes fatal damage while it doesn't have the buff remove it from the group.
 
Level 7
Joined
Jul 4, 2007
Messages
249
I was actually thinking something like this

Init
  • Black Arrow Init
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • (Level of ability for DamageEventSource) Greater than 0
    • Actions
      • If ((DamageEventTarget is in BA_unitGrp) Equal to False) then do (Unit Group - Add DamageEventTarget to BA_unitGrp) else do (Do nothing)
      • Set BA_Caster[(Custom value of DamageEventTarget)] = DamageEventSource
      • Set BA_Counter[(Custom value of DamageEventTarget)] = 20.00
      • Set BA_Level[(Custom value of DamageEventTarget)] = (Level of Black Arrow for DamageEventSource)
      • If ((Black Arrow Periodic <gen> is on) Equal to False) then do (Trigger - Turn on Black Arrow Periodic <gen>) else do (Do nothing)

Periodic
  • Black Arrow Periodic
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in BA_unitGrp) Greater than 0
        • Then - Actions
          • Unit Group - Pick every unit in BA_unitGrp and do (Actions)
            • Loop - Actions
              • Set target = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • BA_Counter[(Custom value of target)] Greater than 0.00
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (target is dead) Equal to True
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Random real number between 0.00 and 1.00) Less than or equal to (0.15 x (Level of Black Arrow for BA_Caster[(Custom value of target)])
                        • Then - Actions
                          • Set tempLoc = (Position of target)
                          • Unit - Create 1 Dark Minion for (Owner of BA_Caster[(Custom value of target)]) at tempLoc facing (Facing of target) degrees
                          • Custom script: call RemoveLocation(udg_tempLoc)
                          • Unit - Add a 60.00 second Generic expiration timer to (Last created unit)
                          • Animation - Play (Last created unit)'s birth animation
                        • Else - Actions
                      • Unit Group - Remove target from BA_unitGrp
                      • Unit - Remove target from the game
                    • Else - Actions
                      • Set BA_Counter[(Custom value of target)] = (BA_Counter[(Custom value of target)] - 0.10)
                • Else - Actions
                  • Unit Group - Remove target from BA_unitGrp
        • Else - Actions
          • Trigger - Turn off (This trigger)
It's a lot easier with unit indexer but you can also use a hashtable
 
Last edited:
Level 3
Joined
Apr 18, 2018
Messages
58
I was actually thinking something like this
It's a lot easier with unit indexer but you can also use a hashtable

Trigger you came up with is mind blowing... Would be great if you could elaborate a little bit (I mean explain the trigger, for example "Damage Event becomes equal to 1.00", what's that?) and guide me through the steps. So far I created Shadow Orb ability in OE, obviously changed the chances and then changed the Summoned unit (it is the same unit for all 3 levels of ability (Footman)). I didn't start triggering the ability yet, because I was distracted by another ability of Mass Heal.

I am just confused with variables a little. I am sorry for my knowledge, learning everything is always most complicated part of it.
 
Status
Not open for further replies.
Top