• 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] Very very very strange error

Status
Not open for further replies.
Level 12
Joined
Mar 23, 2008
Messages
942
That is what happen: (See attachs)

That is the code:

JASS:
scope UnlimitedBladeWorks initializer Init_UBW

globals
    private player tempplayer
    private group tempgroup
    private boolexpr EnumFilter
    private string array messages[3]
endglobals

private struct UBW
    unit archer
    real xarcher
    real yarcher
    location array pother[12]
    integer count
endstruct

//===========================================================================

private function Trig_UBW_start_Conditions takes nothing returns boolean
    if ( GetSpellAbilityId() == 'A01W' ) then
        return true
    endif
    return false
endfunction

//===========================================================================

private function IsEnemyHero takes nothing returns boolean
    return (((IsUnitEnemy(GetFilterUnit(), tempplayer)) and (IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO)) and (IsUnitIllusion(GetFilterUnit()) == false)) == true)
endfunction

//===========================================================================

private function UBW_ItemPos takes nothing returns nothing
    local real x = -2684.00
    local real y = 5240.00
    call SetItemPosition(GetEnumItem(), x, y)
endfunction

//===========================================================================

private function UBW_battle takes nothing returns nothing
    local UBW u = GetTimerData(GetExpiredTimer())
    local integer ti = 0
    local unit tempunit
    
    // Already end
    call SetUnitPosition(u.archer, u.xarcher, u.yarcher)
    call PanCameraToTimedForPlayer(GetOwningPlayer(u.archer), u.xarcher, u.yarcher, 0)
    set tempgroup = GetUnitsInRectMatching(gg_rct_Unlimited_Blade_Works, null)
    
    loop
        set tempunit = FirstOfGroup(tempgroup)
        exitwhen tempunit == null
        call SetUnitPositionLoc(tempunit, u.pother[GetPlayerId(GetOwningPlayer(tempunit))])
        call PanCameraToTimedLocForPlayer(GetOwningPlayer(tempunit), u.pother[GetPlayerId(GetOwningPlayer(tempunit))], 0)
    endloop
    
    call EnumItemsInRect(gg_rct_Unlimited_Blade_Works, null, function UBW_ItemPos)
    call UnitRemoveAbility(u.archer, 'A021')
    call UnitRemoveAbility(u.archer, 'B009')
    call UnitRemoveAbility(u.archer, 'A01X')
    call UnitRemoveAbility(u.archer, 'A01H')
    call UnitRemoveAbility(u.archer, 'A01Z')
    call DisableTrigger( gg_trg_UBW_mana_regen )
    
    call ReleaseTimer(GetExpiredTimer())
    call u.destroy()
endfunction

//===========================================================================

