DrinkSlurm
Eat Bachelor Chow!
- Reaction score
- 50
Beginner JASSer here.
I'm finally going to make a serious effort to learn JASS and I have a few basic questions:
(I read through most or all of the beginners' JASS tutorials on this site months ago, and I have just reread and/or will reread them each of them again.)
1. I was thinking that a good way for me to practice and learn as I go would be to take one of my old approved GUI spells and convert it into JASS and try to clean it up (get rid of BJs). Is this a good method to learn, overall?
2. I keep seeing these JASS terms mentioned: vJASS, handles, structs, libraries, scopes, etc. I figured I'd learn what each of those things are and how to use them one by one at a later time. Should I be trying to learn any of these things at the same time as learning the fundamentals of JASS?
3. I only have JassCraft at this time. Should I be using anything else at this time? NewGen sounds a bit too advanced for me right now; seems like something I should learn afterwards.
Anyhow, this is what I have so far:
from my first spellpack
I'm just working with the spell called Flame Fury
After cleaning up all "BJs" and "Swappeds" (that I knew how to) this is what I have:
I'm sure there is a lot more that can be done to simplify this, but I don't know how. There must be a way to combine the two triggers into one, right?
Also, when using JassCraft, I get an error for every global variable, even though it works just fine in WE and in game. Am I missing something? How do I declare global variables?
Thanks for any help.
I'm finally going to make a serious effort to learn JASS and I have a few basic questions:
(I read through most or all of the beginners' JASS tutorials on this site months ago, and I have just reread and/or will reread them each of them again.)
1. I was thinking that a good way for me to practice and learn as I go would be to take one of my old approved GUI spells and convert it into JASS and try to clean it up (get rid of BJs). Is this a good method to learn, overall?
2. I keep seeing these JASS terms mentioned: vJASS, handles, structs, libraries, scopes, etc. I figured I'd learn what each of those things are and how to use them one by one at a later time. Should I be trying to learn any of these things at the same time as learning the fundamentals of JASS?
3. I only have JassCraft at this time. Should I be using anything else at this time? NewGen sounds a bit too advanced for me right now; seems like something I should learn afterwards.
Anyhow, this is what I have so far:
from my first spellpack
I'm just working with the spell called Flame Fury
Code:
Flame Fury Cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Flame Fury (Channel)
Actions
Set tempPoint1 = (Position of (Triggering unit))
Unit - Create 1 Dummy Caster for (Owner of (Triggering unit)) at tempPoint1 facing Default building facing degrees
Custom script: call RemoveLocation (udg_tempPoint1)
Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
Unit - Add Slow (for Flame Fury) to (Last created unit)
Unit - Set level of Slow (for Flame Fury) for (Last created unit) to (Level of Flame Fury (Channel) for (Triggering unit))
Unit - Order (Last created unit) to Human Sorceress - Slow (Triggering unit)
Wait 0.10 game-time seconds
Trigger - Turn on Flame Fury Periodic <gen>
Code:
Flame Fury Periodic
Events
Time - Every 0.10 seconds of game time
Conditions
Actions
Set tempGroup = (Units in (Playable map area) matching (((Matching unit) has buff Flame Fury (Caster)) Equal to True))
Unit Group - Pick every unit in tempGroup and do (Actions)
Loop - Actions
Set tempReal1 = (30.00 + (15.00 x (Real((Level of Flame Fury (Channel) for (Picked unit))))))
Set tempPoint1 = (Position of (Picked unit))
Set tempPoint2 = (tempPoint1 offset by 250.00 towards (Facing of (Picked unit)) degrees)
Unit - Create 1 Dummy Caster for (Owner of (Picked unit)) at tempPoint1 facing (Facing of (Picked unit)) degrees
Animation - Change (Last created unit)'s size to (tempReal1%, tempReal1%, tempReal1%) of its original size
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Unit - Set level of Flame Fury (Breath of Fire) for (Last created unit) to (Level of Flame Fury (Channel) for (Picked unit))
Unit - Order (Last created unit) to Neutral Pandaren Brewmaster - Breath Of Fire tempPoint2
Custom script: call RemoveLocation (udg_tempPoint1)
Custom script: call RemoveLocation (udg_tempPoint2)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in tempGroup) Equal to 0
Then - Actions
Trigger - Turn off (This trigger)
Else - Actions
Custom script: call DestroyGroup (udg_tempGroup)
After cleaning up all "BJs" and "Swappeds" (that I knew how to) this is what I have:
JASS:
function Trig_Flame_Fury_Cast_Conditions takes nothing returns boolean
if GetSpellAbilityId() == 039;A003039; then
return true
endif
return false
endfunction
function Trig_Flame_Fury_Cast_Actions takes nothing returns nothing
set udg_tempPoint1 = GetUnitLoc(GetTriggerUnit())
call CreateNUnitsAtLoc( 1, 039;h000039;, GetOwningPlayer(GetTriggerUnit()), udg_tempPoint1, 270 )
call RemoveLocation (udg_tempPoint1)
call UnitApplyTimedLife( GetLastCreatedUnit(), 039;BTLF039;, 2.00 )
call UnitAddAbility( GetLastCreatedUnit(), 039;A009039; )
call SetUnitAbilityLevel( GetLastCreatedUnit(), 039;A009039;, GetUnitAbilityLevel(GetTriggerUnit(), 039;A003039; ) )
call IssueTargetOrder( GetLastCreatedUnit(), "slow", GetTriggerUnit() )
call PolledWait( 0.10 )
call EnableTrigger( gg_trg_Flame_Fury_Periodic )
endfunction
//===========================================================================
function InitTrig_Flame_Fury_Cast takes nothing returns nothing
set gg_trg_Flame_Fury_Cast = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Flame_Fury_Cast, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Flame_Fury_Cast, Condition( function Trig_Flame_Fury_Cast_Conditions ) )
call TriggerAddAction( gg_trg_Flame_Fury_Cast, function Trig_Flame_Fury_Cast_Actions )
endfunction
JASS:
function Trig_Flame_Fury_Periodic_Func001002002 takes nothing returns boolean
return ( UnitHasBuffBJ(GetFilterUnit(), 039;B003039;) == true )
endfunction
function Trig_Flame_Fury_Periodic_Func002A takes nothing returns nothing
set udg_tempPoint1 = GetUnitLoc(GetEnumUnit())
set udg_tempPoint2 = PolarProjectionBJ(udg_tempPoint1, 250.00, GetUnitFacing(GetEnumUnit()))
set udg_tempReal1 = ( 30.00 + ( 15.00 * I2R(GetUnitAbilityLevel(GetEnumUnit(), 039;A003039; )) ) )
call CreateNUnitsAtLoc( 1, 039;h000039;, GetOwningPlayer(GetEnumUnit()), udg_tempPoint1, GetUnitFacing(GetEnumUnit()) )
call SetUnitScalePercent( GetLastCreatedUnit(), udg_tempReal1, udg_tempReal1, udg_tempReal1 )
call UnitApplyTimedLife( GetLastCreatedUnit(), 039;BTLF039;, 1.00 )
call SetUnitAbilityLevel( GetLastCreatedUnit(), 039;A001039;, GetUnitAbilityLevel( GetEnumUnit(), 039;A003039;) )
call IssuePointOrderLoc( GetLastCreatedUnit(), "breathoffire", udg_tempPoint2 )
call RemoveLocation (udg_tempPoint1)
call RemoveLocation (udg_tempPoint2)
endfunction
function Trig_Flame_Fury_Periodic_Actions takes nothing returns nothing
set udg_tempGroup = GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function Trig_Flame_Fury_Periodic_Func001002002))
call ForGroupBJ( udg_tempGroup, function Trig_Flame_Fury_Periodic_Func002A )
if CountUnitsInGroup(udg_tempGroup) == 0 then
call DisableTrigger( GetTriggeringTrigger() )
endif
call DestroyGroup (udg_tempGroup)
endfunction
//===========================================================================
function InitTrig_Flame_Fury_Periodic takes nothing returns nothing
set gg_trg_Flame_Fury_Periodic = CreateTrigger( )
call DisableTrigger( gg_trg_Flame_Fury_Periodic )
call TriggerRegisterTimerEventPeriodic( gg_trg_Flame_Fury_Periodic, 0.10 )
call TriggerAddAction( gg_trg_Flame_Fury_Periodic, function Trig_Flame_Fury_Periodic_Actions )
endfunction
I'm sure there is a lot more that can be done to simplify this, but I don't know how. There must be a way to combine the two triggers into one, right?
Also, when using JassCraft, I get an error for every global variable, even though it works just fine in WE and in game. Am I missing something? How do I declare global variables?
Thanks for any help.