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: 170

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

      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