Customized "Land Mines"

StRoNgFoE.

New Member
Reaction score
9
Hello!

As an item, I would like heroes to be able to purchase "land mines," which could be placed down anywhere on the map. I would like these land mines, however, to have a specific radius so heroes won't have to directly step on them to trigger the explosion.

When this land mine explodes, I'm looking for it to do AoE (area of effect) damage to all hostile units on the opposing force and POSSIBLY be able to knock back those units.

I have absolutely no idea where I'd begin making this, otherwise I'd create a trigger and test it and figure out what's wrong. If anyone has any ideas on where I could start, or how I could make the land mine have that effect and only be visible to the person who laid it down, and their team mates, it would be greatly appreciated. Thank you!

+rep ;-)
 

Smitty

Member
Reaction score
20
Right; I don't promise for this to be perfect, but here we go;

First off you want to create an item with an active ability which... Does nothing. Next create a dummy unit with an ability based on invisibility, with the duration set to zero, and targets allowed set to 'not self'. Then create a landmine unit. Then you want a trigger (freehand);

Event; a unit begins casting an ability

Conditions; ability being cast equal to LandMine (the item ability)

Actions;
• Set TempPoint = position of triggering unit
• Create one Landmine for owner of triggering unit at TempPoint
• Set TempUnit = last created unit
• Add last created unit to unit group Mines
• Create one dummy for owner of triggering unit at TempPoint
• Add a 2 second generic timer to last created unit
• Order last created unit to human priest - invisibility TempUnit
• (custom script) call DestroyLocation(udg_TempPoint)
• Set TempUnit = no unit


Now you need another trigger;

Events; every (1, maybe 0.5 seconds, not too short or too long. 0.5 should work fine)

Conditions;

Actions;
• Pick every unit in group Mines and do actions;
• >set TempPoint = position of picked unit
• >set TempGroup = all units within (detection radius) of TempPoint matching conditions (is an enemy of owner of picked unit, is alive)
• >IF;
• >> Number of units in TempGroup is greater than 0
• > THEN;
• >> Remove picked unit from the game
• >> Remove picked unit from group Mines
• >> Set TempUnit = picked unit
• >> Pick every unit in TempGroup and do actions;
• >>> Cause TempUnit to damage picked unit dealing (your damage/damage type here)
• >> Set TempUnit = no unit
• > ELSE;
• >>______
• > (custom script) call DestroyLocation(udg_TempPoint)
• > Remove all units of TempGroup from TempGroup

This should work, your mines will however be detectable with truesight, which is I assume what you wanted. Hope this works for you :)

I can also trigger knockback for you if you wish, but I'm on my phone, so unless you definitely want it, I'll leave it for now :) good luck ^.^
 

Accname

2D-Graphics enthusiast
Reaction score
1,463
Hello!

As an item, I would like heroes to be able to purchase "land mines," which could be placed down anywhere on the map. I would like these land mines, however, to have a specific radius so heroes won't have to directly step on them to trigger the explosion.

When this land mine explodes, I'm looking for it to do AoE (area of effect) damage to all hostile units on the opposing force and POSSIBLY be able to knock back those units.

I have absolutely no idea where I'd begin making this, otherwise I'd create a trigger and test it and figure out what's wrong. If anyone has any ideas on where I could start, or how I could make the land mine have that effect and only be visible to the person who laid it down, and their team mates, it would be greatly appreciated. Thank you!

+rep ;-)

Are you trolling or is this serious?

There is already an item in the game which does exactly this (besides the knockback), this item is called goblin land mines. . .
 

Smitty

Member
Reaction score
20
Uh, ok, I don't really know the basic wc3 items/spells and shit. If you use those triggers btw you'll want to create an effect when you remove the mine.

And why would I troll by writing out all that sh*t? Who loses out except me? :/ unless he's trolling in which case whatever, I have nothing better to do with my time right now.
 

Accname

2D-Graphics enthusiast
Reaction score
1,463
[...]And why would I troll by writing out all that sh*t? Who loses out except me? [...]

I didnt quote you but the creator of this thread.

Besides, trigger something which already exists as object editor data is really a bad idea. Its a waste of performance and memory.
 

StRoNgFoE.

New Member
Reaction score
9
No, not trolling. A goblin land mine was something I had in mind, but what I asked was different; as the effects I'm looking for aren't given to that item. I am though, interested in adding knock back to that item. By the way, thank you, Smitty! :)
+rep

