Land Mine Ability

blurished

Active Member
Reaction score
1
ive made a skill which lays down a mine n explode upon contact, stunning a target (regains conscienceness if attacked).
heres the trigger

Lay Trap
Events
Unit - A unit Dies
Conditions
(Unit-type of (Triggering unit)) Equal to Stun Trap
Actions
Unit - Create 1 Dummy for (Triggering player) at (Position of (Triggering unit)) facing Default building facing degrees
Set Bomb[1] = (Last created unit)
Unit - Add Concusive to Bomb[1]
Unit - Order Bomb[1] to Undead Dreadlord - Sleep (Random unit from (Units within 200.00 of (Position of Bomb[1]) matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)))
Wait 2.00 seconds
Unit - Remove Bomb[1] from the game

the problem is how do i remove the limit of 1 bomb at a time cause the variable is fix to only 1 unit at a time. theres probably a custom script out there (not an expert in that so much help is needed)
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Add an expiration timer to the last created instead of removing it 2 seconds later.
 

TomTTT

New Member
Reaction score
44
Add an expiration timer to the last created instead of removing it 2 seconds later.
Exactly as skyblader said.
By the way, your trigger leaks. Set the Position of Triggering unit to a point variable, set the position of Bomb[1] into a point variable, set the Units within 200 of your last created point variable to a unit group variable, then remove those leaks:
call RemoveLocation(udg_YourPointsVariable)
call DestroyGroup(udg_YourGroupVariable)
 

blurished

Active Member
Reaction score
1
ok i really suck at this, what do u mean my trigger leaks? i tried skyblader's way n it works now
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
go to the "Turtorials and Resources" Sub-Forum and search for a turtorial about "Memory leaks".

memory leaks are a common issue unexperienced wc3 map makers encounter.
basically it means that each time this trigger is run another bit of your random access memory "RAM" is used to save the 2 locations and the unit group you use. that means at some point, after several runs of this trigger, all the RAM of your computer, or whoever is playing that map, will have no RAM left and the programm will lag or freeze.

of course, this trigger doesnt leak that badly cause computers nowadays are pretty powerful. still, it is a flaw of your trigger which can easily be avoided by using a temporary variable and a line of custom script.

what you need to do is saving the unit group / location into a variable, like this:
Code:
Set Temp_Point = (Position of (Triggering Unit))
and then you use it:
Code:
Unit - Create 1 Dummy for (Triggering player) at Temp_Point facing Default building facing degrees
and then you remove it:
Code:
custom script: call RemoveLocation (udg_Temp_Point)

similar for unit groups. better read that stuff up in a turtorial, its a bit much to write for me right now.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top