Goblin Techies - Land Mine Spell Question

trees123

New Member
Reaction score
6
For those of you that don't play DotA, land mine is a spell that creates a mine that explodes whenever a unit steps near it. There's a limit on it that only allows a set number of mines on the map. When the someone goes past this limit, the most recent one is created, while the oldest one is destroyed.

What I want to know is how did they make it so there was a limit. I've tried to recreate it, but came up with a few problems (couldn't specify how many of the mines were on the map that belonged to ONE player of the entire map) so I deleted it. So....yeah.
 

Bloodydood

New Member
Reaction score
14
You can have it set to an integer variable with an array at the maximum number of players in the map as well as a unit variable with the same array.

When Player 1 places a land mine, you add 1 to your Integer variable as well as setting the unit variable to the land mine.
If a limit is reached the integer variable should be set 1 above the specified limit, and thus should cause the land mine set to the unit variable to be removed and force the integer variable to decrease back down to the limit.
If a land mine is destroyed or detonated, the integer variable should be deducted by 1.
Use memory leak prevention whenever possible.

This is merely what I just thought of in 5 minutes. Feel free to try this on a test map as there is a good chance I'm wrong.
 

Moridin

Snow Leopard
Reaction score
144
An integer variable(for storing the number of mines used) along with a unit array(for storing the landmines themselves in order) for every player that picks goblin techies would work.

Also make sure that the landmines are units. If they're something else, it has to be a "something else" array instead of a unit array.

Make it so that the integer variable goes up by 1 every time a mine is placed. Put every mine into the array as array[integer variable] so it tracks the mines correctly. If the integer goes above 15 then just destroy array[1], shift all the array variables down a step and assign the new mine array[15].
 

Sessional

New Member
Reaction score
5
William is correct, however, not sure if those abilities also allow it to be targeted.

If they don't, Moridins way is easy enough.

JASS:
function arrayShift takes nothing returns nothing
    set arrayStart = 0
    set maxMines = 15
    loop
        exitwhen arrayStart > maxMines 
        myArray[arrayStart] = myArray[arrayStart+1]
        set arrayStart = arrayStart + 1
    endloop
endfunction

Something like this would shift everything downward. I know it's not exactly it, but that's half the learning curve. Good luck!
 

trees123

New Member
Reaction score
6
The thing is, I don't know jass, and I would rather not learn it because it'll probably take awhile to learn it (at least for me), and SC2 is coming. I heard it uses another scripting syntax so I'd rather spend my time using the humble GUI.

Is there any other alternative to shifting the arrays down?
 

TheSpoon

New Member
Reaction score
10
Heres a quick GUI method, however this will only work for one of these heroes. (Not MUI at all)

Code:
Mine Setup
    Events
        Map initialization
    Conditions
    Actions
        Set [COLOR="Red"]mine_limit[/COLOR] = 8

Code:
Mine Create
    Events
        Unit - A unit enters (Entire map)
    Conditions
        (Unit-type of (Triggering unit)) Equal to Goblin Land Mine
    Actions
        Set [COLOR="Green"]mine_amount[/COLOR] = (mine_amount + 1)
        Set [COLOR="Red"]mine_unit[/COLOR][[COLOR="Green"]mine_amount[/COLOR]] = (Triggering unit)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                [COLOR="green"]mine_amount[/COLOR] Greater than [COLOR="Red"]mine_limit[/COLOR]
            Then - Actions
                Unit - Kill [COLOR="RoyalBlue"]mine_unit[/COLOR][1]
            Else - Actions

Code:
Mine Death
    Events
        Unit - A unit Dies
    Conditions
        (Unit-type of (Triggering unit)) Equal to Goblin Land Mine
    Actions
        For each (Integer A) from 1 to [COLOR="Red"]mine_limit[/COLOR], do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        [COLOR="RoyalBlue"]mine_unit[/COLOR][(Integer A)] Equal to (Triggering unit)
                    Then - Actions
                        For each (Integer B) from (Integer A) to [COLOR="Red"]mine_limit[/COLOR], do (Actions)
                            Loop - Actions
                                Set [COLOR="RoyalBlue"]mine_unit[/COLOR][((Integer B) - 1)] = [COLOR="royalblue"]mine_unit[/COLOR][(Integer B)]
                    Else - Actions
        Set [COLOR="Green"]mine_amount [/COLOR]= ([COLOR="green"]mine_amount[/COLOR] - 1)
 

