• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Trigger Help Involving Attacking Units and Buildings

Status
Not open for further replies.
Level 3
Joined
Mar 25, 2011
Messages
50
I'm trying to complete a map I initially created years ago, so a lot of this stuff is coming back slow. Regardless, I need some help with the following situation if you'd be so kind :)

Situation: Player 1 initially owns a base (Bandatia), and when it is attacked and reduced to 800 or below HP a dialog menu appears for the conquering player : either destroy or capture.

I have the dialog menu set up properly, and I can make it work between two set people, but I want the trigger to work for anyone who lowers the base below or equal to 800 hp.

Initial:
  • events:
  • Map initialization
  • Actions:
  • Trigger - Add to Dialog <gen> the event (Unit - Bandatia 0007 <gen>'s life becomes Less than or equal to 800.00)
  • Dialog - Create a dialog button for Dialog_Window labelled Capture the Town
  • Set Dialbuttone = (Last created dialog Button)
  • Dialog - Create a dialog button for Dialog_Window labelled Pillage the Town
  • Set Diabuttontwo = (Last created dialog Button)
Dialog:
  • Condtions:
  • ((Triggering unit) is A town-hall-type unit) Equal to True
  • Actions:
  • Unit - Make (Triggering unit) Invulnerable
  • Dialog - Change the title of Dialog_Window to Choose your Action
  • Dialog - Show Dialog_Window for (Owner of (Damage source))
Function:
  • Events:
  • Dialog - A dialog button is clicked for Dialog_Window
  • Actions:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Clicked dialog button) Equal to Dialbuttone
    • Then - Actions
      • Unit - Change ownership of Bandatia 0007 <gen> to IntegerP and Change color
      • Unit - Make Bandatia 0007 <gen> Vulnerable
      • Unit - Set life of Bandatia 0007 <gen> to 100.00%
    • Else - Actions
      • Player - Add (Random integer number between 275 and 425) to (Triggering player) Current gold
Thanks in advance for any help. I'm not sure if I can do it this way, or if I should tackle it in another manner. Hope everything sounds clear :p
 
Level 3
Joined
Mar 25, 2011
Messages
50
You mean it's not working for all players? Or two players can't have the same dialog at once?

First part yes, second part no. I want it to work for the player who brings the base down to 800 or below HP(the attacking player). I can make it work for a specific color, but it doesn't take into account the person who's attacking the base.

For example: what I have now is that blue could be attacking the base, but if the base goes below 800 hp red will receive the dialog. In this case, I'd want blue to receive it.

Does that clarify anything? (person to bring the base below 800hp receives the dialog)
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
Put your event in the second trigger, there is no event in there.
It seems like you've typed your triggers. Just right-click the trigger (above events) and Copy as text. And post them here between
  • [/.TRIGGER].
  • So we guarantee no event or line is lost. Because even when the event isn't put. No player should receive any dialog, but still. So there is an event. Do what I told you
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
There is no damaging player in response to a life less than X event since no damage is taken. You need to use a specific unit takes damage event.

Be aware that the approach you are doing is not recommended. Imagine this situation below.

You, player 1, are attacking town owned by player 2.
Me, player 3, is a total annoying ass (you will see why).
You get player 2 town down to 820 life.
I then proceede to land 1 attack with 1 unit on it lowering it below 800 life.
I get the control over the city, raise it for the gold (as I cannot defend against your army) leaving you holding the bill for conquest and me the rewards.
You rage because I just took what you worked hard for, most rage quit at this stage.

You see where I am getting? Oh but wait it gets better...
You, player 1, are attacking me, player 2, who is again being a total ass.
You get my town down to 820 life.
I then proceed to attack my own town dropping it below 800 life.
I "Capture" my own town, which I proceed to keep since I like being king of it.
Not only do I get to keep my town, it also gets fully healed again.
You rage that I was an ass. Most people rage quit at this stage.

I hope you understand what I am getting at here?

Your system needs the following to prevent these unfair situations.
1. Capturing does not re-heal the town. You need to physically repair it or allow time for it to naturally regenerate. To prevent Ping-Pong of ownership there is an invulnerability timer after capture of 15-30 seconds during which time it can be camped but not captured.
2. Players cannot capture their own or allied towns. Trying to do so just drops the town health to at least 1.
3. Capturing only occurs when a town is damaged below a health threshold and no third party is present (in the first case my unit being nearby would prevent you from capturing until you proceeded to kill it and then capture the town, since your large army is nearby I cannot capture the town as well).
3.2 Alternatively you can keep track on who has dealt the most damage to the town recently and award them it even if someone else gets the killing blow. This is more complicated and would need a sort of damage per player array per town (2D array).
 
Level 3
Joined
Mar 25, 2011
Messages
50
@ Dr Super Good: You have some very valid points, but I'm really just looking for the trigger to work in its most basic form. I mean, it may not essentially be of the highest quality (initially), but I hope to expand on it after some initial testing.

@ Cake: Attacking your own units could be a good idea to deny xp/gold bounty / necessary for friendly fire.

And yeah, I knew there was an option to post the entire trigger somewhere, but either the editor or myself was being retarded :p Regardless, the entire trigger is there.

Currently, the triggering unit is the base itself... I'm going to try and change it around so it's an attacking unit instead. Only thing I can think of atm.

Thanks for all the replies guys :)

Edit: Got it to work with a bit of help. Dang I was pretty close too :p
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
I would recommended using on-damage events that you attach to a trigger at map initialization. Leaks are not a concern as you will not be making many new bases (I think?). A Damage Detection System is far too much functionality for the problem at hand. You also need the on damage event to stop a possible bug whereby if enough units happen to land hits are around the same time it could kill the building before it is made invulnerable.
 
Level 3
Joined
Mar 25, 2011
Messages
50
I would recommended using on-damage events that you attach to a trigger at map initialization. Leaks are not a concern as you will not be making many new bases (I think?). A Damage Detection System is far too much functionality for the problem at hand. You also need the on damage event to stop a possible bug whereby if enough units happen to land hits are around the same time it could kill the building before it is made invulnerable.

That's a good point. It wouldn't happen often, but if it did, people would be upset :p I need to apply the trigger to 35 (36 total) bases, so it's also a question of one universal trigger or one uniquely for each base.
 
Status
Not open for further replies.
Top