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

Mine!! v0.5

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
The hero place a mine on the ground. The mine explodes after 5 seconds dealing (Level of Mine!! x 50) + (Intelligence of hero).

I know its not very good but its very easy to modify and its 100% MUI! I use the custom value of the mine to make it MUI. Please comment, and give credits if you use it or modify it.

Keywords:
Mine, r0flm40, haxel96, explode, MUI, attribute
Contents

Mine!! (Map)

Reviews
17:14, 16th Jun 2010 Hanky: The spell is too simple. You could make this spell even without triggers.

Moderator

M

Moderator

17:14, 16th Jun 2010
Hanky:
The spell is too simple. You could make this spell even without triggers.
 
I'll try this out, when I've tested it I shall Edit this post.

Edit:
Very basic spell we have here, just three things.


  • Unit Group - Pick every unit in (Units within 200.00 of minepoint) and do (Actions)
Problem A generates a unit group leak, you should save the unit group as a variable and remove it similarly to what you did with the locations


  • Unit - Set the custom value of (Last created unit) to (((Level of Mine!! for (Triggering unit)) x 50) + (Intelligence of (Triggering unit) (Include bonuses)))
Problem B is sorta forgivable as it were, ou really ought not to be using custom values, I'd be much better if you saved it as a variable that you then indexed.

The other thing I'd say is to add the code into the description similarly to this:


  • Mine
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mine!!
    • Actions
      • -------- Here we set the position where the mine shall spawn --------
      • Set minepoint = (Position of (Triggering unit))
      • -------- Here we create the unit, set the damage the mine should deal and add a timer to kill the mine --------
      • Unit - Create 1 Mine dummy for (Owner of (Triggering unit)) at minepoint facing Default building facing degrees
      • Unit - Set the custom value of (Last created unit) to (((Level of Mine!! for (Triggering unit)) x 50) + (Intelligence of (Triggering unit) (Include bonuses)))
      • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
      • -------- Leak fix --------
      • Custom script: call RemoveLocation (udg_minepoint)
  • Mine damage
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Mine dummy
    • Actions
      • -------- Here we set where the mine exploded --------
      • Set minepoint = (Position of (Triggering unit))
      • -------- SFX :D --------
      • Special Effect - Create a special effect at minepoint using Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect at minepoint using Objects\Spawnmodels\Human\HCancelDeath\HCancelDeath.mdl
      • Special Effect - Destroy (Last created special effect)
      • -------- We remove the leak caused by the group --------
      • Custom script: set bj_wantDestroyGroup = true
      • -------- We pick all units in 200 area around the mine and deal damage to them. --------
      • Unit Group - Pick every unit in (Units within 200.00 of minepoint) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • ((Picked unit) is A structure) Equal to True
                      • ((Picked unit) is A Hero) Equal to True
                      • ((Picked unit) is A ground unit) Equal to True
                  • (Owner of (Picked unit)) Not equal to (Owner of (Triggering unit))
            • Then - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing (Real((Custom value of (Triggering unit)))) damage of attack type Chaos and damage type Demolition
            • Else - Actions
      • -------- Leak fix --------
      • Custom script: call RemoveLocation (udg_minepoint)
Edit 2: Hang on wait a second, thats something I havn't seen before

  • Custom script: set bj_wantDestroyGroup = true
hmm, does this destroy the group just after it's creating, if so then disregard Problem A, I haven't come across that script before, but it makesme wonder, should it be below the unit group creation or..?
 
Last edited:
Level 25
Joined
Jun 5, 2008
Messages
2,573
  • Custom script: set bj_wantDestroyGroup = true
Destroys the next used Group after using it.

Also use a hashtable to store values for specific units, don't use custom values.

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • And - All (Conditions) are true
  • Conditions
  • Or - Any (Conditions) are true
  • Conditions
  • ((Picked unit) is A structure) Equal to True
  • ((Picked unit) is A Hero) Equal to True
  • ((Picked unit) is A ground unit) Equal to True
  • (Owner of (Picked unit)) Not equal to (Owner of (Triggering unit))
  • Then - Actions
  • Unit - Cause (Triggering unit) to damage (Picked unit), dealing (Real((Custom value of (Triggering unit)))) damage of attack type Chaos and damage type Demolition
  • Else - Actions