trees123

New Member
Reaction score
6
It's okay, I don't mind if it's MUI. Personally, I don't see the big deal of not being able to cast a spell for multiple units at once. It's not like your going to be controlling 14 heroes anyway.

-Edit- Well, the trigger works once, but after it kills 1 mine it stops working. After a few minutes of searching, I've found another alternative -

The trigger checks whenever a unit enters the map, if the unit is one of the goblin mines (n00O, n00P, n00Q, n00N), if it its then: for the newly created unit make a timer equal to 15000 seconds and store it on the cache. Then count all units that are in the playable area that are one of the four mines and belongs to that player, if it is bigger than 15, then make a loop to see which Goblin land mine has the least remaining time and is also alive, then make that land mine explode (this will damage nearby enemies as if it was triggered, BTW).

Apparently, this is how IceFrog did it, but I don't quite understand this. Perhaps someone could clarify it for my little brain?
 

Moridin

Snow Leopard
Reaction score
144
What the trigger is doing is starting a timer for every mine placed. If the timer runs out, then the mine explodes. There is also an integer variable for each kind of mine that tells the editor how many mines of that type are in play. Every time this integer goes above 15, it cycles through all the mines of that type (I think via a unit group) and checks the timers. It finds the lowest (or most spent) timer via loops. The mine which has this timer attached is clearly the oldest mine of that type. It triggers this mine, and resets the integer variable to 15.

Edit: If you want to know the trigger for this....I'm afraid I can't help you as yet. I'm not too familiar with cache.
 

matiasld_77

New Member
Reaction score
0
Heres a quick GUI method, however this will only work for one of these heroes. (Not MUI at all)

Code:
Mine Setup
    Events
        Map initialization
    Conditions
    Actions
        Set [COLOR="Red"]mine_limit[/COLOR] = 8

Code:
Mine Create
    Events
        Unit - A unit enters (Entire map)
    Conditions
        (Unit-type of (Triggering unit)) Equal to Goblin Land Mine
    Actions
        Set [COLOR="Green"]mine_amount[/COLOR] = (mine_amount + 1)
        Set [COLOR="Red"]mine_unit[/COLOR][[COLOR="Green"]mine_amount[/COLOR]] = (Triggering unit)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                [COLOR="green"]mine_amount[/COLOR] Greater than [COLOR="Red"]mine_limit[/COLOR]
            Then - Actions
                Unit - Kill [COLOR="RoyalBlue"]mine_unit[/COLOR][1]
            Else - Actions

Code:
Mine Death
    Events
        Unit - A unit Dies
    Conditions
        (Unit-type of (Triggering unit)) Equal to Goblin Land Mine
    Actions
        For each (Integer A) from 1 to [COLOR="Red"]mine_limit[/COLOR], do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        [COLOR="RoyalBlue"]mine_unit[/COLOR][(Integer A)] Equal to (Triggering unit)
                    Then - Actions
                        For each (Integer B) from (Integer A) to [COLOR="Red"]mine_limit[/COLOR], do (Actions)
                            Loop - Actions
                                Set [COLOR="RoyalBlue"]mine_unit[/COLOR][((Integer B) - 1)] = [COLOR="royalblue"]mine_unit[/COLOR][(Integer B)]
                    Else - Actions
        Set [COLOR="Green"]mine_amount [/COLOR]= ([COLOR="green"]mine_amount[/COLOR] - 1)




Hi, my english is really bad (cus´im from Arg.), but i try to explain my idea.
I think that you have an error in the final code: (mine_amount - 1) :thdown:

I use the exact code and just work with the 1º mine. After that, this trigger doesn´t work. I correct this mistake, changing 1 sign :

(mine_amount + 1) :thup:
 

Panda

New Member
Reaction score
3
The spell is based in Place Land Mine which provides for 99% of its functionality.

The trigger checks whenever a unit enters the map, if the unit is one of the goblin mines (n00O, n00P, n00Q, n00N), if it its then: for the newly created unit make a timer equal to 15000 seconds and store it on the cache. Then count all units that are in the playable area that are one of the four mines and belongs to that player, if it is bigger than 15, then make a loop to see which Goblin land mine has the least remaining time and is also alive, then make that land mine explode (this will damage nearby enemies as if it was triggered, BTW).


Source: http://forums.dota-allstars.com/index.php?showtopic=220166

It's an awesome thread - bookmark it ;)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top