private function UBW_Phrases takes nothing returns nothing
    local UBW u = GetTimerData(GetExpiredTimer())
    local timer t
    local real tempx1
    local real tempy1
    local real tempx2
    local real tempy2
    local unit tempunit
    local integer ti
    
    call BJDebugMsg("u.archer is equal to " + GetUnitName(u.archer))
    call BJDebugMsg("u.count is equal to " + (I2S(u.count)))
    
    if (GetWidgetLife(u.archer) > 0.405) then // Checks if alive
            call CreateTextTagUnitBJ( messages[u.count], u.archer, 0, 10, 100, 100, 100, 0 )
            call SetTextTagPermanent( bj_lastCreatedTextTag, false )
            call SetTextTagLifespan( bj_lastCreatedTextTag, 2.50 )            
        if (u.count == 3) then
            set tempx1 = GetUnitX(u.archer)
            set tempy1 = GetUnitY(u.archer)
            call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\Invisibility\\InvisibilityTarget.mdl", tempx1, tempy1))
            set tempplayer = GetOwningPlayer(u.archer)
            call GroupEnumUnitsInRange(tempgroup, tempx1, tempy1, 600, Condition(function IsEnemyHero)) 
            
                call BJDebugMsg("hi1")
                
            set tempx1 = GetRectCenterX(gg_rct_Unlimited_Blade_Works)
            set tempy1 = GetRectCenterY(gg_rct_Unlimited_Blade_Works)
            
            // Prepare to face your enemy
            set u.xarcher = GetUnitX(u.archer)
            set u.yarcher = GetUnitY(u.archer)
            set tempx2 = tempx1 + 250 * Cos(90 * bj_DEGTORAD)
            set tempy2 = tempy1 + 250 * Sin(90 * bj_DEGTORAD)
            call SetUnitPosition(u.archer, tempx2, tempy2)
            call PanCameraToTimedForPlayer( GetOwningPlayer(u.archer), tempx1, tempy1, 0 )
            call UnitAddAbility(u.archer, 'A021')
            call SetUnitAbilityLevel(u.archer, 'A01Y', GetUnitAbilityLevel(u.archer, 'A01W'))
            call SetPlayerAbilityAvailable(GetOwningPlayer(u.archer), 'A021', false)
            call UnitAddAbility(u.archer, 'A01X')
            call SetUnitAbilityLevel(u.archer, 'A01X', GetUnitAbilityLevel(u.archer, 'A01W'))
            call UnitAddAbility(u.archer, 'A01H')
            call SetUnitAbilityLevel(u.archer, 'A01H', GetUnitAbilityLevel(u.archer, 'A01W'))
            call UnitAddAbility(u.archer, 'A01Z')
            call SetUnitAbilityLevel(u.archer, 'A01Z', GetUnitAbilityLevel(u.archer, 'A01W'))
            //call EnableTrigger( gg_trg_UBW_mana_regen )
            
            call BJDebugMsg("hi2")
            
            loop // Time to send enemies to the battle
                set tempunit = FirstOfGroup(tempgroup)
                exitwhen tempunit == null
                set u.pother[GetPlayerId(GetOwningPlayer(tempunit))] = GetUnitLoc(tempunit)
                call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\Invisibility\\InvisibilityTarget.mdl", u.pother[GetPlayerId(GetOwningPlayer(tempunit))]))
                set tempx2 = tempx1 + 250 * Cos(270 * bj_DEGTORAD)
                set tempy2 = tempy1 + 250 * Sin(270 * bj_DEGTORAD)
                call SetUnitPosition(tempunit, tempx2, tempy2)
                call PanCameraToTimedForPlayer( GetOwningPlayer(tempunit), tempx1, tempy1, 0 )
            endloop
            
                call BJDebugMsg("hi3")
        endif
    endif
    
    set u.count = (u.count + 1)
       
    if (u.count == 4) then
        call BJDebugMsg("Its over")
        call ReleaseTimer(GetExpiredTimer())
        set ti = (( 4 + ( 2 * (GetUnitAbilityLevel(u.archer, 'A01W')))))
        set t = NewTimer()
        call SetTimerData(t,u)
        call TimerStart(t, ti, false, function UBW_battle)
    endif
    
endfunction

//===========================================================================

private function Trig_UBW_start_Actions takes nothing returns nothing
    local item tempitem
    local UBW u = UBW.create()
    local timer t = NewTimer()
    set u.archer = GetTriggerUnit()
    call CreateTextTagUnitBJ( "I am the bone of my sword.|nSteel is my body, and fire is my blood.", u.archer, 0, 10, 100, 100, 100, 0 )
    call SetTextTagPermanent( bj_lastCreatedTextTag, false )
    call SetTextTagLifespan( bj_lastCreatedTextTag, 2.50 )
    set u.count = 0
    call SetTimerData(t,u)
    call TimerStart(t, 2.5, true, function UBW_Phrases)
endfunction

//===========================================================================

