• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Need Urgent Help :x

Status
Not open for further replies.

_PV

_PV

Level 7
Joined
Aug 28, 2010
Messages
285
Hey guys.
Yeah, so I downloaded JNGP... (jassnewgenpack53) and I absolutely have NO idea how JASS works xD I've looked at the tutorials, and weighed the chance that either I am dyslexic or I am just that clueless ...

There is mention of "BJ's" and "Natives" and stuff and I really don't know what that is :< the tutorials go into such detail of how "You must create this BJ and native and do this script etc." and I really have no idea what to do xD can somebody maybe give me a ref to a tutorial and/or just tell me the basics to JASS? I really want to learn this but I want full understanding. Please help :)

Yeah I am very.very, VERY new to JASS... and kind of experienced with GUI - for those who were planning on posting how "Noob" I am or what ever :pP
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
Yixx but you know, he covers it the way that oo they will for sure understand it, but I dont think he even mentioned difference between BJs and Natives.

the difference between BJ and Native is following:
BJs are custom function made by blizzard which basically calls natives and are used in GUI.
For instance
  • Create 1 footman for Player 1 (Red) at (Centre of (Playable map area)) facing default unit facing
(made from my head)
generates:
JASS:
CreateNUnitsAtLoc( 1, 'hfoo', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
you see the red all over the place? Those are BJs, the thing is that Jass code is a lot slower compared to Native functions(I have a guess why but I dont want to distribute fake information), the CreateNUnitsAtLoc generates:
JASS:
function CreateNUnitsAtLoc takes integer count, integer unitId, player whichPlayer, location loc, real face returns group
    call GroupClear(bj_lastCreatedGroup)
    loop
        set count = count - 1
        exitwhen count < 0
        call CreateUnitAtLocSaveLast(whichPlayer, unitId, loc, face)
        call GroupAddUnit(bj_lastCreatedGroup, bj_lastCreatedUnit)
    endloop
    return bj_lastCreatedGroup
endfunction
additionally, the CreateUnitAtLocSaveLast generates:
JASS:
    if (unitid == 'ugol') then
        set bj_lastCreatedUnit = CreateBlightedGoldmine(id, GetLocationX(loc), GetLocationY(loc), face)
    else
        set bj_lastCreatedUnit = CreateUnitAtLoc(id, unitid, loc, face)
    endif

    return bj_lastCreatedUnit

and all this can be changed to basic(lets have a custom function for this):
JASS:
function MyFunction takes nothing returns nothing
    local unit u = CreateUnit(Player(0), 'hfoo', SomeX, SomeY, SomeRealFacing)
    set u = null //prevent handle id leaks
endfunction
note: Player x in GUI is Player x-1 in Jass, for instance Player 1 (Red) in GUI is Player(0)
as you see, its shorter quite a bit and it is also like hella faster, you can learn Jass by creating GUI trigger converting it to custom text and then rewriting all BJs(Red things) to Natives(Purple Things).
JNGP makes this a lot easier as you see which functions are not BJs and which are and also if you hold CTRL and click the function name it will display what it takes, returns and additionally if it is BJ it will also write what all it does

Hope this is helpful for start
 
  • Like
Reactions: _PV
Level 17
Joined
Jul 17, 2011
Messages
1,863
best way to learn jass is to convert gui triggers and look how they work, then optimizing them to jass. the first things you can do is to remake the conditions inside the triggers

a typical converted gui condition function"

  • Untitled Trigger 019
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • 1 Equal to 0
        • Then - Actions
        • Else - Actions
Becomes

JASS:
function Trig_Untitled_Trigger_019_Func001C takes nothing returns boolean
    if ( not ( 1 == 0 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Untitled_Trigger_019_Actions takes nothing returns nothing
    if ( Trig_Untitled_Trigger_019_Func001C() ) then
    else
    endif
endfunction

and how this looks in jass

JASS:
function asdf takes nothing returns nothing 
if 1 == 0 then
endif 
endfunction

yes thats right you reduce all of that to 2 lines
 
  • Like
Reactions: _PV
Status
Not open for further replies.
Top