Building capturing

F

flaice

Guest
So how can I do a trigger that lets me to capture a building/area? Im making a map where is 6 Control Points, and you have to capture them all to win. And the building/area must be able to capture, if the opposite team owns it.

Thanks already.
 

LightChaosma

New Member
Reaction score
60
e
a unit comes within 200 of YOURBUILDING
c

a
change owner of YOURBUILDING to (owner of(triggering unit/enterning unit)

this would ofcourse become awkward when 2 players are near one building...

you could give a little more info...
 

I_RULE_YOU

New Member
Reaction score
34
If its something where you select the building to control it, you could base it off Charm.
 

ZeratuelX

New Member
Reaction score
6
Sorry for the fairly late reply. The code I created may be a bit lengthy but is mostly worth it, take out what you don't need. I like to oversupply. Anyway, heres the code. I attached a map with the triggers in it for copy/paste purposes only, it is not a demo.

Take Point A
Code:
Take Point A
    Events
        Unit - A unit comes within 200.00 of Guard Tower 0000 <gen>
    Conditions
        (Owner of (Triggering unit)) Not equal to (Random player from (All allies of (Owner of Guard Tower 0000 <gen>)))
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units within 200.00 of (Position of Guard Tower 0000 <gen>) matching ((Owner of (Matching unit)) Equal to (Random player from (All allies of (Owner of Guard Tower 0000 <gen>)))))) Equal to 0
            Then - Actions
                -------- Start Takeover Countdown --------
                Trigger - Run Start Countdown A <gen> (ignoring conditions)
            Else - Actions
                Game - Display to (All players matching ((Owner of (Triggering unit)) Equal to (Matching player))) for 10.00 seconds the text: Enemy units are con...

Kill Defenders A
Code:
Kill Defenders A
    Events
        Unit - A unit Dies
    Conditions
        (Triggering unit) Equal to (Random unit from (Units within 200.00 of (Position of Guard Tower 0000 <gen>) matching ((Owner of (Triggering unit)) Equal to (Random player from (All allies of (Owner of Guard Tower 0000 <gen>))))))
    Actions
        -------- Run defender check again --------
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units within 200.00 of (Position of Guard Tower 0000 <gen>) matching ((Owner of (Triggering unit)) Equal to (Random player from (All enemies of (Owner of Guard Tower 0000 <gen>)))))) Greater than or equal to 1
                (Number of units in (Units within 200.00 of (Position of Guard Tower 0000 <gen>) matching ((Owner of (Matching unit)) Equal to (Random player from (All allies of (Owner of Guard Tower 0000 <gen>)))))) Equal to 0
            Then - Actions
                Trigger - Run Take Point A <gen> (ignoring conditions)
            Else - Actions
                Do nothing

