| 08-12-2006, 07:34 AM | #1 |
Is there anyway to make a unit invunerable to everyone but a small group of units? They will all be owned by one player but that one player can have other units. I was thinking of changing his unit type/classification but I have a huge number of other abilites that I would need to change so I would rather avoid doing that. I'd rather not use damage restoration triggers. I can't stop units from targeting the unit because of the huge variety of spells I have would make detecting the unit a huge pain. |
| 08-12-2006, 08:45 AM | #2 |
This sounds hard. Is the small group of unit is a fixed one, like they are all the same all the time, even preplaced? Or are the dynamicly created? In what way invulnerable? Both attack and spells? |
| 08-12-2006, 01:24 PM | #3 |
Invunerable, as in don't take damage from anything. The units are a hero, and a group of knights that he summons. So dynamic. |
| 08-12-2006, 06:24 PM | #4 |
You could give them divine armor? |
| 08-12-2006, 06:55 PM | #5 |
So from how I understood it, the summoned units are the only ones that can damage him. Fine, if you don't want to change the classifications, then you need trigger work. JASS:function Trig_Save_Hero_Conditions takes nothing returns boolean return not (GetUnitTypeId(GetEventDamageSource())=='XXXX') //'XXXX' is the id of your summoned units endfunction function Trig_Save_Hero_Actions takes nothing returns nothing call SetUnitState(YOUR_HERO,UNIT_STATE_LIFE,GetUnitState(YOUR_HERO,UNIT_STATE_LIFE)+GetEventDamage()) endfunction //=========================================================================== function InitTrig_Save_Hero takes nothing returns nothing set gg_trg_Save_Hero = CreateTrigger( ) // Have the hero as preplaced and put in here (YOUR_HERO) call TriggerRegisterUnitEvent( gg_trg_Save_Hero, YOUR_HERO, EVENT_UNIT_DAMAGED ) call TriggerAddCondition( gg_trg_Save_Hero, Condition( function Trig_Save_Hero_Conditions ) ) call TriggerAddAction( gg_trg_Save_Hero, function Trig_Save_Hero_Actions ) endfunction |
| 08-12-2006, 07:38 PM | #6 |
that won't work if it the unit has max hp lower than the event's damage |
| 08-12-2006, 08:18 PM | #7 |
Yes, it won't. So either the Hero is utter weak, or the damage by one attack/one nuke is utter high. |
| 08-12-2006, 09:30 PM | #8 |
Again, you could just give them divine, or if you want something other than chaos to effect it, a modified armor that only takes damage from a certain type of attack. |
| 08-12-2006, 09:46 PM | #9 |
This need complex damage restoration. EventDamage starts BEFORE unit is damaged it will not heal units at full heal. If unit's health cannot be restored by this register other event, "state change". And when state changes restore hp. If damage more then max health add bonus HP skill and then remove after unit is damaged. This will save units from any damage. |
| 08-12-2006, 10:15 PM | #10 |
Guess I have to use damage restoraton then. Thanks anyway. |
| 08-12-2006, 10:54 PM | #11 |
This function will allow you to block damage on the EVENT_UNIT_DAMAGED, it handles all issues with damage blocking. |
| 08-12-2006, 10:55 PM | #12 | |
Quote:
|
| 08-12-2006, 10:56 PM | #13 |
Why dont you check before saying anything? Really it does, I made a system and a function for it and I can tell you this is true. EDIT: The game is 'about' to damage the unit, it activates this event first and then damages the unit with the damage it specified. |
| 08-13-2006, 12:17 AM | #14 |
Removing units on event damage may cause crush cause you damage no unit. Same with damage it will loop trigger on self |
| 08-13-2006, 09:57 AM | #15 | |
Quote:
Well, if you are that sure, then be it. |