private function Init_UBW takes nothing returns nothing
    local trigger UBW_start = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( UBW_start, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( UBW_start, Condition( function Trig_UBW_start_Conditions ) )
    call TriggerAddAction( UBW_start, function Trig_UBW_start_Actions )
    set tempgroup = CreateGroup()
    set EnumFilter = Filter(function IsEnemyHero)
    set messages[0] = "I have created over a thousand blades.|nUnknown to death. Nor known to life."
    set messages[1] = "Have withstood pain to create many weapons.|nYet, those hands will never hold anything."
    set messages[2] = "So as I pray, Unlimited Blade Works."
    set UBW_start = null
endfunction

endscope

I think the problem is between call BJDebugMsg("hi3") and call BJDebugMsg("hi2") since the trigger keep looping Hi2 and u.count never past over 3.

Thanks for any help!
 

Attachments

  • error15.JPG
    error15.JPG
    145.1 KB · Views: 210
Level 12
Joined
Apr 27, 2008
Messages
1,228
You never remove tempunit from the group ;)
So add:
call GroupRemoveUnit(tempgroup,tempunit)
in the loop after exitwhen tempunit==null
 
Last edited:
Level 12
Joined
Mar 23, 2008
Messages
942
You never remove tempunit from the group ;)
So add:
call GroupRemoveUnit(tempunit)
in the loop after exitwhen tempunit==null
I can't believe you fixed that o.o
I feel more dumb each time I post here xD
Really thanks!

----//----

Solved, if anyone have an idea or optimization feel free to post!

JASS:
scope UnlimitedBladeWorks initializer Init_UBW

globals
    private player tempplayer
    private group tempgroup
    private boolexpr EnumFilter
    private string array messages[3]
endglobals

private struct UBW
    unit archer
    real xarcher
    real yarcher
    location array pother[12]
    integer count
endstruct

//===========================================================================

private function Trig_UBW_start_Conditions takes nothing returns boolean
    if ( GetSpellAbilityId() == 'A01W' ) then
        return true
    endif
    return false
endfunction

//===========================================================================

private function IsEnemyHero takes nothing returns boolean
    return (((IsUnitEnemy(GetFilterUnit(), tempplayer)) and (IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO)) and (IsUnitIllusion(GetFilterUnit()) == false)) == true)
endfunction

//===========================================================================

private function UBW_ItemPos takes nothing returns nothing
    local real x = -2684.00
    local real y = 5240.00
    call SetItemPosition(GetEnumItem(), x, y)
endfunction

//===========================================================================

private function UBW_battle takes nothing returns nothing
    local UBW u = GetTimerData(GetExpiredTimer())
    local integer ti = 0
    local unit tempunit
    
    // Already end
    call SetUnitPosition(u.archer, u.xarcher, u.yarcher)
    call PanCameraToTimedForPlayer(GetOwningPlayer(u.archer), u.xarcher, u.yarcher, 0)
    set tempgroup = GetUnitsInRectMatching(gg_rct_Unlimited_Blade_Works, null)
    
    loop
        set tempunit = FirstOfGroup(tempgroup)
        exitwhen tempunit == null
        call GroupRemoveUnit(tempgroup, tempunit)
        call SetUnitPositionLoc(tempunit, u.pother[GetPlayerId(GetOwningPlayer(tempunit))])
        call PanCameraToTimedLocForPlayer(GetOwningPlayer(tempunit), u.pother[GetPlayerId(GetOwningPlayer(tempunit))], 0)
    endloop
    
    call EnumItemsInRect(gg_rct_Unlimited_Blade_Works, null, function UBW_ItemPos)
    call UnitRemoveAbility(u.archer, 'A021')
    call UnitRemoveAbility(u.archer, 'B009')
    call UnitRemoveAbility(u.archer, 'A01X')
    call UnitRemoveAbility(u.archer, 'A01H')
    call UnitRemoveAbility(u.archer, 'A01Z')
    call DisableTrigger( gg_trg_UBW_mana_regen )
    
    call ReleaseTimer(GetExpiredTimer())
    call u.destroy()
endfunction

//===========================================================================