Start Countdown A
Code:
Start Countdown A
    Events
    Conditions
    Actions
        Game - Display to (All allies of (Owner of Guard Tower 0000 <gen>)) for 5.00 seconds the text: Point A is being ta...
        Game - Display to (All enemies of (Owner of Guard Tower 0000 <gen>)) for 5.00 seconds the text: Point A is being ta...
        Wait 5.00 seconds
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units within 200.00 of (Position of Guard Tower 0000 <gen>) matching ((Owner of (Matching unit)) Equal to (Random player from (All enemies of (Owner of Guard Tower 0000 <gen>)))))) Equal to 0
            Then - Actions
                Game - Display to (All players) for 10.00 seconds the text: Countdown aborted! ...
                Skip remaining actions
            Else - Actions
                Do nothing
        Game - Display to (All players) for 5.00 seconds the text: 25 seconds until Po...
        Wait 5.00 seconds
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units within 200.00 of (Position of Guard Tower 0000 <gen>) matching ((Owner of (Matching unit)) Equal to (Random player from (All enemies of (Owner of Guard Tower 0000 <gen>)))))) Equal to 0
            Then - Actions
                Game - Display to (All players) for 10.00 seconds the text: Countdown aborted! ...
                Skip remaining actions
            Else - Actions
                Do nothing
        Game - Display to (All players) for 5.00 seconds the text: 20 seconds until Po...
        Wait 5.00 seconds
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units within 200.00 of (Position of Guard Tower 0000 <gen>) matching ((Owner of (Matching unit)) Equal to (Random player from (All enemies of (Owner of Guard Tower 0000 <gen>)))))) Equal to 0
            Then - Actions
                Game - Display to (All players) for 10.00 seconds the text: Countdown aborted! ...
                Skip remaining actions
            Else - Actions
                Do nothing
        Game - Display to (All players) for 5.00 seconds the text: 15 seconds until Po...
        Wait 5.00 seconds
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units within 200.00 of (Position of Guard Tower 0000 <gen>) matching ((Owner of (Matching unit)) Equal to (Random player from (All enemies of (Owner of Guard Tower 0000 <gen>)))))) Equal to 0
            Then - Actions
                Game - Display to (All players) for 10.00 seconds the text: Countdown aborted! ...
                Skip remaining actions
            Else - Actions
                Do nothing
        Game - Display to (All players) for 5.00 seconds the text: 10 seconds until Po...
        Wait 5.00 seconds
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units within 200.00 of (Position of Guard Tower 0000 <gen>) matching ((Owner of (Matching unit)) Equal to (Random player from (All enemies of (Owner of Guard Tower 0000 <gen>)))))) Equal to 0
            Then - Actions
                Game - Display to (All players) for 10.00 seconds the text: Countdown aborted! ...
                Skip remaining actions
            Else - Actions
                Do nothing
        Game - Display to (All players) for 5.00 seconds the text: 5 seconds until Poi...
        Wait 1.00 seconds
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units within 200.00 of (Position of Guard Tower 0000 <gen>) matching ((Owner of (Matching unit)) Equal to (Random player from (All enemies of (Owner of Guard Tower 0000 <gen>)))))) Equal to 0
            Then - Actions
                Game - Display to (All players) for 10.00 seconds the text: Countdown aborted! ...
                Skip remaining actions
            Else - Actions
                Do nothing
        Game - Display to (All players) for 1.00 seconds the text: 4...
        Wait 1.00 seconds
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units within 200.00 of (Position of Guard Tower 0000 <gen>) matching ((Owner of (Matching unit)) Equal to (Random player from (All enemies of (Owner of Guard Tower 0000 <gen>)))))) Equal to 0
            Then - Actions
                Game - Display to (All players) for 10.00 seconds the text: Countdown aborted! ...
                Skip remaining actions
            Else - Actions
                Do nothing
        Game - Display to (All players) for 1.00 seconds the text: 3...
        Wait 1.00 seconds
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units within 200.00 of (Position of Guard Tower 0000 <gen>) matching ((Owner of (Matching unit)) Equal to (Random player from (All enemies of (Owner of Guard Tower 0000 <gen>)))))) Equal to 0
            Then - Actions
                Game - Display to (All players) for 10.00 seconds the text: Countdown aborted! ...
                Skip remaining actions
            Else - Actions
                Do nothing
        Game - Display to (All players) for 1.00 seconds the text: 2...
        Wait 1.00 seconds
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units within 200.00 of (Position of Guard Tower 0000 <gen>) matching ((Owner of (Matching unit)) Equal to (Random player from (All enemies of (Owner of Guard Tower 0000 <gen>)))))) Equal to 0
            Then - Actions
                Game - Display to (All players) for 10.00 seconds the text: Countdown aborted! ...
                Skip remaining actions
            Else - Actions
                Do nothing
        Game - Display to (All players) for 1.00 seconds the text: 1...
        Wait 1.00 seconds
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units within 200.00 of (Position of Guard Tower 0000 <gen>) matching ((Owner of (Matching unit)) Equal to (Random player from (All enemies of (Owner of Guard Tower 0000 <gen>)))))) Equal to 0
            Then - Actions
                Game - Display to (All players) for 10.00 seconds the text: Countdown aborted! ...
                Skip remaining actions
            Else - Actions
                Do nothing
        Game - Display to (All players) for 10.00 seconds the text: Point A has been ta...
        Unit - Change ownership of Guard Tower 0000 <gen> to Player 1 (Red) and Change color

