Some random questions

Darius34

New Member
Reaction score
30
Here are a few random questions I always wondered about, but never placed into any particular topic.


1) Suppose a unit gets damage under the Unit Takes Damage event, and as soon as that happens, a subsequent action heals the unit by GetEventDamage() via life manipulation. Will this reduce lethal (killing) damage? And are there any disadvantages to this method?

2) Is it possible to check the level of a buff on a unit? There is a bj function called UnitHasBuffBJ; it is supposed to check if a unit has a buff, but what it really does is:

Code:
function UnitHasBuffBJ takes unit whichUnit, integer buffcode returns boolean
    return (GetUnitAbilityLevel(whichUnit, buffcode) > 0)
endfunction
Therefore is is possible to get the exact level? I want to use it for stacking purposes.

3) Is it possible to check the type of damage received from a damage taken event? Such as ATTACK_TYPE_NORMAL, etc. What does the native ConvertDamageType do?

4) How do I use UNIT_TYPE_MELEE_ATTACKER to check for melee/ranged attackers?

5) UnitCountBuffsEx() counts buffs on a unit, is there a way to get and remove a random buff from a unit?


I know attempting to solve these myself would be possible, but my computer crashed and I don't have Warcraft available now, so I can't do anything. Just wanted to know if you guys knew anything, yeah. :D
 

Chocobo

White-Flower
Reaction score
409
1 : If the unit get healed while the unit dies, the unit dies. If the unit get healed before the unit dies (practice it and its imposible), the unit stills alive. If the unit get healed after the unit dies, the unit simply dies. It should simply heal the unit :p

2 : A buff is an ability. So a JASS GetUnitAbilityLevel should work.
:p Wrote quite fast and forget 0 or 1 level.

3 : No.

4 : Not possible unless you register each unit.

5 : Check for each buff, set them in an array variable, and remove one buff randomly via UnitRemoveBuffBJ (or UnitRemoveAbility).
 

Darius34

New Member
Reaction score
30
1 : If the unit get healed while the unit dies, the unit dies. If the unit get healed before the unit dies (practice it and its imposible), the unit stills alive. If the unit get healed after the unit dies, the unit simply dies. It should simply heal the unit
Lol, I didn't get the bottom line there... :D ...Does it heal lethal damage? And if no, how could I? (I wanted it in a shield-type spell)

So if I want an ability to only reduce/manipulate attack damage, should I combine the damage taken event with a Unit is Attacked event? If not how do I approach this?

4 : Not possible unless you register each unit.
Could you elaborate?

2 : A buff is an ability. So a JASS GetUnitAbilityLevel should work.
5 : Check for each buff, set them in an array variable, and remove one buff randomly via UnitRemoveBuffBJ (or UnitRemoveAbility).
Thanks. :)
 

SFilip

Gone but not forgotten
Reaction score
634
> Will this reduce lethal (killing) damage?
From what I know takes damage event triggers right before the unit takes damage...meaning that you heal him before he takes it thus making him survive a lethal blow this way.

> Is it possible to check the level of a buff on a unit?
Nope, technically buffs aren't leveled - they can either be level 1 (unit has a buff) or 0 (doesn't have). You need to create a new buff for every level you want to check.

> What does the native ConvertDamageType do?
Its used for initializing. Every damagetype is actually an integer, ConvertDamageType is used to define which integer that is in common.j.

> I wanted it in a shield-type spell
There is one in the Spell Index, you might wanna check it out.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
1.
Lethal damage is still lethal. But, to die, it would have to be enough damage for an instant kill. As in, more damage than the unit has health, in one hit.

Though it would seem you're going to need to test this :p


2.
Buffs don't have levels.
It's either 0, the buff isn't there, or 1, the buff is there.
 

Darius34

New Member
Reaction score
30
Hmm, all the lethal damage stuff contradicts. I remember looking at the shield spell in the index; at that point there was a 'Does not reduce lethal damage' bug listed. I see it's gone now, but I can't try it; I still don't have WC on my computer. I'll definitely test the shield spell and my own shield when I get the chance.