(I believe I've already given you rep in the past)
 

inevit4ble

Well-Known Member
Reaction score
38
Well, I'm not sure if you can set the radius on the goblin land mine so you should check that out, otherwise you can use a ward rather, say statis ward. That would give you a radius to work with.

And to have the knock back isn't so hard either. You can use any of the system already out there and begin it with the event "A Unit Dies" as when a mines explodes or ward pops it is in fact dying. Throw in a simple check to see if it is the mine and begin your trigger using Position of Dying Unit as a reference point.
 

Accname

2D-Graphics enthusiast
Reaction score
1,463
No, not trolling. A goblin land mine was something I had in mind, but what I asked was different; as the effects I'm looking for aren't given to that item. I am though, interested in adding knock back to that item. By the way, thank you, Smitty! :)
+rep

(I believe I've already given you rep in the past)
What exactly does the goblin landmine not do what you asked (other then knockback)?

Regarding the trigger above, i would not recommend using it at all, its highly inefficient and will take quite some performance for a simple task.
 

Smitty

Member
Reaction score
20
It's not THAT inefficient, but yeh, the landline would probably be better. For knockback you could just trigger a small move every 0.04s away from the mine, but there's probably systems already for that.
 

Accname

2D-Graphics enthusiast
Reaction score
1,463
It's not THAT inefficient, but yeh, the landline would probably be better. For knockback you could just trigger a small move every 0.04s away from the mine, but there's probably systems already for that.

its highly inefficient.

You can do this simply by using object editor data.
Create a new unit, give it permanent invisibility, give it the unit classification ward, give it an artillery attack and spawn it simply using a "summon unit" ability.
thats it, no trigger needed at all.

for the knockback i would advice you to get a system. unless this is the only ability which knockbacks enemies in your game it would not be very wise to try to script an entire knockback system yourself because knockback systems in Jass are by far more efficient then GUI systems. and there are plenty of decent ones around which are optimized and clean.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
for the move just do this...

This trigger detects the mines

Trigger 1
Trigger:
  • Events
    • A unit enters playable map area
    • Conditions
      • Unit-Type of triggering unit is Mine is equal to true
    • Actions
      • Trigger - Add event (A unit comes within (explosion range) of triggering unit) to trigger 2 <gen>


This trigger detects when units come within range of the mine

Trigger 2
Trigger:
  • Events
    • Conditions
      • Number of units within (explosion range) of triggering unit matching (unit type of matching unit equal to mine is true AND owner of matching unit is equal to an enemy of owner of triggering unit) is greater than 1
    • Actions
      • Unit group - Add triggering unit to Pushback_Group
      • If Then Else
        • If
          • Number of units in Pushback_Group is equal to 1
        • Then
          • Trigger - turn on Trigger 3 <gen>
        • Else


This trigger does the move effect

Trigger 3
Trigger:
  • Events
    • Time - Periodic Event (every 0.05 seconds or however frequent you want it)
    • Conditions
    • Actions
      • Unit group - Pick every unit in playable map area matching conditions unit type of unit is equal to mine and unit is dead is equal to true and unit has decayed is equal to false and do actions
        • Actions
          • Unit Group - add picked unit to Exploded_Mine (unit group var)
      • Unit group - Pick every unit in Pushback_Group and do actions
        • Set Temp_Point_1 = position of picked unit
        • Set Temp_Distance = (max push back range)
        • Actions
          • Unit group - Pick every unit in Exploded_mine and do actions
            • Actions
              • If then else
                • If
                  • Distance between picked unit and Temp_Point_1 is less than Temp_Distance
                • Then
                  • Set Temp_Mine = picked unit
                  • Set Temp_Point_2 = position of picked unit
                  • Set Temp_Distance = distance between picked unit and temp_point_1
          • Set temp_point_3 = temp_point_1 offset by (the same distance you want to push divided by how long you want the max pushback time to be) in the direction of (the difference between temp_point_1 and temp_point_2)
          • If then else
            • If
              • Unit is paused is equal to false
            • Then
              • Unit - Pause picked unit
              • Unit - move picked unit instantly to temp_point_3
              • Unit - unpause picked unit
            • Else
              • Unit - move picked unit instantly to temp_point_3
          • If then else
            • If
              • Distance between picked unit and temp_point_2 is greater than (max distance)
            • Then
              • Unit Group - remove picked unit from Pushback_Group
            • Else
          • If Then Else
            • If
              • Number of units in Pushback_Group is equal to 0
            • Then
              • Trigger - Turn off this trigger
            • Else
          • Custom Script: callremovelocation(UDG_temp_point_1)
          • Custom Script: callremovelocation(UDG_temp_point_2)
          • Custom Script: callremovelocation(UDG_temp_point_3)
          • Custom Script: calldestroyunitgroup(UDG_exploded_mine)


then make sure you make the expiration time of the mine to the max pushback distance, im sure this woulda been way easier with vjass
 

Accname

2D-Graphics enthusiast
Reaction score
1,463
that triggers above are leaking horribly, they are 3 and all 3 of them leak.
 

Smitty

Member
Reaction score
20
Yeah, you need to use proper variables for most of that stuff otherwise as ax name says it'll leak like hell.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
what specifically leaked? i did it on my lunch hour at work, forgive how unorthadox it was
 

Smitty

Member
Reaction score
20
You do things like 'pick every unit in range bla bla and do action', and 'position of picked unit'.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
i may have missed a few groups to destroy but u got the picture right? i did this freehand in between eating and calling 200 people

and i have no idea how the first leaks, and the second one has 1 group that is cleared in the 3rd, which fires every second a few times after the 2nd is fired
 

Smitty

Member
Reaction score
20
Yeh, I get it, but I'm pointing it out in case anyone decides to use this. When you set a group variable, use 'set variable' rather than picking units and adding them to the group. Also, using 'position of unit' leaks a point, unless it's set as a variable and destroyed later ^.^
 

Accname

2D-Graphics enthusiast
Reaction score
1,463
what specifically leaked? i did it on my lunch hour at work, forgive how unorthadox it was
the first trigger is leaking events.

Edit:
Here, take this demo map:
http://www.2shared.com/file/TgA5SM4Q/ZLandMinesWithKnockback.html

You can summon a "Landmine" unit with any kind of summon ability.
The landmine got the "ghost" ability, the same as the shades of the undead have. they are invisible to enemies but have no pathing for other units.
The landmine also got a normal attack, set the attack range to whatever you like.
If the landmine attacks it will trigger the detonation triggers event.

I made a quick custom GUI knockback system which should work well if you do not use too many knockbacks in your map. If you want to use more i highly recommend using a Jass system for this.

I havent added any comments to the triggers but i hope most of it is self-explanatory.

here are the triggers:
Trigger:
  • Spell Trap Detonation
    • Events
      • Unit - A unit is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Land Mine
    • Actions
      • Unit - Kill (Attacking unit)
      • Set Temp_Point = (Position of (Attacking unit))
      • Set Temp_Group = (Units within 256.00 of Temp_Point matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is a Building) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of (Attacking unit))) Equal to True))))
      • Special Effect - Create a special effect at Temp_Point using Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect at Temp_Point using Abilities\Weapons\Mortar\MortarMissile.mdl
      • Special Effect - Destroy (Last created special effect)
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Set Temp_Point_2 = (Position of (Picked unit))
          • Einheit - Cause (Attacking unit) to damage (Picked unit), dealing 250.00 damage of attack type Spell and damage type Normal
          • Set Temp_Real = (Angle from Temp_Point to Temp_Point_2)
          • Hashtable - Save 10 as (Key PushBackDistance) of (Key (Picked unit)) in CON_Knockback_Hashtable
          • Hashtable - Save Temp_Real as (Key PushBackAngle) of (Key (Picked unit)) in CON_Knockback_Hashtable
          • Set GLO_Knockback_Victim_Counter = (GLO_Knockback_Victim_Counter + 1)
          • Unit Group - Add (Picked unit) to CON_Knockback_Group
          • Trigger - Turn on Knockback Loop <gen>
          • Custom script: call RemoveLocation (udg_Temp_Point_2)
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Custom script: call DestroyGroup (udg_Temp_Group)


