• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Beginning JASS Tutorial Series

Level 1
Joined
Apr 25, 2007
Messages
2
plz help me... I am with some problems with lesson 2 , i dont know where to write the function( if it is on Custom Script Note or trigger functions), and how can i activate it...:witch_doc_sad:



Thx for your help
 
Level 6
Joined
Mar 17, 2008
Messages
150
I'm still a novice and I'm planning to make a new Role-playing game from scratch from jass so I could learn and be a expert in Jass just like all of you there. I usually use triggers or should you say GUI but I learned the advantages of Jass no memory leaks and etc. It may look hard but I wish I could learn all of it fast. Thanks for the Tutorial! I shall read it everyday.. ^^
 
Level 1
Joined
Apr 15, 2008
Messages
4
im still a noob at triggers..

:thumbs_up: this tutorial is great..

:important: (when you want to start using JASS) make a new trigger at trigger editor then convert the trigger to custom text (allowing you to make JASS CODING SCRIPTS) but the best related program to this tutorial is [WE]'s :fp:JASSCRAFT,,,... the jasscraft can be downloaded from this site... having this kind of program allows you to study the JASS triggers EASIER AND FASTER!..

i hope somehow this post could have helped someone? XD

but guys who are lazy to study JASS... use GUI's instead.. XD am i right? im not sure hehe...
 
Level 9
Joined
Apr 5, 2008
Messages
443
i need help while doing the tutorial which btw is amazing i came across an error in WE when i try to save my trigger WE stops responding and have to CnP my whole code back from JASS craft here is my exact code please tell me whats wrong (i copyed your code almost directly becouse i wanted to avoid errors like this one... it didnt work)

JASS:
function Slash_Condition takes nothing returns boolean

return GetSpellAbilityId() == 'A000' //Compares the ability id of the ability being cast to the ability id of our Slash spell.

endfunction

function Slash_Actions takes nothing returns nothing

local unit caster = GetSpellAbilityUnit() //Create a local variable and set it to the unit that's casting the spell
local location start_position = GetUnitLoc(caster) //Create the local and set it to the caster's position
local group enemies = CreateGroup() //When you create a group in JASS, it's like a trigger. First you need it empty, and then you add stuff to it
local unit temp //Used when looping through the group
local integer count = 5 //This will be the maximum amount of enemies that can be hit
local location temp_loc

call GroupEnumUnitsInRangeOfLoc(enemies, start_position, 500.0, null)

// GroupEnumUnitsInRangeOfLoc takes a group, a location, a radius, and a boolexpr (a condition, kind of) and then gets units within that radius and adds them to our group

loop
set temp = FirstOfGroup(enemies)
exitwhen temp == null or count == 0

if IsUnitEnemy(temp, GetOwningPlayer(caster)) then //If the enemy unit is an enemy of the owner of the caster

set temp_loc = GetUnitLoc(temp) //Set a temporary location variable to the enemy position

call SetUnitPositionLoc(caster, temp_loc) //Move our unit instantly to the enemy's location
local effect blink = AddSpecialEffectLoc("Abilities\\Spells\\NightElf\Blink\\BlinkTarget.mdl", getunitloc (caster))

call UnitDamageTarget(caster, temp, 50, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, null)

//The caster will instantly damage the enemy for 50 damage with an attack type of chaos
//You can ignore the damage type, and the last parameter (weapontype) is just for sound, but we will
//have none for right now

set count = count - 1 //A unit has been hit, so now the units left to hit is reduced by 1
call TriggerSleepAction( 0.30 )

endif

call DestroyEffect(blink)
set blink = null
call GroupRemoveUnit(enemies, temp)
endloop

call SetUnitPositionLoc(caster, start_position) //Move our unit instantly to the location where he started
local effect blink = AddSpecialEffectLoc("Abilities\\Spells\\NightElf\Blink\\BlinkTarget.mdl", getunitloc (caster))


call DestroyEffect(blink)
set blink = null
call RemoveLocation(start_position)
call DestroyGroup(enemies)
set caster = null
set start_position = null
set enemies = null
set temp = null

endfunction