private function UBW_Phrases takes nothing returns nothing
    local UBW u = GetTimerData(GetExpiredTimer())
    local timer t
    local real tempx1
    local real tempy1
    local real tempx2
    local real tempy2
    local unit tempunit
    local integer ti
    
    call BJDebugMsg("u.archer is equal to " + GetUnitName(u.archer))
    call BJDebugMsg("u.count is equal to " + (I2S(u.count)))
    
    if (GetWidgetLife(u.archer) > 0.405) then // Checks if alive
            call CreateTextTagUnitBJ( messages[u.count], u.archer, 0, 10, 100, 100, 100, 0 )
            call SetTextTagPermanent( bj_lastCreatedTextTag, false )
            call SetTextTagLifespan( bj_lastCreatedTextTag, 2.50 )            
        if (u.count == 3) then
            set tempx1 = GetUnitX(u.archer)
            set tempy1 = GetUnitY(u.archer)
            call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\Invisibility\\InvisibilityTarget.mdl", tempx1, tempy1))
            set tempplayer = GetOwningPlayer(u.archer)
            call GroupEnumUnitsInRange(tempgroup, tempx1, tempy1, 600, Condition(function IsEnemyHero)) 
            
                call BJDebugMsg("hi1")
                
            set tempx1 = GetRectCenterX(gg_rct_Unlimited_Blade_Works)
            set tempy1 = GetRectCenterY(gg_rct_Unlimited_Blade_Works)
            
            // Prepare to face your enemy
            set u.xarcher = GetUnitX(u.archer)
            set u.yarcher = GetUnitY(u.archer)
            set tempx2 = tempx1 + 250 * Cos(90 * bj_DEGTORAD)
            set tempy2 = tempy1 + 250 * Sin(90 * bj_DEGTORAD)
            call SetUnitPosition(u.archer, tempx2, tempy2)
            call PanCameraToTimedForPlayer( GetOwningPlayer(u.archer), tempx1, tempy1, 0 )
            call UnitAddAbility(u.archer, 'A021')
            call SetUnitAbilityLevel(u.archer, 'A01Y', GetUnitAbilityLevel(u.archer, 'A01W'))
            call SetPlayerAbilityAvailable(GetOwningPlayer(u.archer), 'A021', false)
            call UnitAddAbility(u.archer, 'A01X')
            call SetUnitAbilityLevel(u.archer, 'A01X', GetUnitAbilityLevel(u.archer, 'A01W'))
            call UnitAddAbility(u.archer, 'A01H')
            call SetUnitAbilityLevel(u.archer, 'A01H', GetUnitAbilityLevel(u.archer, 'A01W'))
            call UnitAddAbility(u.archer, 'A01Z')
            call SetUnitAbilityLevel(u.archer, 'A01Z', GetUnitAbilityLevel(u.archer, 'A01W'))
            call EnableTrigger( gg_trg_UBW_mana_regen )
            
            call BJDebugMsg("hi2")
            
            loop // Time to send enemies to the battle
                set tempunit = FirstOfGroup(tempgroup)
                exitwhen tempunit == null
                call GroupRemoveUnit(tempgroup, tempunit)
                set u.pother[GetPlayerId(GetOwningPlayer(tempunit))] = GetUnitLoc(tempunit)
                call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\Invisibility\\InvisibilityTarget.mdl", u.pother[GetPlayerId(GetOwningPlayer(tempunit))]))
                set tempx2 = tempx1 + 250 * Cos(270 * bj_DEGTORAD)
                set tempy2 = tempy1 + 250 * Sin(270 * bj_DEGTORAD)
                call SetUnitPosition(tempunit, tempx2, tempy2)
                call PanCameraToTimedForPlayer( GetOwningPlayer(tempunit), tempx1, tempy1, 0 )
            endloop
            
                call BJDebugMsg("hi3")
        endif
    endif
    
    set u.count = (u.count + 1)
       
    if (u.count == 4) then
        call BJDebugMsg("Its over")
        call ReleaseTimer(GetExpiredTimer())
        set ti = (( 4 + ( 2 * (GetUnitAbilityLevel(u.archer, 'A01W')))))
        set t = NewTimer()
        call SetTimerData(t,u)
        call TimerStart(t, ti, false, function UBW_battle)
    endif
    
