HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

using the "unit falls below X amount of HP" event with unit types?

02-04-2003, 02:33 AM#1
Guest
Ok, I noticed the unit - life event where if such and such a unit falls below an hp, it will fire. Unfortunately, as with most maps, I have not created the said unit YET. And the only targets this allows is a pre-existing unit on the map.

Is there a way to use the "unit falls below X amount of life" event with say... a unit of unit-type comparison? If so, I can use it for a unit I will create during the course of the game.

Is there a workaround?
It looks like it could be a useful trigger, it just doesn't have useful options. :|
02-04-2003, 02:53 AM#2
Dinadan87
If you don't want the unit to be around at the start of the map then have a trigger run that hides it. Then when the unit is supposed to be created, unhide it. If it's a hero or something that can be trained, make another hero with it's tooltip, and when it is trained remove the trained one, move the hidden one to the location, and unhide it and nobody will be able to tell that the hero they just trained has been on the map since the start. Oh yeah make sure you make it owned by neutral passive at the start so that it doesn't take up any food, and transfer ownership once it's trained. (I'm not sure if hidden untis take food but it be better not to risk it :D )
02-04-2003, 02:59 AM#3
got_ammo
Or, you can do a periodic event that checks if units in unit group of all units of a specific type owned by player have the right hp.

Events - Every 1 second of the game
Conditions - Real Comparison - Life of (Random unit from (Units owned by player X of type X))) whatefver whatever
Actions - whatever

This would only work if there was only 1 of the unit type for that player so I don't know if it would help you out much.
02-04-2003, 05:04 AM#4
Guest
Thanks guys.. I have decided to use both ideas.
I'm going to put them as neutral passive hidden on the sidelines beforehand then change their ownership and then use the unit falls below hp thing, if that happens, they become invulnerable.

Then I'm going to calculate the total hp of the force using the every second thing.. so that if the total hp of the force falls below such and such, then an event happens.
02-05-2003, 12:36 AM#5
Dinadan87
Quote:
Originally posted by mooV-Cow
Thanks guys.. I have decided to use both ideas.
I'm going to put them as neutral passive hidden on the sidelines beforehand then change their ownership and then use the unit falls below hp thing, if that happens, they become invulnerable.

Then I'm going to calculate the total hp of the force using the every second thing.. so that if the total hp of the force falls below such and such, then an event happens.


That doesn't take the total HP of the force... It takes the HP of a RANDOM unit from the force and as a periodic event it can contribute to lag.
02-05-2003, 06:16 AM#6
Guest
perhaps I should explain myself..
I used the unit falls below hp thing for the action that, if the unit falls below a certain hp, it is made invulnerable..

however, I had a separate trigger fire that measures all the damage taken of all the units by adding them up. and if the damage adds up beyond a certain amount, it fires a 2nd event.

the two are totally separate.. I know what the trigger is for..
02-06-2003, 03:44 AM#7
keeperofstormz
the best way IMO is to create a unit in-game and assign a variable to him...example..

set UNIT=last created unit
set UNITLIFE= convert real to interger\life of X unit

..that way u could use those in your triggers adn use that variable for whatever u want to do..