Notice! The last line here you'll have to change to be based on your player scheme.

Let me know if this code doesn't work, I'll try to fix it.
 

Attachments

  • Control-Triggers.w3x
    15.7 KB · Views: 167

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
@Zeratuel: Try inserting some loops in there, lengthy codes can be reduced with loops. :D
 

ZeratuelX

New Member
Reaction score
6
I probably should. I never really got too comfortable with loops because I hardly ever use em.
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
I like using loops, cause it means less work, and more output. :p
 

ZeratuelX

New Member
Reaction score
6
Heh. Maybe I'll revise the code I gave him in a bit. Right now he's just gonna have to use it as it is.
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
And I'm pretty sure, 'Units within range' and stuff leaks.
 
F

flaice

Guest
Ty very much! :) I havent got time to test 'em yet, but I think I will do it today.

Edit: More information about what im looking for:
So I need trigger that you can only capture few buildings/areas, not all of the buildings, also only heroes should be able to capture them, and if possible, as more allied heroes there is, the faster building/area will be captured.
 

Levdragon

Member
Reaction score
2
Hmm I dunno if this is what your looking for but...

Event:Unit is attacked
Condition:Life of (Triggering Unit) Equal to or Lesser than (Health)
:Unit Type of (Attacked Unit) Equal to (Control Point?? Whatever the name of your building is.)
Actions:Change owner of (Attacked Unit) to Owner of (Attacking Unit) and change color.
:Set life of (Attacked Unit) to (Value.)

This will basicly make it so if the specific building is attacked and goes below % health it will change ownership to the attacking player and its health back to max. I'm not sure about the hero thing but I hope this is what you need.
 
F

flaice

Guest
I think it is, I don't have time to try it now, but I will tomorrow. I'll post my comments here then.
 

cleeezzz

The Undead Ranger.
Reaction score
268
if your planning on using my system, just go to the capture trigger, and under the Unit Group - Pick All units in (forgot what group) then theres an IF/THEN/ELSE

just remove all the other conditions and add, Unit is a hero.

and for certain buildings, you can modify the 1st few triggers to exclude some buildings. for example... make the buildings you want capture-able have a point value of 1000, then in the building initialize triggers, add a condition where point value of building is 1000, then only the ones you want will be captureable.
 
F

flaice

Guest
I think your trigger is way too complicated for me :/

Hmm I dunno if this is what your looking for but...

Event:Unit is attacked
Condition:Life of (Triggering Unit) Equal to or Lesser than (Health)
:Unit Type of (Attacked Unit) Equal to (Control Point?? Whatever the name of your building is.)
Actions:Change owner of (Attacked Unit) to Owner of (Attacking Unit) and change color.
:Set life of (Attacked Unit) to (Value.)

This will basicly make it so if the specific building is attacked and goes below % health it will change ownership to the attacking player and its health back to max. I'm not sure about the hero thing but I hope this is what you need.
It works, if not many units arent attacking it. If theres like 10 units attacking it, and I set it to change team when hp is below 50, then it gets destroyed.
 

Levdragon

Member
Reaction score
2
Alright than try this one i whipped up

Events:When a unit dies
Conditions: Dying unit equals to (Unit)
Actions:Create 1 (Unit) for Owner of Killing Unit facing Blah blah non important

thats what I posted last time but instead when this one gets destoryed it will appear again. Again im not sure about the hero thing.
 
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

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top