This.
No need for the If/then/else, use Group filters(Pick all units from X range from Y point matching A,B,C conditions).

Also what is the point of nesting 3 different if/then/else branches when you can do the same result in 1? :eek:
 
there really is no need to create a hashtable for such a simple spell
  • Mine
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mine
    • Actions
      • Set loc = (Target point of ability being cast)
      • Unit - Create 1 Mine dummy for (Owner of (Triggering unit)) at loc facing Default building facing degrees
      • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation (udg_loc)
      • -------- Saving the data to the next free slot --------
      • Set Mine_Max = (Mine_Max + 1)
      • Set Mine_Unit[(Mine_Max x 2)] = (Last created unit)
      • Set Mine_Unit[((Mine_Max x 2) + 1)] = (Triggering unit)
      • Set Mine_Damage[Mine_Max] = (Real((((Level of (Ability being cast) for (Triggering unit)) x 50) + (Intelligence of (Triggering unit) (Include bonuses)))))
  • Mine Damage
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Mine dummy
    • Actions
      • Set loc = (Position of (Triggering unit))
      • Special Effect - Create a special effect at loc using Abilities\Weapons\DemolisherFireMissile\DemolisherFireMissile.mdl
      • Special Effect - Destroy (Last created special effect)
      • -------- Searching for the slot which contains the triggering mine --------
      • For each (Integer i) from 1 to Mine_Max, do (Actions)
        • Loop - Actions
          • -------- Check if the current mine is the triggering mine --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Mine_Unit[(i x 2)] Equal to (Triggering unit)
            • Then - Actions
              • -------- Save the caster so we don't have to retrieve him from the array all over again --------
              • Set u = Mine_Unit[((Mine_Max x 2) + 1)]
              • Custom script: set bj_wantDestroyGroup = true
              • Unit Group - Pick every unit in (Units within 300.00 of loc matching ((((Matching unit) is A flying unit) Equal to False) and (((Life of (Matching unit)) Greater than 0.00) and ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True) and (((Matching unit) is Et and do (Actions)
                • Loop - Actions
                  • Unit - Cause u to damage (Picked unit), dealing Mine_Damage[i] damage of attack type Chaos and damage type Demolition
              • Custom script: call RemoveLocation (udg_loc)
              • -------- Fill curent slot with the data from last slot to make things go faster --------
              • Set Mine_Unit[(i x 2)] = Mine_Unit[(Mine_Max x 2)]
              • Set Mine_Unit[((i x 2) + 1)] = Mine_Unit[((Mine_Max x 2) + 1)]
              • Set Mine_Damage[i] = Mine_Damage[Mine_Max]
              • Set Mine_Max = (Mine_Max - 1)
              • Skip remaining actions
            • Else - Actions
  • Custom script: set bj_wantDestroyGroup = true

JASS:
function ForGroupBJ takes group  whichGroup, code callback returns nothing
    // If the user wants the group destroyed, remember that fact and clear
    // the flag, in case it is used again in the callback.
    local boolean wantDestroy = bj_wantDestroyGroup
    set bj_wantDestroyGroup = false

    call ForGroup(whichGroup, callback)

    // If the user wants the group destroyed, do so now.
    if (wantDestroy) then
        call DestroyGroup(whichGroup)
    endif
endfunction
most blizzard wrapper functions call "DestroyGroup" anyway so setting bj_wantDestroyGroup = true resoults in the group being destroyed

note:
I probably forgot something but if I did so someone will find out
 

Attachments

  • Mine.w3x
    24.8 KB · Views: 76
Level 25
Joined
Jun 5, 2008
Messages
2,573
Let me explain, if you have another spell/system which uses custom values of a unit it or the spell gets screwed up because 1 spell uses 1 custom value the other overwrites that custom value and you end up with disfunctional spells/systems in your map.

The point is, never use custom values.
 
Top