lh2705
Just another Helper
- Reaction score
- 111
Hey guys,
I've started doing some Jass spells(not really) since I couldn't do anything else when my internet was down last week.
So, I need some opinions and help.
I made a spellpack and I converted every single GUI trigger to Jass, replaced all the globals with locals and removed the unnecessary if/then/elses(that I know how to) but I still have some doubts.
Have a look at this.
This is one of the simpler ones, let me know if I did anything wrong.
Next,
There at a lot of conditions and I was wondering whether they could be simplified.
Next,
This one is the one that is weird to me,
I don't quite understand, I mean, it works fine but the variables seem very weird.
Inside the group loop, I have to set all the variables again and destroy them and null them, wouldn't that affect the variables that are outside the group loop?
Also, how can I combine one trigger with another one that runs periodically?
I know its using local timers, but how do I use them?
I wanted to combine an effect trigger with the energize trigger but I didn't know how to.
Another question, What is the difference in adding brackets?
like this
and this
And, Why do you need to add the open bracket <space> close bracket after you use GetTriggerUnit, just an example. What do they do?
One last thing, the spells are basically converted GUI and slightly simplified.
I started with that because I had no idea how to start.
Jasscraft is extremely helpful and I only used it, nothing else.
I've started doing some Jass spells(not really) since I couldn't do anything else when my internet was down last week.
So, I need some opinions and help.
I made a spellpack and I converted every single GUI trigger to Jass, replaced all the globals with locals and removed the unnecessary if/then/elses(that I know how to) but I still have some doubts.
Have a look at this.
JASS:
function Trig_Energize_Locals_Conditions takes nothing returns boolean
return GetUnitAbilityLevelSwapped(039;A003039;, GetAttacker()) != 0
endfunction
function Trig_Energize_Locals_Func003C takes nothing returns boolean
return GetRandomInt(1, 100) <= ( 15 + ( 5 * GetUnitAbilityLevelSwapped(039;A003039;, GetAttacker()) ) )
endfunction
function Trig_Energize_Locals_Actions takes nothing returns nothing
local unit Attacker = GetAttacker()
local location AttackerLoc = GetUnitLoc(Attacker)
if ( Trig_Energize_Locals_Func003C() ) then
call CreateNUnitsAtLoc( 1, 039;h002039;, GetOwningPlayer(GetAttacker()), AttackerLoc, bj_UNIT_FACING )
call UnitApplyTimedLifeBJ( 2.00, 039;BTLF039;, GetLastCreatedUnit() )
call UnitAddAbilityBJ( 039;A000039;, GetLastCreatedUnit() )
call SetUnitAbilityLevelSwapped( 039;A000039;, GetLastCreatedUnit(), GetUnitAbilityLevelSwapped(039;A003039;, Attacker) )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "bloodlust", Attacker )
else
endif
call RemoveLocation (AttackerLoc)
set Attacker = null
set AttackerLoc = null
endfunction
//===========================================================================
function InitTrig_Energize_Locals takes nothing returns nothing
set gg_trg_Energize_Locals = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Energize_Locals, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Energize_Locals, Condition( function Trig_Energize_Locals_Conditions ) )
call TriggerAddAction( gg_trg_Energize_Locals, function Trig_Energize_Locals_Actions )
endfunction
This is one of the simpler ones, let me know if I did anything wrong.
Next,
JASS:
function Trig_Lightning_Blast_Locals_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A007039;
endfunction
function Trig_Lightning_Blast_Locals_Func003002003001 takes nothing returns boolean
return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true )
endfunction
function Trig_Lightning_Blast_Locals_Func003002003002 takes nothing returns boolean
return ( IsUnitDeadBJ(GetFilterUnit()) == false )
endfunction
function Trig_Lightning_Blast_Locals_Func003002003 takes nothing returns boolean
return GetBooleanAnd( Trig_Lightning_Blast_Locals_Func003002003001(), Trig_Lightning_Blast_Locals_Func003002003002() )
endfunction
function Trig_Lightning_Blast_Locals_Func004A takes nothing returns nothing
local location TempPoint = GetUnitLoc(GetEnumUnit())
call CreateNUnitsAtLoc( 1, 039;h002039;, GetOwningPlayer(GetTriggerUnit()), TempPoint, bj_UNIT_FACING )
call UnitApplyTimedLifeBJ( 3.00, 039;BTLF039;, GetLastCreatedUnit() )
call UnitAddAbilityBJ( 039;A005039;, GetLastCreatedUnit() )
call SetUnitAbilityLevelSwapped( 039;A005039;, GetLastCreatedUnit(), GetUnitAbilityLevelSwapped(039;A007039;, GetTriggerUnit()) )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "chainlightning", GetEnumUnit() )
call RemoveLocation (TempPoint)
set TempPoint = null
endfunction
function Trig_Lightning_Blast_Locals_Actions takes nothing returns nothing
local unit Caster = GetTriggerUnit()
local location TargetPoint = GetSpellTargetLoc()
local group TargetGroup = GetUnitsInRangeOfLocMatching(( 250.00 + ( 50.00 * I2R(GetUnitAbilityLevelSwapped(039;A007039;, Caster)) ) ), TargetPoint, Condition(function Trig_Lightning_Blast_Locals_Func003002003))
call ForGroupBJ( TargetGroup, function Trig_Lightning_Blast_Locals_Func004A )
call RemoveLocation (TargetPoint)
call DestroyGroup (TargetGroup)
set Caster = null
set TargetPoint = null
set TargetGroup = null
endfunction
//===========================================================================
function InitTrig_Lightning_Blast_Locals takes nothing returns nothing
set gg_trg_Lightning_Blast_Locals = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Lightning_Blast_Locals, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Lightning_Blast_Locals, Condition( function Trig_Lightning_Blast_Locals_Conditions ) )
call TriggerAddAction( gg_trg_Lightning_Blast_Locals, function Trig_Lightning_Blast_Locals_Actions )
endfunction
There at a lot of conditions and I was wondering whether they could be simplified.
Next,
This one is the one that is weird to me,
JASS:
function Trig_Holy_Flare_Locals_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A003039;
endfunction
function Trig_Holy_Flare_Locals_Func011002003001 takes nothing returns boolean
return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true )
endfunction
function Trig_Holy_Flare_Locals_Func011002003002 takes nothing returns boolean
return ( IsUnitDeadBJ(GetFilterUnit()) == false )
endfunction
function Trig_Holy_Flare_Locals_Func011002003 takes nothing returns boolean
return GetBooleanAnd( Trig_Holy_Flare_Locals_Func011002003001(), Trig_Holy_Flare_Locals_Func011002003002() )
endfunction
function Trig_Holy_Flare_Locals_Func012A takes nothing returns nothing
local unit Caster = GetTriggerUnit()
local location TargetPoint = GetSpellTargetLoc()
local location TempPoint
call UnitDamageTargetBJ( Caster, GetEnumUnit(), ( I2R(GetUnitAbilityLevelSwapped(039;A003039;, Caster)) * 100.00 ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
set TempPoint = GetUnitLoc(GetEnumUnit())
call CreateNUnitsAtLocFacingLocBJ( 1, 039;h002039;, GetOwningPlayer(Caster), TargetPoint, TempPoint )
call UnitApplyTimedLifeBJ( 3.00, 039;BTLF039;, GetLastCreatedUnit() )
call UnitAddAbilityBJ( 039;A004039;, GetLastCreatedUnit() )
call SetUnitAbilityLevelSwapped( 039;A004039;, GetLastCreatedUnit(), GetUnitAbilityLevelSwapped(039;A003039;, Caster) )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "soulburn", GetEnumUnit() )
call RemoveLocation (TempPoint)
call RemoveLocation (TargetPoint)
set Caster = null
set TargetPoint = null
set TempPoint = null
endfunction
function Trig_Holy_Flare_Locals_Actions takes nothing returns nothing
local unit Caster = GetTriggerUnit()
local location TargetPoint = GetSpellTargetLoc()
local real TempReal = ( 100.00 + ( 50.00 * I2R(GetUnitAbilityLevelSwapped(039;A003039;, Caster)) ) )
local group TargetGroup
call CreateNUnitsAtLoc( 1, 039;h003039;, GetOwningPlayer(Caster), TargetPoint, bj_UNIT_FACING )
call SetUnitScalePercent( GetLastCreatedUnit(), TempReal, TempReal, TempReal )
call UnitApplyTimedLifeBJ( 1.50, 039;BTLF039;, GetLastCreatedUnit() )
call PolledWait( 0.40 )
call CreateNUnitsAtLoc( 1, 039;h004039;, GetOwningPlayer(Caster), TargetPoint, bj_UNIT_FACING )
call SetUnitScalePercent( GetLastCreatedUnit(), TempReal, TempReal, TempReal )
call UnitApplyTimedLifeBJ( 1.50, 039;BTLF039;, GetLastCreatedUnit() )
set TargetGroup = GetUnitsInRangeOfLocMatching(( 250.00 + ( 50.00 * I2R(GetUnitAbilityLevelSwapped(039;A003039;, Caster)) ) ), TargetPoint, Condition(function Trig_Holy_Flare_Locals_Func011002003))
call ForGroupBJ( TargetGroup, function Trig_Holy_Flare_Locals_Func012A )
call DestroyGroup (TargetGroup)
call RemoveLocation (TargetPoint)
set Caster = null
set TargetPoint = null
set TempReal = 0
set TargetGroup = null
endfunction
//===========================================================================
function InitTrig_Holy_Flare_Locals takes nothing returns nothing
set gg_trg_Holy_Flare_Locals = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Holy_Flare_Locals, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Holy_Flare_Locals, Condition( function Trig_Holy_Flare_Locals_Conditions ) )
call TriggerAddAction( gg_trg_Holy_Flare_Locals, function Trig_Holy_Flare_Locals_Actions )
endfunction
I don't quite understand, I mean, it works fine but the variables seem very weird.
Inside the group loop, I have to set all the variables again and destroy them and null them, wouldn't that affect the variables that are outside the group loop?
Also, how can I combine one trigger with another one that runs periodically?
I know its using local timers, but how do I use them?
I wanted to combine an effect trigger with the energize trigger but I didn't know how to.
Another question, What is the difference in adding brackets?
like this
JASS:
function Trig_Holy_Flare_Locals_Func011002003002 takes nothing returns boolean
return ( IsUnitDeadBJ(GetFilterUnit()) == false )
endfunction
and this
JASS:
function Trig_Holy_Flare_Locals_Func011002003002 takes nothing returns boolean
return IsUnitDeadBJ(GetFilterUnit()) == false
endfunction
And, Why do you need to add the open bracket <space> close bracket after you use GetTriggerUnit, just an example. What do they do?
One last thing, the spells are basically converted GUI and slightly simplified.
I started with that because I had no idea how to start.
Jasscraft is extremely helpful and I only used it, nothing else.