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.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top