• 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] Base Capture

Status
Not open for further replies.
Level 5
Joined
Oct 30, 2007
Messages
91
Okay i need help on a trigger that when building's health = 20% for example it changes color to red or blue according to the attacking player. THX Also i want one that will make it so i don't have to make a lot of triggers he he.. thx!!!
 
Level 4
Joined
Jul 27, 2007
Messages
91
Well..I don't have WE open infront of me this very second..but..

From my limitied memory, I'd say you'd have to make it something to where when unit controlled by <playerX> is lowered to 20% health by <playerY>, the unit changes ownershhip to <playerY> AND fully heals...

Again..while I'm not sure the exact script structure, at least at this very moment, this is a decent guide to at least give you an idea...I think.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
  • Unknown
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to A.Unit
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Life of (Triggering unit)) Less than or equal to ((Max life of (Triggering unit)) / 5.00)
        • Then - Actions
          • Unit - Change color of (Triggering unit) to (Color of (Owner of (Attacking unit)))
        • Else - Actions
One friendly trigger :wthumbsup:
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,259
For most accurate results, use the unit is damaged event.

On map initilization you add all the events via your starting trigger to another trigger with no events which will actually preform the conversion of the building.

In that trigger you run your life check and then convert it, as it will be more accurate and reduce the chance of "overdamaging" the building and killing it by mistake (which can happen if only seige attack it so enough damageis done to kill the building before they nect attack).
 
Level 11
Joined
Feb 22, 2006
Messages
752
For most accurate results, use the unit is damaged event.

On map initilization you add all the events via your starting trigger to another trigger with no events which will actually preform the conversion of the building.

Yes that would be ideal. However, keep in mind the TriggerRegisterUnitEvent() function can only take either gg_units as a parameter or function returns; it will not let you use user-defined globals (udg_) variables or locals, even if you do it in JASS. Also, too many unit events for that one trigger = lag.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,259
Actually, It works perfectly with JASS and people do it all the time. No idea who told you such inaccurate information but maybe in GUI it does not let you use a global but certianly in JASS it does.

It takes a unit, which can be from any source, even created within the event creator as long as it is a unit.

Also with a lot of events on one trigger should not cause too much lag, as it is hardly much worse than a generic unit is attacked or as slowing as a leak.
 
Level 11
Joined
Feb 22, 2006
Messages
752
I was pretty sure TriggerRegisterUnitEvent() can't take locals or udgs as a parameter since I used that function for a damage detection system and the system wouldn't work until I changed the parameter from a local variable to GetTriggerUnit(). But maybe you're right...

Secondly, how much it lags depends on how many events. If you're getting into hundreds of events for a single trigger it will lag. The Any Unit Event function is actually only about 17 events (or however many players there are on the map), not one event for every unit on the map, so you can't really compare the two.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Right ~Dr Super Good~ forgot about that.
Here it is

  • Unknown
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set attackedunit = (Attacked unit)
      • Trigger - Add to Find damage <gen> the event (Unit - attackedunit Takes damage)
  • Unknown2
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Life of attackedunit) Less than or equal to ((Max life of attackedunit) / 5.00)
        • Then - Actions
          • Custom script: set bj_wantDestoryGroup = true
          • Unit Group - Pick every unit in (Units owned by (Owner of attackedunit)) and do (Actions)
            • Loop - Actions
              • Unit - Change color of (Picked unit) to (Color of (Owner of (Damage source)))
        • Else - Actions

Now I don't know if this will work or automaticly crush your warcraft.
The last time (and only time) I tried to use "Damage Source" it curshed my warcraft untill I removed it.

If it does crush do something like this (you can do it either with unit variable or player variable)

  • Unknown
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set attackedunit = (Attacked unit)
      • Set attackingunit = (Attacking unit)
      • Trigger - Add to Find damage <gen> the event (Unit - attackedunit Takes damage)
  • Unknown2
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Life of attackedunit) Less than or equal to ((Max life of attackedunit) / 5.00)
        • Then - Actions
          • Custom script: set bj_wantDestoryGroup = true
          • Unit Group - Pick every unit in (Units owned by (Owner of attackedunit)) and do (Actions)
            • Loop - Actions
              • Unit - Change color of (Picked unit) to (Color of (Owner of attackingunit))
        • Else - Actions
 
Level 7
Joined
Oct 8, 2007
Messages
154
GhostWolf i see U are experienced in GUI thanks for all triggers because i don't know jass. :/

Cup2fun let me ask what kind of map are u going to make. U know capturing building seems intresting to me. I think about adding it in my Footy Frenzy it will be something new...
 
Status
Not open for further replies.
Top