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.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • 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 Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top