Native Vs. Bj

jhnam95

Active Member
Reaction score
12
I'm sorry if this thread doesn't belong in this section. I'm not quite familiar with this territory. :p

Can anyone explain to me why natives are more preferred than Bj's? I've read quite a few guides on JASS and none of them really gave a decent explanation on why natives would be preferred over Bj's.

Also, do the two functions have a distinct difference? (I'm not even sure if I used the second one correctly.)
JASS:
call UnitRemoveAbilityBJ('A000',u)

JASS:
call UnitRemoveAbility(u,'A000')
 

Romek

Super Moderator
Reaction score
964
This is in the correct section.

People prefer natives simply because BJ's are just functions which (usually) call natives anyway. A lot of them simply reverse the parameters because of the GUI system. It's just an extra function call, really. It's less efficient, with no gain whatsoever.
JASS:
function UnitRemoveAbilityBJ takes integer abilityId, unit whichUnit returns boolean
    return UnitRemoveAbility(whichUnit, abilityId)
endfunction
 

Sevion

The DIY Ninja
Reaction score
413
3 day bump o_O'

But some useful information!

Not all BJ's are bad.

I.E. [ljass]TriggerRegisterAnyUnitEventBJ[/ljass]

(Though, Romek does say this... albiet very subtly ["usually"])
 

Tamisrah

Active Member
Reaction score
16
The questions shouldn't be so much about good or bad.
It's just some/most of the bj's do something you can do better with natives.
(there are even some which do nothing except calling the native)
My opinion is: if you know what the bj does and it does what you want it to do, use it.
 

Bribe

vJass errors are legion
Reaction score
67
It's weird that [ljass]BJDebugMsg[/ljass] loops through all players to message them instead of doing a singular, 20x more efficient message to [ljass]GetLocalPlayer()[/ljass]. You notice the performance hit when you need a lot of debug messages per instant.
 

jhnam95

Active Member
Reaction score
12
Yea... I managed to make most of my BJ's to natives using JassCraft <3 but some of them I can't seem to figure out, such as getting AngleBetweenPoints, BJDebugMsg, SetCameraFieldForPlayer, etc. AngleBetweenPoints, I don't think I understand the math (Haven't taken that level math yet). BJDebugMsg and SetCameraFieldForPlayer, I don't understand their "function" forms. Would I have to create a new function for it or something?


EDIT: Actually, I found a tutorial showing examples of a lot of different conversions. http://www.thehelper.net/forums/showthread.php?t=28321
 

Bribe

vJass errors are legion
Reaction score
67
x2-x, y2-y just gets the difference between the two to form the lines needed for the computation of Atan2 ([ljass]AngleBetweenPoints[/ljass]).

The [LJASS]bj_RADTODEG[/LJASS] part of it is because Atan2 returns its value in radians, while BJ's are designed for degrees.
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
Anything prefixed by "bj_" is defined as a global variable in the blizzard.j. They are fine to use. (but certain variables might interfere with some other GUI functions if you set values to them)
 

jhnam95

Active Member
Reaction score
12
You mean prefix :p. And I'm planning on avoiding GUI as much as possible.

So basically, anything that's not in red text in JassCraft or NewGen are ok?


Also, is there a way to acquire an angle between two points using coordinates? I heard that coordinates are preferred over points.
 

Komaqtion

You can change this now in User CP.
Reaction score
469
So basically, anything that's not in red text in JassCraft or NewGen are ok?

Yeah, natives are always better than BJ's, without exceptions ;)
Though, as said, some can still be quite useful :D

Also, is there a way to acquire an angle between two points using coordinates? I heard that coordinates are preferred over points.

Well, why don't you take a look in JassCraft (Or why not use Newgen and TESH ? :S) and see what the function [ljass]AngleBetweenPoints()[/ljass] is made of, and there you'll see that it's actually using coordinates internally :D
 

jhnam95

Active Member
Reaction score
12
[ljass]Atan2(y2-y1, x2-x1)[/ljass]

You're basically inlining it and changing the arguments. The function uses coordinates anyhow.

Oooh... It had some weird names for the coordinates so I couldn't recognize them...


Are there any BJ's that don't have a native form? I know there are natives that can't be accessed using BJ's but what about the opposite?
 

Sevion

The DIY Ninja
Reaction score
413
All BJ's work off of existing code.

No, there are no BJ's that dont' have a native form.
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Though there are some BJ's which use a HUGE amount of other BJ's and stuff, such as the function [ljass]CustomVictoryBJ[/ljass] which internally uses 5 BJ's by itself, and these are quite heavy ones ;)
 

jhnam95

Active Member
Reaction score
12
Oh wow. That calls BJ's that call more BJ's... Then wouldn't it be easier for the coder to just use that simple BJ function rather than making it 15 lines long, or does that bit of laziness affect the gameplay significantly?
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Well, since this is the Defeat and Victory functions, the game would usually end after those actions anyways, so it wouldn't be a problem ;)
 

jhnam95

Active Member
Reaction score
12
Oh, that's a good point... Didn't think that through... Are there any other BJ's that long?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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 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 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