• 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.

[JASS] I need help pls with JASS!

Status
Not open for further replies.
Level 4
Joined
Nov 3, 2004
Messages
79
This Spell is corrupted it doesnt Work that means when i cast the Spell nothing happens

the Corrupted Ability:
JASS:
function Trig_Scorching_Force_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A03Z' ) ) then
        return false
    endif
    return true
endfunction

function FireballHurt takes nothing returns nothing
    local timer FireballFly = GetExpiredTimer()
    local unit caster = GetHandleUnit(  FireballFly, "caster" )
    local integer Damage = GetHandleInt( FireballFly, "Damage" )
    local group FireBalls = CreateGroup()
    local integer Count = 0
    local group FireBallsNoRepeting = CreateGroup()
    local unit FireBallGetUnit
    local location Order
    set FireBalls = GetHandleGroup( FireballFly, "FireBalls" )
    set FireBallsNoRepeting = FireBalls
    
    loop
        set FireBallGetUnit = FirstOfGroup(FireBallsNoRepeting)
        exitwhen Count == 0
        set Order = PolarProjectionBJ(GetUnitLoc(FireBallGetUnit), 4.00, ( GetUnitFacing(FireBallGetUnit) ))
        call SetUnitPositionLoc( FireBallGetUnit, Order)
        call RemoveLocation(Order)
        call GroupRemoveUnitSimple( FireBallGetUnit, FireBallsNoRepeting )
        set FireBallGetUnit = null
        set Count = Count - 1
    endloop
    call GroupClear(FireBallsNoRepeting)
    set caster = null
endfunction

function Trig_Scorching_Force_Actions takes nothing returns nothing
    local unit caster = GetSpellAbilityUnit()
    local real casterfacing
    local timer FireballFly = CreateTimer()
    local integer Damage = ( GetUnitAbilityLevelSwapped('A03Z', caster) * 25 + 75 )
    local group FireBalls = CreateGroup()
    local location CasterLoc = GetUnitLoc(caster)
    local integer I
    local unit FireBall
    call TriggerSleepAction(0.10)
    set casterfacing = GetUnitFacing(caster)
    loop
        exitwhen I == 6
        set FireBall = CreateUnitAtLoc( GetOwningPlayer(caster), 'n016', PolarProjectionBJ(CasterLoc, 100.00, casterfacing + GetRandomReal(90.00, -90.00)), casterfacing + GetRandomReal(90.00, -90.00) )
        call UnitApplyTimedLifeBJ( 4.00, 'BTLF', FireBall )
        call GroupAddUnitSimple( FireBall, FireBalls )
        set FireBall = null
        set I = I + 1
    endloop
    call SetHandleHandle(FireballFly , "caster", caster)
    call SetHandleHandle(FireballFly , "FireBalls", FireBalls)
    call SetHandleInt(FireballFly , "Damage", Damage)
    call RemoveLocation(CasterLoc)
    call TimerStart(FireballFly,0.01,true,function FireballHurt)
    call TriggerSleepAction(4.00)   
    call DestroyTimer(FireballFly)
    call FlushHandleLocals(FireballFly)
    call GroupClear(FireBalls)
    set caster = null
    set casterfacing = 0.00
    set Damage = 0
endfunction

//===========================================================================
function InitTrig_Scorching_Force takes nothing returns nothing
    set gg_trg_Scorching_Force = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Scorching_Force, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Scorching_Force, Condition( function Trig_Scorching_Force_Conditions ) )
    call TriggerAddAction( gg_trg_Scorching_Force, function Trig_Scorching_Force_Actions )
endfunction

