| 11-09-2003, 08:26 AM | #1 |
How do I set an event to execute an action on ANY unit on the entire map who's life reaches a percentage of it's MAX hps. For instance, Footman #175 drops below 30% hp, then ---> Action - <alter stats of triggering unit>. I don't know if I should be embarrased about not even being able to figure out how to do this with just a -single- unit... But I can't. I tried making a variable for unit %life and I was unable to complete one. |
| 11-09-2003, 11:10 AM | #2 |
I've gotten this to work on a map just now. I'm going to post the triggers and the map, so you can see how it was done. I use an ability to give the units a wounded status, but changÃÂ*ng their stats or whatever could work, too. Note: I do use some UMSWE triggers for this, so if you're not already using that, get it. First, I create the trigger to actually wound units. Code:
Wounded when Below 30 Percent
Events
Conditions
(Percentage life of (Triggering unit)) Less than or equal to 30.00
Actions
-------- Wounds the unit by adding a custom ability based off endurance aura --------
Unit - Add Wounded to (Triggering unit)Code:
Register Existing Units
Events
Time - Elapsed game time is 0.10 seconds
Conditions
Actions
-------- All non-buildings on the map can be wounded. --------
Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) is A structure) Equal to False)) and do (Trigger - Add to Wounded when Below 30 Percent <gen> the event (Unit - (Picked unit) Takes damage))And finally, I make any new units also trigger the event: Code:
Register Entering Units
Events
Unit - A unit enters (Playable map area)
Conditions
((Entering unit) is A structure) Equal to False
Actions
-------- Any entering non-building can be wounded. --------
Trigger - Add to Wounded when Below 30 Percent <gen> the event (Unit - (Entering unit) Takes damage)And there you have it. My wounded ability slows the units attack and move speed down, and creates a bleeding effect from their chest. If you want some way to heal the wounds, simply have triggers remove the 'wounded' ability when the healing is applied. Here is a small demonstration map, as well: |
| 11-09-2003, 01:29 PM | #3 |
That was a nice example. I checked out the map, but I don't use UMSWE and I don't intent to get it at the time. - Using what you have mentioned I have nearly gotten the effect that I want though, I'm trying to do the same thing as you have with a couple exceptions: the abilities check movement speed as a condition before they are given to a unit, and I'm using 2 seperate abilites that are applied to the unit at different life percentages. I'm going to work on it some more then update, I just kept noticing this post staring at me everything the WE minimized when I hit Test Map so I had to reply. :D |
| 11-09-2003, 05:59 PM | #4 |
I couldn't figure out what you were doing with those triggers until I copied it and compared them to mine directly. It's amazing what one can learn just by looking at someone elses code =P Here's the map I have so far, with the abilities that I want. They do come into effect at the right times - BUT, I am having difficulty turning them off. If you are reading this post and you know your triggers, please download it and take a look and see if you can figure out why my triggers aren't turning off both my abilites at the proper times (it works okay for ONE custom ability and does nothing for the other. Identical triggers though !!!) EDIT: The abilites I am talking about are "Bleed" and "Near Death", the others are fine the way that they are so just toy with them if you want. |
| 11-09-2003, 09:03 PM | #5 |
OH. MY. GOD. Bulletcatcher you are my ultimate hero! I never knew you could carry events and stuff like that from trigger to trigger without variables! I LOVE YOU! |
| 11-09-2003, 09:56 PM | #6 |
I've started working on it, buuut I don't have enough time today. So many things to do, so little time... Anyway, I'll try to put up working triggers tomorrow, unless someone else does it. [Edit: Oh, and thanks, I guess. I just figured that method out when trying to do this, but I can see it being useful for a lot of things.] [Edit - Again!: Heh, seems like I kept the 'post message' page open for over an hour. Go me.] |