endfunction

//===========================================================================

private function Trig_UBW_start_Actions takes nothing returns nothing
    local item tempitem
    local UBW u = UBW.create()
    local timer t = NewTimer()
    set u.archer = GetTriggerUnit()
    call CreateTextTagUnitBJ( "I am the bone of my sword.|nSteel is my body, and fire is my blood.", u.archer, 0, 10, 100, 100, 100, 0 )
    call SetTextTagPermanent( bj_lastCreatedTextTag, false )
    call SetTextTagLifespan( bj_lastCreatedTextTag, 2.50 )
    set u.count = 0
    call SetTimerData(t,u)
    call TimerStart(t, 2.5, true, function UBW_Phrases)
endfunction

//===========================================================================

private function Init_UBW takes nothing returns nothing
    local trigger UBW_start = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( UBW_start, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( UBW_start, Condition( function Trig_UBW_start_Conditions ) )
    call TriggerAddAction( UBW_start, function Trig_UBW_start_Actions )
    set tempgroup = CreateGroup()
    set EnumFilter = Filter(function IsEnemyHero)
    set messages[0] = "I have created over a thousand blades.|nUnknown to death. Nor known to life."
    set messages[1] = "Have withstood pain to create many weapons.|nYet, those hands will never hold anything."
    set messages[2] = "So as I pray, Unlimited Blade Works."
    set UBW_start = null
endfunction

endscope
 
Level 11
Joined
Apr 6, 2008
Messages
760
JASS:
private function Trig_UBW_start_Conditions takes nothing returns boolean
    if ( GetSpellAbilityId() == 'A01W' ) then
        return true
    endif
    return false
endfunction

into this


JASS:
private function Trig_UBW_start_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A01W' 
endfunction

also dont use actions

do

JASS:
scope UnlimitedBladeWorks initializer Init_UBW

globals
    private player tempplayer
    private group tempgroup
    private boolexpr EnumFilter
    private string array messages[3]
endglobals

private struct UBW
    unit archer
    real xarcher
    real yarcher
    location array pother[12]
    integer count
endstruct

//===========================================================================
//===========================================================================

private function IsEnemyHero takes nothing returns boolean
    return (((IsUnitEnemy(GetFilterUnit(), tempplayer)) and (IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO)) and (IsUnitIllusion(GetFilterUnit()) == false)) == true)
endfunction

//===========================================================================

private function UBW_ItemPos takes nothing returns nothing
    local real x = -2684.00
    local real y = 5240.00
    call SetItemPosition(GetEnumItem(), x, y)
endfunction

//===========================================================================

private function UBW_battle takes nothing returns nothing
    local UBW u = GetTimerData(GetExpiredTimer())
    local integer ti = 0
    local unit tempunit

    // Already end
    call SetUnitPosition(u.archer, u.xarcher, u.yarcher)
    call PanCameraToTimedForPlayer(GetOwningPlayer(u.archer), u.xarcher, u.yarcher, 0)
    set tempgroup = GetUnitsInRectMatching(gg_rct_Unlimited_Blade_Works, null)

    loop
        set tempunit = FirstOfGroup(tempgroup)
        exitwhen tempunit == null
        call GroupRemoveUnit(tempgroup, tempunit)
        call SetUnitPositionLoc(tempunit, u.pother[GetPlayerId(GetOwningPlayer(tempunit))])
        call PanCameraToTimedLocForPlayer(GetOwningPlayer(tempunit), u.pother[GetPlayerId(GetOwningPlayer(tempunit))], 0)
    endloop

    call EnumItemsInRect(gg_rct_Unlimited_Blade_Works, null, function UBW_ItemPos)
    call UnitRemoveAbility(u.archer, 'A021')
    call UnitRemoveAbility(u.archer, 'B009')
    call UnitRemoveAbility(u.archer, 'A01X')
    call UnitRemoveAbility(u.archer, 'A01H')
    call UnitRemoveAbility(u.archer, 'A01Z')
    call DisableTrigger( gg_trg_UBW_mana_regen )

    call ReleaseTimer(GetExpiredTimer())
    call u.destroy()
