HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

making a unit invulnerable on 1 hp??

12-09-2003, 05:15 PM#1
Peacerich
This might be kinda strange question:

when a tower gets 1 hp i want it to become invulnerable. I know that is extremly easy to make, BUT I never want it to die. I want the enemy units to attack it untill it gets 1 hp, u get it? example:

a footmen attacks the tower.

tower has 5 hp and footmen damages it 12.

then i want the tower to get 1 hp, become invulnerable and prevent it from attacking.


Hope you get what i mean, plz reply as fast as u can...

EDIT: u might want to know what im gonna use it for:

there is gonna be a outpost in center of my map (AoS). It will have defence towers, and (heres what i want:) when it gets 1 hp it will stop attacking and become invulnerable. Then u can capture the outpost by moving onto a circle of power, and then a peon will come out of outpost and repair towers. When the towers have full hp it will become vulnerable again.
12-09-2003, 05:37 PM#2
FerretDruid
If you could make it a unit instead of a tower (a unit with a tower model), give it a cast backswing and cast point of 0.00 and a special reincarnation abilitity that has no graphics and is instant cast. (edit it like an ankh of reincarnation ability that grants 1 HP when unit is resurrected).

It's what I would do, what you are asking is a bit complicated trigger-wise.
12-09-2003, 05:52 PM#3
Peacerich
thhhxx for reply, ill try it right away:D

why do it has to be unit? a tower doesnt even have cast animation, which will ressurect directly... ill edit when i tried it

edit2: nope, i even tried making a trigger "if ability being cast = reincarnation then: chat message "it worked" to all players

and it didnt even show message when tower died = it never used ability.

plz help=(
12-09-2003, 06:09 PM#4
Silver_Lynx
This will work ONLY if the trigger takes effect faster than the death of the unit.

(I'm going by memory here, so this isn't going to be exact)

E - Unit Life drops <= 0
C - unit type of (triggering Unit) = unit of (whatever you want)
A - Set Unit life = 1
A - Make Unit Invulnerable

I have no idea if the trigger will take effect before the target dies. As for the Ankh idea, you wouldn't have to make it a unit, but you will have to make reincarnation a unit ability (not a hero ability) for the tower to be able to get it.
12-09-2003, 06:22 PM#5
Peacerich
fast replies=)

reinc didnt work, it never ressurects (dunno why)

hmm i guess ur trigger will work, but i come up with another one when i was gonna check the thread:

(just something like this:)

event: (tower) is under attack
if then else: if <attack damage of attacking unit> = greater then <current hp of attacked unit (the tower) then set hp of (attacked unit) = 1, make (attacked unit) invulnerable, AND something to prevent the tower from firing (count it as ded, but repairable).

ill go try both ur and mine right away...

thx for reply, if these dont work ill need more
12-09-2003, 06:22 PM#6
ObsidianTitan
Another option is make all units deal a strait amount of damage (12-12 as opposed to 12-15). Save all the damage in an integer array for what level they were spawned on, or save it inside custom value, or whatever as long as you can tell how much damage the unit does on attack.

Event - Unit attacks
Condition - Attacking unit equal to neutral hostile
Condition - (Unit life of attacked unit) is less than or equal to (damage of attacking unit)
Action - Make attacked unit Invulnerable
Action - Set life of attacked unit to 1

Not exact wording but you get the idea
12-09-2003, 06:29 PM#7
Peacerich
well... i dont want to change damage of all my units in my aos bcuz of one tower=)

**** now i got anotehr prob... what if the damage dealt is from a spell? then i cant use "if attack damage is greater then hp" cuz the damage dealt is not attack damage.. omg=(

i cudnt find any "attack damage" condition anyway

ill try urs now, silver lynx

edit: ehm silver... there is no "a units life becomes <1". You have to choose a unit, you cant use "generic unit event: life becomes <1" there is no such thing. emote_sweat
12-09-2003, 06:30 PM#8
Shark
try the
E: life drops below <the attacking units max dmg + 1> that is if u'r using only one attacking unit
A: set life to 1
A: set unit invulnerable
12-09-2003, 06:42 PM#9
Peacerich
tat wont work either=( there will be abilities; what if a hero uses a "earthquake-like"- ability? Its impossible to use the attack damage in any way,if u dont have a seppate for spell damage. Ive tried everything now=( anybody got another idea? ill keep trying (tomorrow)

:D

keep replying

edit:

I MADE IT!! the tower ressurects!! i had to fix death animation time to lowest (0.10 sec) and then set reincarnations revive time to 0.15 sec. Now ill just fix so it gets 1 hp, invulnerable, and prevent it from attacking!

thx for all replies, wudnt have made it without u! :D

edit2: lol now i cant make it work (making it invulnerable after ressurection). Shudnt this work:

e: a unit finishes casting an ability
IF THEN ELSE: IF= ability being cast = reincarnation
THEN: set life of <triggering unit> to 1 and make <triggering unit> invulnerable

it doesnt work, why?
12-09-2003, 10:39 PM#10
FerretDruid
I'm not sure how you are going to do this. I tried to get my idea to work and couldn't either...

I have seen this done in 2 or 3 maps, or something so similar. So I know it's possible.

Perhaps you could just replace it when it dies, that seems like it would be pretty foolproof. Give it 0 death animation time and just create a new units at it's position for <owner of killing unit> or whatever?
12-10-2003, 06:23 AM#11
chuayw2000
Perhaps you can do this:

Event A unit Dies
Condition: Dying unit is a structure = true
(any other conditions)
Set dyingunittype = Unit Type of (Dying Unit)
Unit - Remove (Dying Unit) from the game (should cancel the unit dying animation)
Unit - Create one (unit type of dying unit) at (position of dying unit) for player watever
Unit - Set Life of (Last Created Unit) to 1
Unit - Make (Last Created Unit) Invulnerable(any other stuff like variables.)

Then you can also make another trigger that makes the tower invulnerable should you be lucky enough to make the tower left with 1 HP