Trigger:
  • Knockback Init Hashtable
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set CON_Knockback_Hashtable = (Last created hashtable)


Trigger:
  • Knockback Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in CON_Knockback_Group and do (Actions)
        • Loop - Actions
          • Set Temp_Int = (Load (Key PushBackDistance) of (Key (Picked unit)) from CON_Knockback_Hashtable)
          • Set Temp_Real = (Load (Key PushBackAngle) of (Key (Picked unit)) from CON_Knockback_Hashtable)
          • Set Temp_Point = (Position of (Picked unit))
          • Set Temp_Point_2 = (Temp_Point offset by 16.00 towards Temp_Real degrees)
          • Unit - Move (Picked unit) instantly to Temp_Point_2
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • IF Conditions
              • Temp_Int Equal to0
            • THEN Actions
              • Unit Group - Remove (Picked unit) from CON_Knockback_Group
              • Set GLO_Knockback_Victim_Counter = (GLO_Knockback_Victim_Counter - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • IF Conditions
                  • GLO_Knockback_Victim_Counter Gleich 0
                • THEN Actions
                  • Trigger - Turn off (This trigger)
                • ELSE Actions
            • ELSE Actions
              • Hashtable - Save (Temp_Int - 1) as (Key PushBackDistance) of (Key (Picked unit)) in CON_Knockback_Hashtable
          • Custom script: call RemoveLocation (udg_Temp_Point)
          • Custom script: call RemoveLocation (udg_Temp_Point_2)
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
leaking events? how is that possible? my maps function fine with multiple triggers that have an event for almost every unit in game with little to no lag even on shitty computers...

unless you meant it would add the event multiple times, and i was just spitballing i have not used landmines much, now that i know it is an attack it is much easier to trigger
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • 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
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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