endfunction

//===========================================================================

private function UBW_Phrases takes nothing returns nothing
    local UBW u = GetTimerData(GetExpiredTimer())
    local timer t
    local real tempx1
    local real tempy1
    local real tempx2
    local real tempy2
    local unit tempunit
    local integer ti

    call BJDebugMsg("u.archer is equal to " + GetUnitName(u.archer))
    call BJDebugMsg("u.count is equal to " + (I2S(u.count)))

    if (GetWidgetLife(u.archer) > 0.405) then // Checks if alive
            call CreateTextTagUnitBJ( messages[u.count], u.archer, 0, 10, 100, 100, 100, 0 )
            call SetTextTagPermanent( bj_lastCreatedTextTag, false )
            call SetTextTagLifespan( bj_lastCreatedTextTag, 2.50 )
        if (u.count == 3) then
            set tempx1 = GetUnitX(u.archer)
            set tempy1 = GetUnitY(u.archer)
            call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\Invisibility\\InvisibilityTarget.mdl", tempx1, tempy1))
            set tempplayer = GetOwningPlayer(u.archer)
            call GroupEnumUnitsInRange(tempgroup, tempx1, tempy1, 600, Condition(function IsEnemyHero))

                call BJDebugMsg("hi1")

            set tempx1 = GetRectCenterX(gg_rct_Unlimited_Blade_Works)
            set tempy1 = GetRectCenterY(gg_rct_Unlimited_Blade_Works)

            // Prepare to face your enemy
            set u.xarcher = GetUnitX(u.archer)
            set u.yarcher = GetUnitY(u.archer)
            set tempx2 = tempx1 + 250 * Cos(90 * bj_DEGTORAD)
            set tempy2 = tempy1 + 250 * Sin(90 * bj_DEGTORAD)
            call SetUnitPosition(u.archer, tempx2, tempy2)
            call PanCameraToTimedForPlayer( GetOwningPlayer(u.archer), tempx1, tempy1, 0 )
            call UnitAddAbility(u.archer, 'A021')
            call SetUnitAbilityLevel(u.archer, 'A01Y', GetUnitAbilityLevel(u.archer, 'A01W'))
            call SetPlayerAbilityAvailable(GetOwningPlayer(u.archer), 'A021', false)
            call UnitAddAbility(u.archer, 'A01X')
            call SetUnitAbilityLevel(u.archer, 'A01X', GetUnitAbilityLevel(u.archer, 'A01W'))
            call UnitAddAbility(u.archer, 'A01H')
            call SetUnitAbilityLevel(u.archer, 'A01H', GetUnitAbilityLevel(u.archer, 'A01W'))
            call UnitAddAbility(u.archer, 'A01Z')
            call SetUnitAbilityLevel(u.archer, 'A01Z', GetUnitAbilityLevel(u.archer, 'A01W'))
            call EnableTrigger( gg_trg_UBW_mana_regen )

            call BJDebugMsg("hi2")

            loop // Time to send enemies to the battle
                set tempunit = FirstOfGroup(tempgroup)
                exitwhen tempunit == null
                call GroupRemoveUnit(tempgroup, tempunit)
                set u.pother[GetPlayerId(GetOwningPlayer(tempunit))] = GetUnitLoc(tempunit)
                call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\Invisibility\\InvisibilityTarget.mdl", u.pother[GetPlayerId(GetOwningPlayer(tempunit))]))
                set tempx2 = tempx1 + 250 * Cos(270 * bj_DEGTORAD)
                set tempy2 = tempy1 + 250 * Sin(270 * bj_DEGTORAD)
                call SetUnitPosition(tempunit, tempx2, tempy2)
                call PanCameraToTimedForPlayer( GetOwningPlayer(tempunit), tempx1, tempy1, 0 )
            endloop

                call BJDebugMsg("hi3")
        endif
    endif

    set u.count = (u.count + 1)

    if (u.count == 4) then
        call BJDebugMsg("Its over")
        call ReleaseTimer(GetExpiredTimer())
        set ti = (( 4 + ( 2 * (GetUnitAbilityLevel(u.archer, 'A01W')))))
        set t = NewTimer()
        call SetTimerData(t,u)
        call TimerStart(t, ti, false, function UBW_battle)
    endif

