• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Capturing Building by attacking

Status
Not open for further replies.
Level 3
Joined
Oct 15, 2007
Messages
43
I couldn't figure out a trigger that would transfer a unit's control and restore life when the certain building is destroyed (or, low life, so that the building won't be destroyed purposely). This would be for specific buildings.

Any help would be thankful!
 
Level 7
Joined
Jul 24, 2008
Messages
294
I dont have accsess to a world eiditor right now but it would be something like this if i am not mistaken.
Event: A Building is attacked
Condition: Building = to Town Center[V]
And: Buidlings health is Equal to or lower to 100 HP
Action: If conditons are true
Action: Change Ownership of Town Center[V] to Attacking Unit
Action: Restore health of Town Center[V] To 1000 HP

Hope that helps
 

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
You should add the Unit - Life event to all the buildings you want that to happen.
I once made a similar system and used an ability + the A unit is Attacked event, but there's a problem: the Splash Ground ability. It deals damage and does not directly attack the unit, so the event doesn't trigger. Unit - Life will work better.

By the way, trigger-creation threads go on the World Editor Help Zone.
~Thread Moved
 
Last edited:
Level 3
Joined
Oct 15, 2007
Messages
43
I'll be due to remember moderator!

Actually I do remember making a trigger for this effect, I had some problems with it so I guess I'll put that in the Trigger area instead? Which I assume trigger help thing is for Trigger editing not creation?
 
Level 3
Joined
Oct 15, 2007
Messages
43
Well originally it was creation, then I remembered I had made one during an Advance Wars map I had made, though it still has problems, and needs expansion for the AOS type map I'm makin' now.

  • Capturing
    • Events
      • Unit - City 0017 <gen>'s life becomes Less than 100.00
    • Conditions
    • Actions
      • Unit - Change ownership of Factory 0000 <gen> to (Triggering player) and Change color
      • Unit - Set life of (Triggering unit) to 100.00%
Actually this trigger doesn't work either... instead it heals the building and the units keep attacking it.

Well I guess I could change it so that "Unit life < 100" could be moved to a condition, however I have no idea which condition would let me.

Then the trigger needs to check which team the player is on and give it to the AI captain (the one that spawns units in a timely fashion).
 
This what you're looking for?
  • Untitled Trigger 001
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Life of (Triggering unit)) Less than or equal to 100.00
          • Or - Any (Conditions) are true
            • Conditions
              • (Triggering unit) Equal to <Unit 1>
              • (Triggering unit) Equal to <Unit 2>
              • (Triggering unit) Equal to <Unit 3>
              • etc.
    • Actions
      • Unit - Change ownership of (Triggering unit) to (Owner of (Attacking unit)) and Change color
      • Unit - Set life of (Triggering unit) to 100.00%
 
Level 3
Joined
Oct 15, 2007
Messages
43
Yes, though I got a question,

Or - Any (Conditions) are true
Conditions
(Triggering unit) Equal to <Unit 1>
(Triggering unit) Equal to <Unit 2>
(Triggering unit) Equal to <Unit 3>
etc.

What would be the <Unit 1> ?
 
Level 3
Joined
Oct 15, 2007
Messages
43
Ah ok, then the last thing I would need is to somehow check the Triggering Player's Team so it can give the building control to the AI player of that team.
 
Level 3
Joined
Oct 15, 2007
Messages
43
Well I can't find the force thing, the closest thing I could find was (Random player from (allies of player3)).

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Triggering player) Equal to (Random player from (All allies of Player 3 (Teal)))
    • Then - Actions
      • Unit - Change ownership of (Triggering unit) to Player 3 (Teal) and Change color
      • Unit - Set life of (Triggering unit) to 100.00%
    • Else - Actions
Heh I don't really like Conditions that much, they always seem to not have the right thing I need, or they do but in a cryptic search for the right term for it. For instance, this would been easier if it was just Triggering player is equal to force 1... as far as I can tell.
 
No... thats not right... its a boolean comparison:
  • blah
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Owner of (Attacking Unit) is in (All allies of Player blah)) Equal to True
    • Then - Actions
      • blah
    • Else - Actions
before I moved on to JASS, I had thing for conditions: "if all else fails, its a boolean comparison" and it almost always seemed to work :grin:
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
A Unit Is Attacked sucks in many ways for this purpose.

Try this:

  • Capturable
    • Events
      • Unit - A Unit Dies
    • Conditions
      • ((Triggering Unit) has ability Capturable) Equal to True
    • Actions
      • Unit - Replace (Triggering Unit) with a (Unit-type of (Triggering Unit)), Using the New Unit's Max Life and Mana
      • -------- Change this next line as necessary --------
      • Unit - Set Owner of (Last Replaced Unit) to (Owner of (Killing Unit)), and Change color
 
Level 3
Joined
Oct 15, 2007
Messages
43
A Unit Is Attacked sucks in many ways for this purpose.

Try this:

  • Capturable
    • Events
      • Unit - A Unit Dies
    • Conditions
      • ((Triggering Unit) has ability Capturable) Equal to True
    • Actions
      • Unit - Replace (Triggering Unit) with a (Unit-type of (Triggering Unit)), Using the New Unit's Max Life and Mana
      • -------- Change this next line as necessary --------
      • Unit - Set Owner of (Last Replaced Unit) to (Owner of (Killing Unit)), and Change color


Where can i find the line
((Triggering Unit) has ability Capturable) Equal to True

I can't seem to find it >.<
 
Level 22
Joined
Jun 23, 2007
Messages
3,242
heres what i did on my map, fairly simple, although im not sure if AoE attacks will capture it correctly:
Events:
unit - A unit is attacked
Conditions:
unit type of attacked unit equal to strategic point (captureable building)
And-all conditions are true:
Life of Attacked unit is less than 200.00 (configurable)
Actions:
unit-Change ownership of attacked unit to owner of attacking unit and change color
unit-set life of attacked unit to 100%
 
Level 3
Joined
Oct 15, 2007
Messages
43
Heh, after some deduction, I found the given condition is a Boolien with "Triggered unit has Buff" not ability.

  • ((Triggering unit) has buff Acid Bomb) Equal to True
Well it's the closest thing to your example that I could find, I haven't tried it yet though.

Edit: really hard to find a way to give itself a passive buff to work however >.<
 
Last edited:
Status
Not open for further replies.
Top