how does world editor differ these 2 thigns

W!†A_cRaft

Ultra Cool Member
Reaction score
28
Apparently when you want to get a level of an ability unit has you use a native

JASS:
GetUnitAbilityLevel(unit u, integer ability_rawcode)


but when you want to detect if a unit has a buff you use:

JASS:
UnitHasBuffBJ(unit u, integer buff_rawcode)


and that function does nothing else than call the above mentioned one, but with a comparison to see if it is >0 like this:

JASS:
function UnitHasBuffBJ takes unit whichUnit, integer buffcode returns boolean
    return (GetUnitAbilityLevel(whichUnit, buffcode) > 0)
endfunction



Sooo how does world editor differ am i asking for a buff or a unit with an ability?
only possible answer in my opinion is by the rawcode, but i am not sure that it is it so i am asking?

and also, this means that no buff and abiltiy will ever have the same rawcode, and that we can use abilities (passive or hidden in a spellbook) to act as buffs for checking things with a little jassing? correct?
 

jwallstone

New Member
Reaction score
33
There's absolutely no difference internally between a buff and an ability. That's why you use the same function to test for either.
 

uberfoop

~=Admiral Stukov=~
Reaction score
177
The limitation with buffs though is that, while the buff may recognize what level it is, the Jass function can only return 0 if the buff isn't there or 1 if it is.

and also, this means that no buff and abiltiy will ever have the same rawcode, and that we can use abilities (passive or hidden in a spellbook) to act as buffs for checking things with a little jassing? correct?
Marker abilities? People use those all the time :)
Of course, if you're doing it MUIable, it's probably better to classify units by attaching values to them rather than adding disabled spellbooks, since the former is more versatile.
 

W!†A_cRaft

Ultra Cool Member
Reaction score
28
but if there is no difference between the buff and ability how come does the game not mix lets say this:

i have a hero who has a shadowstrike ability.

i usea trigger to check for if the hero has a buff and the trigger figgures that i have a level of an ability > 0 even when i do not have a buff.

only by rawcode correct? the rawcode of the ability and buff is never the same?
 

uberfoop

~=Admiral Stukov=~
Reaction score
177
I'm not sure how the game responds if you use Newgen to try and force a buff and an ability to use the same rawcode. However, if you're using the automatically generated rawcodes, they will for sure never conflict, since all ability rawcodes have an 'A' prefix and all buff rawcodes have a 'B' prefix.


It for sure wouldn't be an issue though unless you're trying to break it, and even then I'm not sure that the game would let you.
 

W!†A_cRaft

Ultra Cool Member
Reaction score
28
the way i realized it is that the A/B is a hexadecimal coding of the number as a rawcode of the buff, basically making it possible to reach an ability limmit with the rawcodes that begin with an A, thus crossing over to a B, it is a large number yes, but it is still possible, i found it weird that the game has these 2 detections as a same mechanic, it can be exploited can't it?
 

Azlier

Old World Ghost
Reaction score
461
Raw codes are ASCII. They're integers that point to something in the Object Editor. A*** rawcodes are always different from B*** rawcodes. The first letter is usually there to "categorize" different objects while using the same rawcode system.

>it can be exploited can't it?
How?
 

uberfoop

~=Admiral Stukov=~
Reaction score
177
the way i realized it is that the A/B is a hexadecimal coding of the number as a rawcode of the buff, basically making it possible to reach an ability limmit with the rawcodes that begin with an A, thus crossing over to a B, it is a large number yes, but it is still possible, i found it weird that the game has these 2 detections as a same mechanic, it can be exploited can't it?
It's not hex, it's base-256. Even if it were hex, there's no vulnerability as long as the characters used were to stay in the hex 0-F range. You probably noticed that the characters don't stay within the 0-F range of hex and thus assumed there was vulnerability, but you didn't check to make sure that it actually was hex, and not something else. It is something else, though; base 256 using CP850 character values.

Also, if it were hex, we would probably be using 0x<code> notation, not '<code>' notation.


If you want the un-hexidecimalishness of it to be demonstrated, do a [ljass]call BJDebugMsg(I2S('0000'))[/ljass] somewhere.
Be amazed as it doesn't display '0' :)
 

W!†A_cRaft

Ultra Cool Member
Reaction score
28
>it can be exploited can't it?
How?

well if it was to be hex than you could give abilities the buff codes and buffs the ability codes (maybe you can even now) and since the game detects if the code is a buff or an ability code than we could pass abilites as buff and vice verse which is an exploit yes?
 

saw792

Is known to say things. That is all.
Reaction score
280
Just because it starts with 'B...' doesnt mean it's a buff... the game knows this internally, it doesn't base it on the raw code.
 

W!†A_cRaft

Ultra Cool Member
Reaction score
28
if the game uses same function, and functions are same for the game engine and the engine gets the commands that are the same, the only difference is the rawcode given, there is no way that the game know this interrnally because it is the same function with only a difference in the rawcode
 

saw792

Is known to say things. That is all.
Reaction score
280
Except the rawcode is only a pointer to a whole lot of other data about the buff/ability/unit/destructable which does tell the game engine what type of object it is dealing with. Please don't state things as fact when you really have no idea.
 

W!†A_cRaft

Ultra Cool Member
Reaction score
28
Except the rawcode is only a pointer to a whole lot of other data about the buff/ability/unit/destructable which does tell the game engine what type of object it is dealing with. Please don't state things as fact when you really have no idea.

it is a forum, i asked how does game know the difference, people answered i asked specifics people answered, i stated what i thought it was and here you come saying that "pls dotn state thigns as facts when you really have no idea", so basically people should not ask questions on the forum, correct?
 

saw792

Is known to say things. That is all.
Reaction score
280
I told you the answer, you contradicted me without asking a question or clarifying it was only what you thought was true. Had you asked a question or asked for further clarification then I would have been happy to provide it. However, since you don't really express yourself too well the way you said what you 'thought' came across as you stating facts. So what I'm trying to say is try to communicate a bit better, not stop asking questions.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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