Anyway, thanks guys. I still have two unanswered questions though, would appreciate it if you could solve them. :D
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
4.
IsUnitType(GetTriggerUnit(), UNIT_TYPE_<whatever>) == true / false

Though I've never used it for anything other than "Hero" and "Structure"...
 

Chocobo

White-Flower
Reaction score
409
4.
IsUnitType(GetTriggerUnit(), UNIT_TYPE_<whatever>) == true / false

Though I've never used it for anything other than "Hero" and "Structure"...

Teh UNIT_TYPE list :

Code:
UNIT_TYPE_ANCIENT=ConvertUnitType(19)
UNIT_TYPE_ATTACKS_FLYING=ConvertUnitType(5)
UNIT_TYPE_ATTACKS_GROUND=ConvertUnitType(6)
UNIT_TYPE_DEAD=ConvertUnitType(1)
UNIT_TYPE_ETHEREAL=ConvertUnitType(25)
UNIT_TYPE_FLYING=ConvertUnitType(3)
UNIT_TYPE_GIANT=ConvertUnitType(9)
UNIT_TYPE_GROUND=ConvertUnitType(4)
UNIT_TYPE_HERO=ConvertUnitType(0)
UNIT_TYPE_MAGIC_IMMUNE=ConvertUnitType(26)
UNIT_TYPE_MECHANICAL=ConvertUnitType(15)
UNIT_TYPE_MELEE_ATTACKER=ConvertUnitType(7)
UNIT_TYPE_PEON=ConvertUnitType(16)
UNIT_TYPE_PLAGUED=ConvertUnitType(12)
UNIT_TYPE_POISONED=ConvertUnitType(21)
UNIT_TYPE_POLYMORPHED=ConvertUnitType(22)
UNIT_TYPE_RANGED_ATTACKER=ConvertUnitType(8)
UNIT_TYPE_RESISTANT=ConvertUnitType(24)
UNIT_TYPE_SAPPER=ConvertUnitType(17)
UNIT_TYPE_SLEEPING=ConvertUnitType(23)
UNIT_TYPE_SNARED=ConvertUnitType(13)
UNIT_TYPE_STRUCTURE=ConvertUnitType(2)
UNIT_TYPE_STUNNED=ConvertUnitType(11)
UNIT_TYPE_SUMMONED=ConvertUnitType(10)
UNIT_TYPE_TAUREN=ConvertUnitType(20)
UNIT_TYPE_TOWNHALL=ConvertUnitType(18)
UNIT_TYPE_UNDEAD=ConvertUnitType(14)

Writing :

Code:
IsUnitType(GetTriggerUnit(), ConvertUnitType(<whatever>)) == true / false

is a bit faster. :p

Chocobo said:
Wrote quite fast and forget 0 or 1 level.
SFilip said:
Nope, technically buffs aren't leveled - they can either be level 1 (unit has a buff) or 0 (doesn't have). You need to create a new buff for every level you want to check.
Acehart said:
It's either 0, the buff isn't there, or 1, the buff is there.

Btw I tryed using hero abilities level 3 and it returned level 3 for buffs.

Should be in that form :

|cf...<buffId,name>|r

Level : <buffId,level%d>

<buffId,tooltip>
 

Darius34

New Member
Reaction score
30
Okay guys, been a long while since, and I almost forgot this thread. So far the only unanswered one is:

3) Is it possible to check the type of damage received from a damage taken event? Such as ATTACK_TYPE_NORMAL, etc.
I was thinking of a way to do this. Say I only want damage from a Unit Attacked event. I'd have a Unit is Attacked event, then inside the event I add Triggering Unit takes damage to another trigger.

However, any damage the triggering unit takes subsequently will be caught by the second trigger's event, so how should I approach this?

Another one is the lethal damage from the shield. I'll test it out and tell you guys the results. Thanks.

EDIT: Tested it, and I'm still unsure if the shield does absorb lethal damage. I cast a 600 damage spell on a unit with 100+ hp left, and a full shield (100 hp also), and it instantly died.

However, the other possibility for this is that the shield does not prevent damage 'spill'. So far, inconclusive.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top