endfunction

//===========================================================================

private function Trig_UBW_start_Actions takes nothing returns boolean
    local item tempitem //why is this here? :o
    local UBW u //dont set these to anything else they will get Set too something everytime someone cast a spell
    local timer t
    local texttag Text
    
    if GetSpellAbilityId() == 'A01W' then
        set Text = CreateTextTag()
        set u = UBW.create()
        set timer t = NewTimer()
        set u.archer = GetTriggerUnit()
        // instead is texttag bj shit do this :>
        set Text = CreateTextTag()
        call SetTextTagPosUnit(Text,u.archer,10.)
        call SetTextTagText(Text, "I am the bone of my sword.|nSteel is my body, and fire is my blood.",10.)
        call SetTextTagColor(Text,100,100,100,0)
        call SetTextTagPermanent(Text, false )
        call SetTextTagLifespan(Text, 2.50 )
        call SetTextTagVisibility(Text,true)
        //===========================
        set u.count = 0
        call SetTimerData(t,u)
        call TimerStart(t, 2.5, true, function UBW_Phrases)
        
        set t = null
        set tempitem = null
        set Text = null
    endif

    return false
endfunction

//===========================================================================

private function Init_UBW takes nothing returns nothing
    local trigger UBW_start = CreateTrigger()

    call TriggerRegisterAnyUnitEventBJ( UBW_start, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( UBW_start, Condition( Trig_UBW_start_Actions ) )

    set tempgroup = CreateGroup()
    set EnumFilter = Filter(function IsEnemyHero)
    set messages[0] = "I have created over a thousand blades.|nUnknown to death. Nor known to life."
    set messages[1] = "Have withstood pain to create many weapons.|nYet, those hands will never hold anything."
    set messages[2] = "So as I pray, Unlimited Blade Works."
    set UBW_start = null
endfunction

endscope
 
Last edited:
Level 12
Joined
Mar 23, 2008
Messages
942
I didn't understand, why are you using conditions like actions? and what is YBW.create()?
(The tempitem I have no idea why is there)

Also, I would like to ask, is that MUI? I'm new to Jass and I don't know how private globals works.

Thanks for your help.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
I didn't understand, why are you using conditions like actions? and what is YBW.create()?
(The tempitem I have no idea why is there)

Also, I would like to ask, is that MUI? I'm new to Jass and I don't know how private globals works.

Thanks for your help.

Conditions are faster than actions, but do not support waits.


That( the custom globals and structs and scopes) is vJass, which requires Jass New Gen Pack (or just the Jass Helper).

It is MUI but requires an struct attachment system (like Timer Utilities or something).
 
Level 12
Joined
Mar 23, 2008
Messages
942
Conditions are faster than actions, but do not support waits.


That( the custom globals and structs and scopes) is vJass, which requires Jass New Gen Pack (or just the Jass Helper).

It is MUI but requires an struct attachment system (like Timer Utilities or something).
How can that be MUI? I mean, it uses globals o.o

(Also, that is my spell, I did that way because they told me so, but I can't understand how globals can be mui)
 
Status
Not open for further replies.
Top