Mines

master maste

New Member
Reaction score
32
Trying to make a trigger that detects if a unit comes within 250 of any footman then make only that footman explode.

Tried this in the editor and can't seem to get it going.

Any help would be greatly appreciated.
 

elmstfreddie

The Finglonger
Reaction score
203
If it's only a certain unit that blows up footmen, then use
E - A unit comes within range of (blower upper dude)
C - unit type of triggering unit = footman
A - boom!
 

Icyculyr

I'm a Mac
Reaction score
68
Any footman? try this:

Variables
Code:
UGroup, Unit Group
Code:
[B]AddEventToKillFooty[/B]
Events
    Map Initilization
Conditions
Actions
    Set UGroup = Units in playable map area Matching condition unit-type of matching unit equal to YourUnit
    Pick every unit in UGroup and do Multiple Actions
        Add to KillFooty the event A unit comes within range of 250 of picked unit
    Custom script:   call DestroyGroup(udg_UGroup)

Code:
[B]KillFooty[/B]
Events
    (Added from link, yes this does work I have done it 1,000 times)
Conditions
    Unit-Type of Triggering Unit equal to Footman
Actions
    Kill Triggering Unit

So if the footman walks near the hero, or visa versa, the footman will die.
 

master maste

New Member
Reaction score
32
Made the trigger and tested it, and it did not work. . . btw this needs to work for units that are created at any point in the game.

+rep if you can help me get it to work. :)
 

Waaaaagh

I lost all my rep and my title being a jerk
Reaction score
70
JASS:
function CreateMine_MineId takes nothing returns integer
    return 'n000'
endfunction

function CreateMine_DetonationRange takes nothing returns real
    return 300.
endfunction

function CreateMine_Detonate takes nothing returns boolean
    local unit footy=GetTriggerUnit()
    if(GetUnitTypeId(footy)=='hfoo')then
        call SetUnitExploded(footy,true)
        call KillUnit(footy)
    endif
    set footy=null
    return false
endfunction

function CreateMine takes nothing returns boolean
    local unit mine=GetEnteringUnit()
    if(GetUnitTypeId(mine)==CreateMine_MineId())then
        call TriggerRegisterUnitInRange(CreateTrigger(),mine,CreateMine_DetonationRange(),Condition(function CreateMine_Detonate))
    endif
    set mine=null
    return false
endfunction
                                                    
//========================================================================================================
function InitTrig_CreateMine takes nothing returns nothing
    local region r=CreateRegion()
    call RegionAddRect(r,GetPlayableMapRect())
    call TriggerRegisterEnterRegion(CreateTrigger(),r,Condition(function CreateMine))
    set r=null
endfunction
 

Icyculyr

I'm a Mac
Reaction score
68
Can you please post your code, so I can see exactly what you are doing?

Because it will work, and just whenever you create the unit

use the same event to add that to the trigger when it is added
 

Halo_king116

Working As Intended
Reaction score
153
If I understand you, then elmstfreddie's trigger should work. It makes absoloutly perfect sense that it would.

UNLESS, the unit it is approaching has the ability that makes in unselectable. You know, the one so no one can click on it, yet it's still there? (Locust?) Anyways... Yea, it should work.


Other than that I am not sure. It should be simple I would think.


Have a good one.
 

Icyculyr

I'm a Mac
Reaction score
68
I think he wants any footman to blow up that come near it, not a specific one.

My code works, I just need to see what he has done with it.

So once again, master maste, please post what you did with my code.
 

master maste

New Member
Reaction score
32
waaaaagh what does the n000 get replaced with?

edit: I would prefer jass as I'm using jass, and the footman has locust, and is not allow to explode if another footman comes within range.

edit2: I edited waaaagh's trigger wrong by changing the two fields to ones they shouldnt and it crashed my map, and I had to go to a backup :p
 

Icyculyr

I'm a Mac
Reaction score
68
I do not think 'n000' is replaced with anything

it is a unit type id, I think he meant it to stay that way.

And are you going to post that code? I can not you if you do not do it, but who cares anyway.

Cheers
 

Waaaaagh

I lost all my rep and my title being a jerk
Reaction score
70
The raw value of your mine unit. If you don't know what that is, find the unit in the object editor, then press Ctrl+D. You will get a string 4 digits long. Put that, in " ' "s (apostrophes) in place of n000

More literally, the MineId (just like the function name says :p)
 

master maste

New Member
Reaction score
32
ok so I get this right, what two fields do I change.
because I have had WE crash 2 times now while saving because of that.

This is what I'm writing in:

JASS:
function CreateMine_MineId takes nothing returns integer
    return 'h009'
endfunction

function CreateMine_DetonationRange takes nothing returns real
    return 300.
endfunction

function CreateMine_Detonate takes nothing returns boolean
    local unit footy=GetTriggerUnit()
    if(GetUnitTypeId(footy)=='h009')then
        call SetUnitExploded(footy,true)
        call KillUnit(footy)
    endif
    set footy=null
    return false
endfunction

function CreateMine takes nothing returns boolean
    local unit mine=GetEnteringUnit()
    if(GetUnitTypeId(mine)==CreateMine_MineId())then
        call TriggerRegisterUnitInRange(CreateTrigger(),mine,CreateMine_DetonationRange,Condition(function CreateMine_Detonate))
    endif
    set mine=null
    return false
endfunction

//========================================================================================================
function InitTrig_CreateMine takes nothing returns nothing
    call TriggerRegisterEnterRegion(CreateTrigger(),GetPlayableMapRect(),Condition(function CreateMine))
endfunction


h009 is teh number after my custom unit (if you press Ctrl D)
 

Icyculyr

I'm a Mac
Reaction score
68
And umm

Waaaaagh, why are you using functions that return booleans instead of nothing, I am not sure that will work for adding the trigger

I have never tried, so it might, but it looks like your using a function to execute code, which your returning false, so you can use that function as a condition to create a new trigger..

Not sure if that made sense, and also

Master Maste, make sure your unit ID is exactly as it is,

If not use my code and convert it to jass:p
 

Waaaaagh

I lost all my rep and my title being a jerk
Reaction score
70
I use conditions instead of actions because conditions are faster. Both conditions and actions run when a trigger fires, conditions just need a boolean. Therefore, I simply always return false, so that I get an action in a condition. (Oh, and conditions don't leak) The function is called Condition(). It is used to convert a regular piece of code into a boolexpr. That boolexpr is what makes it faster, I think.
 
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

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top