Jass help

Status
Not open for further replies.
Level 1
Joined
Nov 6, 2021
Messages
3
JASS:
function Bk0 takes nothing returns boolean
return np and GetUnitAbilityLevel(GetKillingUnit(),$41303357)>0 and IsUnitEnemy(GetTriggerUnit(),GetOwningPlayer(GetKillingUnit()))
endfunction


Can anyone help me decode this?


I know that this is returning a t/f.

I don't understand the GetUnitAbilityLevel(GetKillingUnit(),$41303357)>0 and IsUnitEnemy(GetTriggerUnit(),GetOwningPlayer(GetKillingUnit()))
 
Last edited by a moderator:

Uncle

Warcraft Moderator
Level 69
Joined
Aug 10, 2018
Messages
7,279
If all of those conditions are True then it returns true. If any of them fail then it returns false.

So it's checking if the ability level of 41303357 (some id for some ability) for the Killing unit is > 0. This is how you determine whether or not a unit has an ability, because if the unit is missing the ability then the Ability level will be equal to 0.

It's also checking if the Dying unit (GetTriggerUnit) belongs to an enemy of the Killing player.

So if the Killing player killed an enemy and the Killing unit has that ability then return true.

np is involved as well but I'd need to see where it's set to tell you more about it.
 
Last edited:
Also note that buffs are checked using "GetUnitAbilityLevel", so it could also be "does unit have buff with id X"?

As you can see in for example Blizzard.j, UnitHasBuffBJ looks like this:
JASS:
function UnitHasBuffBJ takes unit whichUnit, integer buffcode returns boolean
    return (GetUnitAbilityLevel(whichUnit, buffcode) > 0)
endfunction
 
JASS:
[B]GetUnitAbilityLevel(GetKillingUnit(),$41303357)>0[/B]
Is checking if the unit killing another unit has ability or buff, yes (as seen by "KillingUnit"). The number is the "Raw Code" of the ability/buff. This assumes that the event is "A unit dies" or it won't work.
Also, it's really strange to write a number like that there and I have no idea what the $ is doing there. Does it work?

JASS:
[B]IsUnitEnemy(GetTriggerUnit(),GetOwningPlayer(GetKillingUnit()))[/B]
Is checking if triggering unit (dying unit?) is an enemy of the killer.

"Triggering unit" (GetTriggerUnit()) is the most context dependent of all things in warcraft 3 triggering.
If the event is "A unit dies", then I think it is the dying unit.
 
Level 1
Joined
Nov 6, 2021
Messages
3
This is from Dark Deeds Redux 69b. Development has stopped on the map and I am trying to decode the code for the achievements the author put in place. This function has to do with your achievement pet.
 

Wrda

Spell Reviewer
Level 28
Joined
Nov 18, 2012
Messages
1,971
The $ sign here means it's a hexadecimal number. Converting to decimal number this is 1093677911.
Number converter - hex, octal, binary | Coder’s Toolbox
This thing helps you with this.
Basically you copy that number, without the $ sign, paste on "hex" part and there you have it,
CANNED BREAD! THIS TOWN IS GREAT!


Good luck on your journey with that map lol.
 
Status
Not open for further replies.
Top