Know anyone whats false with this Spell :(
 
Level 8
Joined
Oct 3, 2004
Messages
101
exitwhen Count == 0
and count is 0 at the beginning, means that as soon as it starts the loop, it exits, not even commencing whats in the loop!

also, change this:
JASS:
function Trig_Scorching_Force_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A03Z' ) ) then
        return false
    endif
    return true
endfunction

to this

JASS:
function Trig_Scorching_Force_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A03Z'
endfunction

you are using long name variables, and i know that using short names like i, r, l, etc, is better.
also, you are using BJS, functions that calls natives, you should use just the natives to get a better performance in your spell.
example:

JASS:
GetUnitAbilityLevelSwapped('A03Z', caster)
this just returns the native GetUnitAbilityLevel(unit, integer)
so just use
JASS:
GetUnitAbilityLevel(caster, 'A03Z')
instead.

redscores said:
This Spell is corrupted it doesnt Work that means when i cast the Spell nothing happens

the Corrupted Ability:
JASS:
function Trig_Scorching_Force_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A03Z' ) ) then
        return false
    endif
    return true
endfunction

function FireballHurt takes nothing returns nothing
    local timer FireballFly = GetExpiredTimer()
    local unit caster = GetHandleUnit(  FireballFly, "caster" )
    local integer Damage = GetHandleInt( FireballFly, "Damage" )
    local group FireBalls = CreateGroup()
    local integer Count = 0
    local group FireBallsNoRepeting = CreateGroup()
    local unit FireBallGetUnit
    local location Order
    set FireBalls = GetHandleGroup( FireballFly, "FireBalls" )
    set FireBallsNoRepeting = FireBalls
    
    loop
        set FireBallGetUnit = FirstOfGroup(FireBallsNoRepeting)
        exitwhen Count == 0
        set Order = PolarProjectionBJ(GetUnitLoc(FireBallGetUnit), 4.00, ( GetUnitFacing(FireBallGetUnit) ))
        call SetUnitPositionLoc( FireBallGetUnit, Order)
        call RemoveLocation(Order)
        call GroupRemoveUnitSimple( FireBallGetUnit, FireBallsNoRepeting )
        set FireBallGetUnit = null
        set Count = Count - 1
    endloop
    call GroupClear(FireBallsNoRepeting)
    set caster = null
endfunction

function Trig_Scorching_Force_Actions takes nothing returns nothing
    local unit caster = GetSpellAbilityUnit()
    local real casterfacing
    local timer FireballFly = CreateTimer()
    local integer Damage = ( GetUnitAbilityLevelSwapped('A03Z', caster) * 25 + 75 )
    local group FireBalls = CreateGroup()
    local location CasterLoc = GetUnitLoc(caster)
    local integer I
    local unit FireBall
    call TriggerSleepAction(0.10)
    set casterfacing = GetUnitFacing(caster)
    loop
        exitwhen I == 6
        set FireBall = CreateUnitAtLoc( GetOwningPlayer(caster), 'n016', PolarProjectionBJ(CasterLoc, 100.00, casterfacing + GetRandomReal(90.00, -90.00)), casterfacing + GetRandomReal(90.00, -90.00) )
        call UnitApplyTimedLifeBJ( 4.00, 'BTLF', FireBall )
        call GroupAddUnitSimple( FireBall, FireBalls )
        set FireBall = null
        set I = I + 1
    endloop
    call SetHandleHandle(FireballFly , "caster", caster)
    call SetHandleHandle(FireballFly , "FireBalls", FireBalls)
    call SetHandleInt(FireballFly , "Damage", Damage)
    call RemoveLocation(CasterLoc)
    call TimerStart(FireballFly,0.01,true,function FireballHurt)
    call TriggerSleepAction(4.00)   
    call DestroyTimer(FireballFly)
    call FlushHandleLocals(FireballFly)
    call GroupClear(FireBalls)
    set caster = null
    set casterfacing = 0.00
    set Damage = 0
endfunction

//===========================================================================
function InitTrig_Scorching_Force takes nothing returns nothing
    set gg_trg_Scorching_Force = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Scorching_Force, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Scorching_Force, Condition( function Trig_Scorching_Force_Conditions ) )
    call TriggerAddAction( gg_trg_Scorching_Force, function Trig_Scorching_Force_Actions )
endfunction

Know anyone whats false with this Spell :(
 
Status
Not open for further replies.
Top