HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Sleep & DMG

07-13-2007, 07:24 PM#1
Deathlust
Okay...

Is there a way to DAMAGE a sleeping unit (Where the damage can kill the unit and give credit/exp to the caster) without waking it up?
07-13-2007, 07:30 PM#2
Pyrogasm
Trigger:
Unit - Cause YourUnit to damage YourSleepingUnit dealing 100.00 damage of attack type Chaos and damage type Universal
Might work. You could try the "damage area" function centered on the unit.

If you can figure out how to imitate sleep, as I posted a thread about earlier, it would easily be possible.
07-13-2007, 07:40 PM#3
Rising_Dusk
I realize this isn't quite damage, but consider the following:

Collapse JASS:
if TheDamageAmount >= SleepingUnitsCurrentLife then
    //Deal damage directly to the target for kill credit
    call UnitDamageTarget(SourceUnit, SleepingUnit, TheDamageAmount, false, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, null)
else
    //Reduce their life instead of damage to not break sleep
    call SetUnitState(SleepingUnit, UNIT_STATE_LIFE, SleepingUnitsCurrentLife - TheDamageAmount)
endif
I just wrote it in jass to make it easy to understand.
That could just as easily be done in GUI, and should work perfectly for your purposes.
07-13-2007, 07:42 PM#4
DioD
sleep is actually order.

monitor every order units recieve, it have only ID.

damage and then order unit to sleep.
i wont "wake up"

Quote:
Rising_Dusk
heh damage can be resisted by armor or its type.
soo only normal-divine damage can be passed to function.
07-13-2007, 07:46 PM#5
Daxtreme
Order a unit to cast the Necromancer spell, Unholy Frenzy, with no attack speed bonus.

The unit will "lose" life every second, and it won't wake up.
07-13-2007, 07:48 PM#6
Rising_Dusk
Quote:
heh damage can be resisted by armor or its type.
You could simulate that calculation for any damage type if you really wanted.
Though I imagine your method might work better.
07-13-2007, 10:49 PM#7
DioD
better or not, damage can be resisted its fact.
07-13-2007, 10:51 PM#8
Deathlust
Is there a way to make that if/then/else mui in gui?
07-14-2007, 12:15 AM#9
Pyrogasm
Rather simply, it is MUI already.
Trigger:
Set SleepingDamage = 120.00
----- Or whatever you want it to be set to, this is the amount of damage -----
Set CurrentLife = (Current life of (TheUnitYouWantToDamage)
Collapse If (All conditions are true) then do (then actions) else do (else actions)
Collapse If - Conditions
(SleepingDamage greater than or equal to CurrentLife
Collapse Then - Actions
Unit - Cause TheDamager to damage TheUnitYouWantToDamage dealing SleepingDamage damage of attack type Chaos and damage type Universal
Collapse Else - Actions
Unit - Set TheUnitYouWantToDamage current life to (CurrentLife - SleepingDamage)
07-14-2007, 03:08 AM#10
Deathlust
I'm confused... the tutorial in the GUI section says not to use if/then/else w/ array variables...

Edit ~ Two more things...

- The damage changes per level (15/20/25)... I suppose this makes it a little more complicated than the static damage that Pyrogasm uses.

- I'll have to use a periodic timer for the damage?
07-14-2007, 07:04 AM#11
Pyrogasm
What tutorial? That makes absolutely no sense.

If you want the damage to differ, simply change the damage amount:
Trigger:
Set SleepDamage = (10.00 + (5.00 x (Real(Level of (THEABILITY) for (Triggering Unit)))))
07-14-2007, 07:32 AM#12
Deathlust
This tutorial...

1. Your way of damaging only occurs once... I already asked if I'm going to need a periodic timer or something for that... Any responses at least?

2. Your variables seem rather pointless... Couldn't I just do the calculations w/o them? (SleepingDamage & CurrentLife).

3. This is going to be MUI with arrays, so if I have to use a periodic timer how will I pull up the which unit belongs to which for the correct damage? (Assuming the players will not all stay on the same level of the ability.)
07-14-2007, 07:47 AM#13
Pyrogasm
Quote:
Originally Posted by Darkwulfv
IMPORTANT NOTE: Do not use locals with If/Then/Else statements, or anything that makes a new function.
Locals are different than arrays.

Yes, you could do it without the variables; they're just useful when you're explaining something to somebody and don't want to type "TheDamageYouWantToDeal" a billion times.

Where have you said that you needed to do this periodically? And you won't need to use arrays for this, as the actions have no waits in them. Can you please explain why you need this to happen periodically?
07-14-2007, 06:26 PM#14
Deathlust
Problem solved... used the reduction method with a lot of if/then/else & actions.