function InitTrig_Slash takes nothing returns nothing
set gg_trg_Slash = CreateTrigger() //Set the global variable that is created for our trigger to a new trigger

call TriggerRegisterAnyUnitEventBJ(gg_trg_Slash, EVENT_PLAYER_UNIT_SPELL_EFFECT) //This BJ function registers an event for whenever a unit starts the effect
//of an ability for our trigger

call TriggerAddCondition(gg_trg_Slash, Condition(function Slash_Condition))
call TriggerAddAction(gg_trg_Slash, function Slash_Actions)
endfunction

oh and for those who dont get this and want more basic learning try a differant tutorial, try logo (a differant more basic programing language, or C++ you no doubt know what this is but for you who dont its the standard programing language among most video games so if you dont understand this try somthing else. it really helps to learn a easyer programing language first.
 
Last edited:
Level 12
Joined
Aug 20, 2007
Messages
866
Uhhh I doubt C++ is easier than this

Uhm, I just took a quite peek at it, I noticed you did not change the rawcode for the spell, that may be a problem (maybe not)

I don't feel like scanning the whole thing, but what I usually do is save it as a regular trigger, and the let the WE compiler get close to the error, and then scan that area until I find all of the problems

I repeat this cycle until my whole script works properly

(You really need JassCraft to do it)
 
Level 9
Joined
Apr 5, 2008
Messages
443
ok maybe C++ isnt easyer but it really helped me learn JASS to know C++ basics and C++ has many more and easyer understandable how to books videos and tutorials so C++ is actually easyer to learn and it will make this tutorial make much more sence especialy if/then/else (A very improtant command in programming VERY important) also when you read this tutorial have JASS craft an WE open experament with your stuff it helps alot also before saving always CnP your new / edited triggers to JASS craft becouse who knows how irationaly WE can act btw get JASS craft its awsome and helps with this tutorial alot. also Herman thanks this will help me alot i've tryed the compiler thing but i will keep looking it over. nice sig lol.

:fp: get JASS Craft here.
 
Level 4
Joined
Jul 20, 2005
Messages
107
Can you some one teach me or make a tutorial or just give me the link of a tutorial on "How to make local to globally?"

I found out that some of the skill i made can't be done without the global.. but if i use the global then the skill won't be MUI anymore
 
Level 11
Joined
Oct 13, 2005
Messages
233
Can you some one teach me or make a tutorial or just give me the link of a tutorial on "How to make local to globally?"

I found out that some of the skill i made can't be done without the global.. but if i use the global then the skill won't be MUI anymore

There is a reason that locals are called locals and globals globals. You simply cannot use a local outside of the function it's defined in. As for globals, they are global. I'd suggest you submit a more specific description of your problem in the JASS forum as you will be more likely to find an answer to your problem there.
 
Level 2
Joined
May 12, 2008
Messages
11
Great tutorial, but I have a problem with my slash script, it just won't work. It compiles fine in both war3 and jasscraft. Only changes I made to the tutorial copy that I can think of is putting in the blink effect, declaring temp_loc as a local variable, declaring gg_trg_Slash as a local variable (I was getting some errors without these). I used ctrl+D and my channel's ID was "A001:ANcl (Slash)", I just put A001 into my code, do I need the whole thing?
Heres my code, thanks in advance!

JASS:
function Slash_Condition takes nothing returns boolean
    return GetSpellAbilityId() == 'A001'
endfunction

function Slash_Actions takes nothing returns nothing

 local unit caster = GetSpellAbilityUnit() //Create a local variable and set it to the unit that's casting the spell
 local location start_position = GetUnitLoc(caster) //Create the local and set it to the caster's position
 local group enemies = CreateGroup() //When you create a group in JASS, it's like a trigger. First you need it empty, and then you add stuff to it
 local unit temp //Used when looping through the group
 local integer count = 5 //This will be the maximum amount of enemies that can be hit
 local location temp_loc
 local effect blinkEffect 
    call GroupEnumUnitsInRangeOfLoc(enemies, start_position, 500.0, null)

// GroupEnumUnitsInRangeOfLoc takes a group, a location, a radius, and a boolexpr (a condition, kind of) and then gets units within that radius and adds them to our group

    loop
        set temp = FirstOfGroup(enemies) //FirstOfGroup returns a unit from a group in no particular order that I know of
        exitwhen temp == null or count == 0
        if IsUnitEnemy(temp, GetOwningPlayer(caster)) then

            set temp_loc = GetUnitLoc(temp)
            call SetUnitPositionLoc(caster, temp_loc)
            set blinkEffect = AddSpecialEffectLoc("Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl", temp_loc)
            call UnitDamageTarget(caster, temp, 50, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, null)
            set count = count - 1
            call RemoveLocation(temp_loc)
            call DestroyEffect(blinkEffect)
            call TriggerSleepAction(.10)
        endif
        
                                            //The loop will stop when temp is null (meaning that there are no more units left in the group) or when we've hit 5 enemies

        call GroupRemoveUnit(enemies, temp) //Removes the unit from the group so that it can't be picked again
    endloop
    call SetUnitPositionLoc(caster, start_position)
    call RemoveLocation(start_position)
    call DestroyGroup(enemies)
set caster = null
set start_position = null
set temp_loc = null
set enemies = null
set temp = null
set blinkEffect = null
                                            //Cleaning up memory leaks will be put here
endfunction

function InitTrig_Slash takes nothing returns nothing
    local trigger gg_trg_Slash = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(gg_trg_Slash, EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition(gg_trg_Slash, Condition(function Slash_Condition))
        call TriggerAddAction(gg_trg_Slash, function Slash_Actions)
    set gg_trg_Slash = null
endfunction
 
Last edited:
Level 12
Joined
Aug 20, 2007
Messages
866
JASS:
local effect blink = AddSpecialEffectLoc("Abilities\\Spells\\NightElf\Blink\\BlinkTarget.mdl", getunitloc (caster))

This is incorrect, and should be

JASS:
local effect blink = AddSpecialEffectLoc("Abilities\\Spells\\NightElf\Blink\\BlinkTarget.mdl", temp_loc)

This is in response to the script submitted more towards the top

With the script more towards the bottom, I really have to comb it over, so it simply does not do anything???

There are only a few possibilities, one you have a conditional that is incorrect, two, you did not assign the appropriate action to the appropriate trigger, three, you flat out destroyed your trigger, or four you registered the trigger event improperly

I will probably not get back to you on what is wrong

EDIT - Try changing your local trigger variable name to just Slash, and remove the last null statement, I don't know if this will have any effect (I doubt it) but you should try it anyway, other than that, I see nothing wrong with your code, it is a matter of what kind of spell your basing it off of, and the spell event, as well as the condition
 
Level 2
Joined
May 12, 2008
Messages
11
Okay I think my problem was the way I was putting it in wc3, I had just stuck the code in custom scripts, but when I made a trigger "Slash" and put it all in there as custom script it worked. Maybe I'm dense and thats what I was supposed to do in the first place.
 
Level 2
Joined
May 12, 2008
Messages
11
I made a few personal edits to this to get better at jass, what my omnislash now does is more like the actual dota spell, it picks random targets around whichever unit it is currently slashing instead of going through a set order. I made it so the spell no longer targets allies or dead units at all, but to do this I had to make some more functions. Is there more simple way of doing these conditions? Can I combine them all to one function and make it easier to add other conditions such as invisible/invulnerable/etc? (To learn how to do some of this I converted GUI into script, so I'm guessing theres a more efficient way). Some other changes in code could be because I made my channel spell untargetable and didn't want him to be stuck in pause and stuff if there were no targets around him at all.

Also, in the DotA spell the hero is able to get off attacks inside the omnislash. What is the best way to execute this? I messed around for a bit trying to get it right but was unable to, I'll try again when I have some more time tomorrow.

And a final question (For now ;)- I am trying to make it so my hero jumps around on different sides of units, but right now he seems to always go at the unit from the exact same angle (From the South East). I put in a random angle generator, but it seems to not be working.

Heres my code (and map)! Thanks in advance, looking forward to the next installment.

JASS:
function Slash_Condition takes nothing returns boolean
    return GetSpellAbilityId() == 'A001'
endfunction

function Trig_enemygroup1 takes nothing returns boolean
    return ( IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(GetTriggerUnit())) == true )
    //checks to see if unit is enemy
endfunction    


function Trig_enemygroup2 takes nothing returns boolean
    return ( IsUnitAliveBJ(GetFilterUnit()) == true )
    //checks to see if unit is alive
endfunction

function Trig_enemygroup takes nothing returns boolean
    if ( not GetBooleanAnd( Trig_enemygroup1(), Trig_enemygroup2()) ) then
        return false
    endif
    return true
    //combines the 2 checks
endfunction


function Slash_Actions takes nothing returns nothing
//Necessary Variables
 local unit caster = GetSpellAbilityUnit() //Create a local variable and set it to the unit that's casting the spell
 local group enemies = CreateGroup() //When you create a group in JASS, it's like a trigger. First you need it empty, and then you add stuff to it
 local unit temp //Used when looping through the group
 local integer count = 5 //This will be the maximum amount of enemies that can be hit
 local location temp_loc
 local effect blinkEffect
 local effect weaponEffect
 local real degrees
 call TriggerSleepAction(1)
 call PauseUnit(caster, true)

 set weaponEffect = AddSpecialEffectTargetUnitBJ("weapon", caster, ("Abilities\\Weapons\\IllidanMissile\\IllidanMissile.mdl"))
 //creates cool effect for when the hero is bouncing around.
    loop
        set degrees = GetRandomReal(0,360)
        //Used later to randomly place hero around target, not really working
        call GroupAddGroup( GetUnitsInRangeOfLocMatching(500, GetUnitLoc(caster), Condition(function Trig_enemygroup)), enemies)        
      // Creates a group out of alive enemies
        set temp = GroupPickRandomUnit(enemies)
     //Grabs a random unit to slash
        exitwhen CountUnitsInGroup(enemies) == 0 or count == 0
     //Instead of checking for a null value just sees if theres no enemies about by counting the group.
        call TriggerSleepAction(.01)
        if IsUnitEnemy(temp, GetOwningPlayer(caster)) then
            set temp_loc = GetUnitLoc(temp)
            call SetUnitPositionLocFacingLocBJ(caster, temp_loc, PolarProjectionBJ(temp_loc, 100, degrees) )
            set blinkEffect = AddSpecialEffectLoc("Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl", temp_loc)
            call SetUnitFacingToFaceUnitTimed(caster, temp, 0)
            call UnitDamageTarget(caster, temp, 50, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, null)
            call SetUnitAnimation(caster, "attack")
    //Like the DotA spell I want to see my hero doing something while blinking around
            call TriggerSleepAction(.27)
    //Is there something I can call to get an exact time value on an animation?
            call ResetUnitAnimation(caster)
    //Not sure if this is necessary or not
            set count = count - 1
            call RemoveLocation(temp_loc)
            call DestroyEffect(blinkEffect)            
        endif  
    //The loop will stop when 5 enemies are hit or no targetable enemies are left.
    endloop
call DestroyGroup(enemies)
call PauseUnit(caster, false)
set caster = null
set temp_loc = null
set enemies = null
set temp = null
set blinkEffect = null
call DestroyEffect(weaponEffect)
set weaponEffect = null
                                            //Die memory leaks! Die!
endfunction

function InitTrig_Slash takes nothing returns nothing
    set gg_trg_Slash = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(gg_trg_Slash, EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition(gg_trg_Slash, Condition(function Slash_Condition))
        call TriggerAddAction(gg_trg_Slash, function Slash_Actions)
endfunction
 

Attachments

  • jasslearning.w3x
    19.5 KB · Views: 90
Level 12
Joined
Aug 20, 2007
Messages
866
I do not want to add anymore than is here on the tutorial, if anybody would like additional help, please do not post it up here, simply PM somebody (me if you'd prefer, but I am extremely lazy)

I can help you, just delete this from the thread, and send me the code via PM, and I think you can send the map as well, although I probably will not need it
 
I can't understand some ting... Might sound noob like:
this jass code:
JASS:
function HelloWorld takes nothing returns nothing
    call BJDebugMsg("Hi, my name is Bob.")
    call BJDebugMsg("I am 2 years old!")
    //And so on, by the way you can add comments to your code like this
    //Basically if you have '//' somewhere on a line, the rest of the line (after the '//') counts as a comment
endfunction
When i make an empty trigger i convert it into custom script and i paste this code. Then i get an error and it does not work..
The error: The trigger must have an initialization function


EDIT: Use Jass NewGen. I fix it that way.
 
Last edited:
Level 1
Joined
Jun 8, 2008
Messages
1
I didn't understand this tutorial at all, which sucks cuz i always wanted to learn JASS and though this would help me a lot.:cry:
 
Level 21
Joined
Dec 9, 2007
Messages
3,096
Wohoo... Same as Mzorgou... I wanted a lot to learn about JASS...
I just... I Can't understand this tutorial!!! Just something about creating functions, creating actions, creating and seting local and global variables...
wyrmlord... Can you make a spell for me?
If yes, ask me!
 
Level 2
Joined
Mar 29, 2008
Messages
15
I would like to learn JASS to make triggers easier for me but,
i got stuck when you did "Edit Away!" in the introduction,
Can you give some examples of what to do?
would be greatly appreciated
 
Level 2
Joined
Jul 4, 2008
Messages
8
this tutorial is nearly impossible for people without some good knowledge on Computer Science. I hated that class, it was so freakin' hard, I ain't about to tire myself out making a map using JASS. My Computer Science class was torture, and learning this will be equally annoying. Play the game to enjoy, not to learn. Learning's for school, AND SCHOOL'S OUT FOR SUMMER!!!
 
Level 12
Joined
Aug 20, 2007
Messages
866
Bah, I hate these tutorials, the guys who write are laazzy, I mean some of are great but for the most part I only learned the stuff I know now through sheer determination

Just keep re-reading these things and after awhile it'll all come together
 
Level 10
Joined
Oct 2, 2005
Messages
398
Code:
function Trig_Frost_Nova_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'ACfn' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Frost_Nova_Actions takes nothing returns nothing
    local unit caster = GetSpellAbilityUnit()
    local unit temptarget = GetSpellTargetUnit()
    local real range = (300.00+(GetUnitAbilityLevel(caster, 'ACfn')*100.00))
    local location temploc = GetUnitLoc(caster)
    local group enemies = CreateGroup()
    local integer unitlimit = (4+(GetUnitAbilityLevel(caster, 'ACfn')*2))
    local real actdmg = 50.00
    call GroupEnumUnitsInRangeOfLoc(enemies, temploc, range, null)
    loop
        set unitlimit = unitlimit - 1
        exitwhen unitlimit == 0 or temptarget == null
        loop
            exitwhen IsUnitEnemy(FirstOfGroup(enemies), GetOwningPlayer(caster)) == true
            if IsUnitAlly(FirstOfGroup(enemies), GetOwningPlayer(caster)) == true then
                call GroupRemoveUnit(enemies, FirstOfGroup(enemies))
                set temptarget = FirstOfGroup(enemies)
            endif
        endloop
        set temploc = GetUnitLoc(temptarget)
        call SetUnitPositionLoc(caster, temploc)
        call UnitDamageTarget(caster, temptarget, actdmg, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_MAGIC, null)       
        call GroupRemoveUnit(enemies,temptarget)
        call TriggerSleepAction(0.2)
        if unitlimit > 0 then
            set temptarget = FirstOfGroup(enemies)
        else
            set caster = null
            set temptarget = null
            set temploc = null
            set enemies = null
        endif        
    endloop
endfunction

//===========================================================================
function InitTrig_Frost_Nova takes nothing returns nothing
    set gg_trg_Frost_Nova = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Frost_Nova, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Frost_Nova, Condition( function Trig_Frost_Nova_Conditions ) )
    call TriggerAddAction( gg_trg_Frost_Nova, function Trig_Frost_Nova_Actions )
endfunction

This didn't work. Please tell me what's wrong...
Thank you.
 
Level 12
Joined
Aug 20, 2007
Messages
866
Chances are you have the wrong object data

You need to be more descriptive when you ask for help, like, it doesn't compile, it doesn't cast, it doesn't damage the correct damage

Saying "it doesn't work, tell me why" is like saying "God, I need your help, I am retarded"

I really didn't look into it, but if it still doesn't work, post your map and I'll take a better look

EDIT - Looked at it again, there are a few things that might cause problems

Starting from the top, you probably don't know what boolexprs are, you should use them when you enumerate groups, I will not explain it to you, you need to look further into it

You created a location at the casters position, and never removed it
That will cause a leak

If there are any effects to be used with your newly enumerated group, the group was enum'ed by your caster, not the target of the spell, so loop through the group will only affect nearby units

I see you nested a loop to remove all allied units, this is normally used with boolexprs, but since you do not know what they are, you should instead put the enemies in a new group, and remove the old group

Then working with the new group, damage all of the enemies

I highly suggest not using nested loops when looping through groups, because it gets very very complicated

Here is how I would go about it...

JASS:
function NoLeak takes nothing returns boolean
    return true
endfunction
//Don't worry about this function, it is a little bug with using 'null' for a
//boolexpr parameter

constant function Nova_RawCode takes nothing returns integer
    return 'ACfn'
endfunction

function Trig_Frost_Nova_Actions takes nothing returns nothing
    local unit caster = GetSpellAbilityUnit()
    local unit temptarget = GetSpellTargetUnit()
    local unit u //An empty variable for looping
    local player own = GetOwningPlayer(caster)
    //It would be very inefficient to constantly get the owning player
    //every time you looped
    local integer level = GetUnitAbilityLeve(caster, Nova_RawCode())
    local real range = 300.00 + level *100.00 //PEMDAS
    local location temploc = GetUnitLoc(temptarget)
    local group g = CreateGroup()
    local group g2 = CreateGroup()
    local integer unitlimit = 4 + level * 2
    local real dmg = 50.00 //Unnecessary, but we will keep it
    call GroupEnumUnitsInRangeOfLoc(g, temploc, range, Condition(function NoLeak))
    loop
      set u = FirstOfGroup(g)
      exitwhen u == null
      call GroupRemoveUnit(g, u)
      if IsUnitEnemy(u, own) then
        call GroupAddUnit(g2, u)
      endif
    endloop
    call DestroyGroup(g)
    set g = null
    //Enums the second group with only enemies
    loop
      set u = FirstOfGroup(g2)
      exitwhen unitlimit == 0 or u == null
      call GroupRemoveUnit(g2,u)
      call UnitDamageTarget(caster, u, dmg, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
      set unitlimit = unitlimit - 1
    endloop
    //Damages 'unitlimit' # of units in 2nd group
    call GroupClear(g2)
    call DestroyGroup(g2)
    set g2 = null
    call RemoveLocation(temploc)
    set temploc = null
    set caster = null
    set temptarget = null
    set u = null
endfunction

I really have no idea what you were trying to do, but here is a fix on what you had that should damage only enemy units in range of the target approx. 50 damage (units have armor, generally)

The WEAPON_TYPE_WHOKNOWS is a constant, I'm not sure what it does, but I believe it has some effect sound, it may be an incorrect name (WEAPON_TYPE_WHO_KNOWS may be the correct one) I don't remember exactly, but you can change it back to null if you need to

If the code looks really confusing to you, just go through it line-by-line, and it should make sense
 
Last edited:
Level 12
Joined
Aug 20, 2007
Messages
866
Search jassnewgenpack on google, download it, install it, and then turn off the WE syntax checker

The jasshelper is a better version that will not cause it to crash when you make an error

I would suggest some vJASS learning too, but it gets to be rather complicated if you don't even know regular JASS
 
Level 1
Joined
Aug 23, 2007
Messages
1
........omg:confused:, i swear I'm mentally f'in handy caped when it comes to this shit. It took me forever on my own to learn Gui and i still haven't completely mastered it, hell some might still consider me noob. Anyway i think this is an amazing tutorial just wish i could understand it..:cry: I need like Jass for dummies or sumthin.:xxd: Iv found that jass probably isn't so hard if ur a fluent typer... or in my case it wold be easy if i could spell worth a shit...:hohum: but 5/5 i can tell u know what ur talking about!! kudos:thumbs_up:
 
Level 12
Joined
Aug 20, 2007
Messages
866
........omg:confused:, i swear I'm mentally f'in handy caped when it comes to this shit. It took me forever on my own to learn Gui and i still haven't completely mastered it, hell some might still consider me noob. Anyway i think this is an amazing tutorial just wish i could understand it..:cry: I need like Jass for dummies or sumthin.:xxd: Iv found that jass probably isn't so hard if ur a fluent typer... or in my case it wold be easy if i could spell worth a shit...:hohum: but 5/5 i can tell u know what ur talking about!! kudos:thumbs_up:

Don't worry too much, thats how it is for all beginnings, as long as you are interested in it, it will come

*Please Mods don't remove my head* - There is a clan-type of site that is really a small one, but it was made by new(b) people, and ment for new(b) people, you can check it out for recent tutorials that are pretty much ground-level (search on google, [zetaboards synthetic corporations] )
 
Level 2
Joined
Aug 8, 2008
Messages
17
This is probabally the most noobish question ever, but what are the spaces between "call" and the start of the line? Everytime i try to re-enable the trigger it says it requires a name..:cry:
 
Level 24
Joined
May 9, 2007
Messages
3,563
Well, I'm finally really starting to learn JASS, I have toyed with the idea for a while, but never got around to it.

So, here I am. I was wondering about the reccomended tools. SO, far JNG and JassCraft are what I have, and wondering if I should get more.

Well, here goes.
 
Level 12
Joined
Aug 20, 2007
Messages
866
Yeah, the JNGP is an awesome tool for when you really get started

For begginning, I recommend JassCraft, it helps you get a deep understanding of handles, leaks, functions, etc.

I don't highly recommend JNGP until you get pretty decent at regular JASS, JNGP in my eyes is just a ridiculously great tool for writing code very fast

EDIT - And vJASS isn't hard to learn, only regular JASS is, if you don't understand things in regular JASS, obviously they won't be clear in vJASS.

Aside from that, I feel those are the only two tools your ever gonna need.

Btw, if you have any questions I could probably help answer them
 
Level 2
Joined
Jan 6, 2008
Messages
25
Please help! I'm having some very aggravating problems when trying to add special effects to the spell.

First, heres my trigger code without the effects:

JASS:
function Slash_Condition takes nothing returns boolean
 return GetSpellAbilityId() == 'A000'
endfunction

function Slash_Actions takes nothing returns nothing
 local unit caster = GetSpellAbilityUnit()
 local location start_position = GetUnitLoc(caster)
 local group enemies = CreateGroup()
 local unit temp
 local integer count = 5
 local location temp_loc
  call GroupEnumUnitsInRangeOfLoc(enemies, start_position, 500.0, null)
  loop
   set temp = FirstOfGroup(enemies)
   exitwhen temp == null or count == 0
   if IsUnitEnemy(temp, GetOwningPlayer(caster)) and IsUnitAliveBJ(temp) then
    set temp_loc = GetUnitLoc(temp)
    call SetUnitPositionLoc(caster, temp_loc)
    call UnitDamageTarget(caster, temp, 50, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, ConvertWeaponType(8))
    set count = count - 1
    call TriggerSleepAction (0.1)
   endif
   call GroupRemoveUnit(enemies,temp)
  endloop
  call SetUnitPositionLoc(caster, start_position)
  call RemoveLocation(start_position)
  call RemoveLocation(temp_loc)
  call DestroyGroup(enemies)
 set temp = null
 set caster = null
 set enemies = null
 set start_position = null
 set temp_loc = null
endfunction


function InitTrig_Slash takes nothing returns nothing
 set gg_trg_Slash = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Slash, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_Slash, Condition(function Slash_Condition))
    call TriggerAddAction(gg_trg_Slash, function Slash_Actions)
endfunction

It works totally fine and everything this way.



I made several attempts to get special effects working, all of which had some kind of error or crashed when I saved. Here is one attempt.

JASS:
function Slash_Actions takes nothing returns nothing
 local unit caster = GetSpellAbilityUnit()
 local location start_position = GetUnitLoc(caster)
 local group enemies = CreateGroup()
 local unit temp
 local integer count = 5
 local location temp_loc
 local effect specialEffect
  call GroupEnumUnitsInRangeOfLoc(enemies, start_position, 500.0, null)
  set specialEffect = AddSpecialEffectLoc("Abilities\\Spells\\NightElf\Blink\\BlinkTarget.mdl", start_position)

That one causes a compile error on the line that has
set specialEffect = AddSpecialEffectLoc("Abilities\\Spells\\NightElf\Blink\\BlinkTarget.mdl", start_position)

The compile error is that it Expected a valid arguement list.



Preferably what I'd like it to do is play a special effect on the Hero when he casts it, and on the temp unit when he smacks it, could someone please tell me how to get these working? >.<
 
Level 10
Joined
Aug 19, 2008
Messages
491
WTF Dude?

WTF Dude? :eekani:
I thought this would be an upload of a nice tutorial for JASS Editing, but I can't get anything to work!
Let me quote you:

Now, I've gone over with you a very basic example of JASS, if you wish to test this function in the World Editor, simply:
-Create a new map
-Go to the trigger editor
-Click on the map icon at the top of the list of triggers
-Paste the code in the custom script section.


So I did: I pressed the "Untitled" map icon on the trigger editor, and pasted the text
JASS:
function HelloWorld takes nothing returns nothing
    call BJDebugMsg("Hi, my name is Bob.")
    call BJDebugMsg("I am 2 years old!")
    //And so on, by the way you can add comments to your code like this
    //Basically if you have '//' somewhere on a line, the rest of the line (after the '//') counts as a comment
endfunction
on the "Custom Script Code:" section. When I start the game, NOTHING HAPPENS.

If I am to move on I have to know how to make a simple trigger.
What am I doing wrong?
 
Level 12
Joined
Aug 20, 2007
Messages
866
Oh dear, ok, cheezeman read through the rest of the tutorial

Sam Panda, you need to have your code totally finished before you save it

The compiler doesn't always check the correct problem, what your missing is an endfunction after your original function declaration.

One common reason the WE crashes, is because a string has not been closed, like this...

JASS:
local string s = "I'm an unclosed string

I'm not sure exactly why the WE crashes, I think its due to a massive clog of data as the compiler tries to put all of the map code and source code into a single string

I really don't know that though

If you'll notice, all of the text after that point of not adding in that closing " has turned blue


Thats kind of what happens in your WE compiler
 
Level 10
Joined
Aug 19, 2008
Messages
491
This tutorial sucks...

This tutorial really sucks...
I can't even make the "simple trigger" to work.
I'm supposed to put the following text inside the map icon (called Untitled) on the "Custom Script Code:"
JASS:
function HelloWorld takes nothing returns nothing
    call BJDebugMsg("Hello World")
endfunction

So I did...
Then I was suposed to create a trigger which went of by pressing Left Key and name it whatever I want. I was going to put the following text there, just as asked:
JASS:
call HelloWorld()

BUT: There was already a text there:
JASS:
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call TriggerRegisterPlayerKeyEventBJ( gg_trg_Untitled_Trigger_001, Player(0), bj_KEYEVENTTYPE_DEPRESS, bj_KEYEVENTKEY_LEFT )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction

And wherever I put it, it said that the trigger was wrong.
If I replaced it the Editor asked for a initzialation text...
If I placed it after the text, it said that it was wrong and would be disabled.



So my finnaly question/sugestion:

Could you post a picture or JASStag which shows
1: You selecting "Untitled" map icon?
2: You selecting the "Untitled Trigger 001" icon?

Oh yes and by the way Herman: I've read the rest and didn't understand a single thing about it, probobly due to that I didn't even make the 1th tutorial to work. Why move on to the next stage, if you are not finished with the first?

BTW I re-uploaded this "complination text" (wrong word, I know) beacuse I didn't find it on the Replies section.
 
Top