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?
 
There's absolutely no difference internally between a buff and an ability. That's why you use the same function to test for either.
 
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.
 
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?
 
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.
 
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?
 
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?
 
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' :)
 
>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?
 
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.
 
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
 
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.
 
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?
 
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.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      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