• 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] Argh! JASS Problem!

Status
Not open for further replies.
Level 37
Joined
Aug 14, 2006
Messages
7,602
Hi!

As we all know, I'm a noob with JASS and I don't even do any JASS coding, but since Eleandor made this code for me and I haven't contacted to him for days I want to ask your help guys.

The problem is this:
attachment.php


  • Actions
    • -------- === CREATE GAME CACHE === --------
    • Game Cache - Create a game cache from TCOCache_12.w3v
    • Set GameCache = (Last created game cache)
    • -------- === SAVE HEROS === --------
    • Custom script: call StoreHero( udg_GameCache, "TCO_Heroes", "TCO_Phodom", udg_AAAPhodom )
    • Custom script: call StoreHero( udg_GameCache, "TCO_Heroes", "TCO_Fradz", udg_AAAFradz )
    • Custom script: call StoreHero( udg_GameCache, "TCO_Heroes", "TCO_Galeoth", udg_AAAGaleoth )
    • -------- === SAVE SPELLS === --------
    • -------- === PHODOM === --------
    • -------- === Unit Spells === --------
    • Game Cache - Store (Level of Area Attack (P, X, 2, US) for AAAPhodom) as TCO_Area_Attack of TCO_Spells in (Last created game cache)
    • Game Cache - Store (Level of Avatar (P, R, 2, US) for AAAPhodom) as TCO_Avatar of TCO_Spells in (Last created game cache)
    • Game Cache - Store (Level of Warcry (P, R, 2, US) for AAAPhodom) as TCO_Warcry of TCO_Spells in (Last created game cache)
    • -------- === Hero Spells === --------
    • Game Cache - Store (Current research level of Meltdown for Player 1 (Red)) as TCO_Meltdown of TCO_Spells in (Last created game cache)
    • Game Cache - Store (Current research level of Impact Flare for Player 1 (Red)) as TCO_Impact_Flare of TCO_Spells in (Last created game cache)
    • Game Cache - Store (Current research level of Aura Of Fire for Player 1 (Red)) as TCO_Aura_Of_Fire of TCO_Spells in (Last created game cache)
    • Game Cache - Store (Current research level of Fire Attack for Player 1 (Red)) as TCO_Fire_Attack of TCO_Spells in (Last created game cache)
    • Game Cache - Store (Current research level of Flame Explosion for Player 1 (Red)) as TCO_Flame_Explosion of TCO_Spells in (Last created game cache)
    • Game Cache - Store (Current research level of Shield Of Fire for Player 1 (Red)) as TCO_Shield_Of_Fire of TCO_Spells in (Last created game cache)
    • Game Cache - Store (Current research level of Chaotic Rift for Player 1 (Red)) as TCO_Chaotic_Rift of TCO_Spells in (Last created game cache)
    • -------- === FRADZ === --------
    • -------- === Unit Spells === --------
    • Game Cache - Store (Level of Sword Dance (F, E, 2, US) for AAAFradz) as TCO_Sword_Dance of TCO_Spells in (Last created game cache)
    • -------- === Hero Spells === --------
    • Game Cache - Store (Current research level of Thunder for Player 1 (Red)) as TCO_Thunder of TCO_Spells in (Last created game cache)
    • Game Cache - Store (Current research level of Invisible Strike for Player 1 (Red)) as TCO_Invisible_Strike of TCO_Spells in (Last created game cache)
    • Game Cache - Store (Current research level of Lightning Attack for Player 1 (Red)) as TCO_Lightning_Attack of TCO_Spells in (Last created game cache)
    • Game Cache - Store (Current research level of Flash Strike for Player 1 (Red)) as TCO_Flash_Strike of TCO_Spells in (Last created game cache)
    • Game Cache - Store (Current research level of Lightning Storm for Player 1 (Red)) as TCO_Lightning_Storm of TCO_Spells in (Last created game cache)
    • Game Cache - Store (Current research level of Bless Of Lightning for Player 1 (Red)) as TCO_Bless_Of_Lightning of TCO_Spells in (Last created game cache)
    • Game Cache - Store (Current research level of Lightning Orb for Player 1 (Red)) as TCO_Lightning_Orb of TCO_Spells in (Last created game cache)
    • Game Cache - Store (Current research level of Teleport Strike for Player 1 (Red)) as TCO_Teleport_Strike of TCO_Spells in (Last created game cache)
    • Game Cache - Store (Current research level of Hydro Shell for Player 1 (Red)) as TCO_Hydro_Shield of TCO_Spells in (Last created game cache)
    • Game Cache - Store (Current research level of Speedy Boost for Player 1 (Red)) as TCO_Speedy_Boost of TCO_Spells in (Last created game cache)
    • -------- === GALEOTH === --------
    • -------- === Unit Spells === --------
    • Game Cache - Store (Level of Summon Ice Element (G, T, 2, US) for AAAGaleoth) as TCO_Summon_Ice_Element of TCO_Spells in (Last created game cache)
    • -------- === Hero Spells === --------
    • Game Cache - Store (Current research level of Ice Bolt for Player 1 (Red)) as TCO_Ice_Bolt of TCO_Spells in (Last created game cache)
    • Game Cache - Store (Current research level of Frozen for Player 1 (Red)) as TCO_Frozen of TCO_Spells in (Last created game cache)
    • Game Cache - Store (Current research level of Frozen Cannon for Player 1 (Red)) as TCO_Frozen_Cannon of TCO_Spells in (Last created game cache)
    • Game Cache - Store (Current research level of Chain Heal for Player 1 (Red)) as TCO_Chain_Heal of TCO_Spells in (Last created game cache)
    • Game Cache - Store (Current research level of Magic Boost for Player 1 (Red)) as TCO_Magic_Boost of TCO_Spells in (Last created game cache)
    • Game Cache - Store (Current research level of Frozen Paradise for Player 1 (Red)) as TCO_Frozen_Paradise of TCO_Spells in (Last created game cache)
    • -------- === SAVE RESOURCES === --------
    • Game Cache - Store (Player 1 (Red) Current gold) as TCO_Gold of TCO_Resources in (Last created game cache)
    • Game Cache - Store (Player 1 (Red) Current lumber) as TCO_Wood of TCO_Resources in (Last created game cache)
    • -------- === SAVE BOXES === --------
    • Game Cache - Store AAPhodom_Box as TCO_Phodom_Box of TCO_Heroes in (Last created game cache)
    • Game Cache - Store AAFradz_Box as TCO_Fradz_Box of TCO_Heroes in (Last created game cache)
    • Game Cache - Store AAGaleoth_Box as TCO_Galeoth_Box of TCO_Heroes in (Last created game cache)
    • Game Cache - Store AAPhodom_Box2 as TCO_Phodom_Box2 of TCO_Heroes in (Last created game cache)
    • Game Cache - Store AAFradz_Box2 as TCO_Fradz_Box2 of TCO_Heroes in (Last created game cache)
    • Game Cache - Store AAGaleoth_Box2 as TCO_Galeoth_Box2 of TCO_Heroes in (Last created game cache)
    • -------- === SAVE SPELL BOOKS === --------
    • Game Cache - Store Spell_System_Active as SpellSystemActive of Spells in GameCache
    • -------- Save Game Cache --------
    • Game Cache - Save GameCache
    • Wait 2.00 seconds
    • Game - Set the next level to Test Map - The Chosen Ones.w3m
    • Game - Victory Player 1 (Red) (Skip dialogs, Skip scores)

  • Actions
    • -------- === LOAD GAME CACHE === --------
    • Game Cache - Create a game cache from TCOCache_12.w3v
    • Set GameCache = (Last created game cache)
    • -------- === LOAD SPELL BOOK === --------
    • Set Spell_System_Active = (Load SpellSystemActive of Spells from GameCache)
    • -------- === LOAD HERO SPELLS === --------
    • -------- === PHODOM === --------
    • -------- === Hero Spells === --------
    • Player - Set the current research level of Meltdown to (Load TCO_Meltdown of TCO_Spells from (Last created game cache)) for Player 1 (Red)
    • Player - Set the current research level of Impact Flare to (Load TCO_Impact_Flare of TCO_Spells from (Last created game cache)) for Player 1 (Red)
    • Player - Set the current research level of Aura Of Fire to (Load TCO_Aura_Of_Fire of TCO_Spells from (Last created game cache)) for Player 1 (Red)
    • Player - Set the current research level of Fire Attack to (Load TCO_Fire_Attack of TCO_Spells from (Last created game cache)) for Player 1 (Red)
    • Player - Set the current research level of Flame Explosion to (Load TCO_Flame_Explosion of TCO_Spells from (Last created game cache)) for Player 1 (Red)
    • Player - Set the current research level of Shield Of Fire to (Load TCO_Shield_Of_Fire of TCO_Spells from (Last created game cache)) for Player 1 (Red)
    • Player - Set the current research level of Chaotic Rift to (Load TCO_Chaotic_Rift of TCO_Spells from (Last created game cache)) for Player 1 (Red)
    • -------- === FRADZ === --------
    • -------- === Hero Spells === --------
    • Player - Set the current research level of Thunder to (Load TCO_Thunder of TCO_Spells from (Last created game cache)) for Player 1 (Red)
    • Player - Set the current research level of Invisible Strike to (Load TCO_Invisible_Strike of TCO_Spells from (Last created game cache)) for Player 1 (Red)
    • Player - Set the current research level of Lightning Attack to (Load TCO_Lightning_Attack of TCO_Spells from (Last created game cache)) for Player 1 (Red)
    • Player - Set the current research level of Flash Strike to (Load TCO_Flash_Strike of TCO_Spells from (Last created game cache)) for Player 1 (Red)
    • Player - Set the current research level of Lightning Storm to (Load TCO_Lightning_Storm of TCO_Spells from (Last created game cache)) for Player 1 (Red)
    • Player - Set the current research level of Bless Of Lightning to (Load TCO_Bless_Of_Lightning of TCO_Spells from (Last created game cache)) for Player 1 (Red)
    • Player - Set the current research level of Lightning Orb to (Load TCO_Lightning_Orb of TCO_Spells from (Last created game cache)) for Player 1 (Red)
    • Player - Set the current research level of Teleport Strike to (Load TCO_Teleport_Strike of TCO_Spells from (Last created game cache)) for Player 1 (Red)
    • Player - Set the current research level of Hydro Shell to (Load TCO_Hydro_Shield of TCO_Spells from (Last created game cache)) for Player 1 (Red)
    • Player - Set the current research level of Speedy Boost to (Load TCO_Speedy_Boost of TCO_Spells from (Last created game cache)) for Player 1 (Red)
    • -------- === GALEOTH === --------
    • -------- === Hero Spells === --------
    • Player - Set the current research level of Ice Bolt to (Load TCO_Ice_Bolt of TCO_Spells from (Last created game cache)) for Player 1 (Red)
    • Player - Set the current research level of Frozen to (Load TCO_Frozen of TCO_Spells from (Last created game cache)) for Player 1 (Red)
    • Player - Set the current research level of Frozen Cannon to (Load TCO_Frozen_Cannon of TCO_Spells from (Last created game cache)) for Player 1 (Red)
    • Player - Set the current research level of Chain Heal to (Load TCO_Chain_Heal of TCO_Spells from (Last created game cache)) for Player 1 (Red)
    • Player - Set the current research level of Magic Boost to (Load TCO_Magic_Boost of TCO_Spells from (Last created game cache)) for Player 1 (Red)
    • Player - Set the current research level of Frozen Paradise to (Load TCO_Frozen_Paradise of TCO_Spells from (Last created game cache)) for Player 1 (Red)
    • -------- === LOAD HEROES === --------
    • Set TempLoc = (Center of Phodom Load <gen>)
    • Custom script: call LoadHero ( udg_GameCache, "TCO_Heroes", "TCO_Phodom", Player(0), udg_TempLoc, 0.00 )
    • Set AAAPhodom = (Last restored unit)
    • Custom script: call RemoveLocation(udg_TempLoc)
    • Set TempLoc = (Center of Fradz Load <gen>)
    • Custom script: call LoadHero ( udg_GameCache, "TCO_Heroes", "TCO_Fradz", Player(0), udg_TempLoc, 0.00 )
    • Set AAAFradz = (Last restored unit)
    • Custom script: call RemoveLocation(udg_TempLoc)
    • Set TempLoc = (Center of Galeoth Load <gen>)
    • Custom script: call LoadHero ( udg_GameCache, "TCO_Heroes", "TCO_Galeoth", Player(0), udg_TempLoc, 0.00 )
    • Set AAAGaleoth = (Last restored unit)
    • Custom script: call RemoveLocation(udg_TempLoc)
    • -------- === LOAD UNIT SPELLS === --------
    • -------- === PHODOM === --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Load TCO_Area_Attack of TCO_Spells from (Last created game cache)) Not equal to 0
      • Then - Actions
        • Unit - Add Area Attack (P, X, 2, US) to AAAPhodom
        • Unit - Set level of Area Attack (P, X, 2, US) for AAAPhodom to (Load TCO_Area_Attack of TCO_Spells from (Last created game cache))
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Load TCO_Avatar of TCO_Spells from (Last created game cache)) Not equal to 0
          • Then - Actions
            • Unit - Add Avatar (P, R, 2, US) to AAAPhodom
            • Unit - Set level of Avatar (P, R, 2, US) for AAAPhodom to (Load TCO_Avatar of TCO_Spells from (Last created game cache))
          • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Load TCO_Warcry of TCO_Spells from (Last created game cache)) Not equal to 0
              • Then - Actions
                • Unit - Add Warcry (P, R, 2, US) to AAAPhodom
                • Unit - Set level of Warcry (P, R, 2, US) for AAAPhodom to (Load TCO_Warcry of TCO_Spells from (Last created game cache))
              • Else - Actions
    • -------- === FRADZ === --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Load TCO_Sword_Dance of TCO_Spells from (Last created game cache)) Not equal to 0
      • Then - Actions
        • Unit - Add Sword Dance (F, E, 2, US) to AAAFradz
        • Unit - Set level of Sword Dance (F, E, 2, US) for AAAFradz to (Load TCO_Sword_Dance of TCO_Spells from (Last created game cache))
      • Else - Actions
    • -------- === GALEOTH === --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Load TCO_Summon_Ice_Element of TCO_Spells from (Last created game cache)) Not equal to 0
      • Then - Actions
        • Unit - Add Summon Ice Element (G, T, 2, US) to AAAGaleoth
        • Unit - Set level of Summon Ice Element (G, T, 2, US) for AAAGaleoth to (Load TCO_Summon_Ice_Element of TCO_Spells from (Last created game cache))
      • Else - Actions
    • -------- === LOAD RESOURCES === --------
    • Player - Set Player 1 (Red) Current gold to (Load TCO_Gold of TCO_Resources from (Last created game cache))
    • Player - Set Player 1 (Red) Current lumber to (Load TCO_Wood of TCO_Resources from (Last created game cache))
    • -------- === LOAD BOXES === --------
    • Game Cache - Restore TCO_Phodom_Box of TCO_Heroes from (Last created game cache) for Player 1 (Red) at (Center of PhoB1 Load <gen>) facing (Center of (Playable map area))
    • Set AAPhodom_Box = (Last restored unit)
    • Game Cache - Restore TCO_Phodom_Box of TCO_Heroes from (Last created game cache) for Player 1 (Red) at (Center of PhoB2 Load <gen>) facing (Center of (Playable map area))
    • Set AAPhodom_Box2 = (Last restored unit)
    • Game Cache - Restore TCO_Fradz_Box of TCO_Heroes from (Last created game cache) for Player 1 (Red) at (Center of FraB1 Load <gen>) facing (Center of (Playable map area))
    • Set AAFradz_Box = (Last restored unit)
    • Game Cache - Restore TCO_Fradz_Box of TCO_Heroes from (Last created game cache) for Player 1 (Red) at (Center of FraB2 Load <gen>) facing (Center of (Playable map area))
    • Set AAFradz_Box = (Last restored unit)
    • Game Cache - Restore TCO_Galeoth_Box of TCO_Heroes from (Last created game cache) for Player 1 (Red) at (Center of GalB1 Load <gen>) facing (Center of (Playable map area))
    • Set AAGaleoth_Box = (Last restored unit)
    • Game Cache - Restore TCO_Galeoth_Box of TCO_Heroes from (Last created game cache) for Player 1 (Red) at (Center of GalB2 Load <gen>) facing (Center of (Playable map area))
    • Set AAGaleoth_Box = (Last restored unit)
JASS:
function GetSpellBook takes nothing returns integer
    return 'A6AU'
endfunction

function CreateSpell takes integer itemid, integer spellbookid, integer spellid returns nothing
    local integer p = 0
    set udg_Spell_System_last = udg_Spell_System_last + 1
    set udg_Spell_System_item[udg_Spell_System_last] = itemid
    set udg_Spell_System_abil[udg_Spell_System_last] = spellbookid
    set udg_Spell_System_spell[udg_Spell_System_last] = spellid
    loop
        exitwhen p > 12
        call SetPlayerAbilityAvailable(Player(p), udg_Spell_System_abil[udg_Spell_System_last], false)
        set p = p + 1
    endloop
endfunction

function UnitAddSpell takes unit u, integer itemid returns boolean
    local integer i = 0
    set udg_Spell_System_success = false
    loop
        exitwhen i > udg_Spell_System_last
        if (udg_Spell_System_item[i] == itemid) then
            if GetUnitAbilityLevel(u, udg_Spell_System_abil[i]) <= 0 then
                call UnitAddAbility(u, udg_Spell_System_abil[i])
                set udg_Spell_System_success = true
                return true
            else
                call SetUnitAbilityLevel(u, udg_Spell_System_spell[i], GetUnitAbilityLevel(u, udg_Spell_System_spell[i]) + 1)
                set udg_Spell_System_success = true
                return true
            endif
        endif
        set i = i + 1
    endloop
    return false
endfunction

function UnitRemoveSpell takes unit u, integer abilid returns boolean
    local integer i = 0
    loop
        exitwhen i > udg_Spell_System_last
        if udg_Spell_System_spell[i] == abilid then
            if GetUnitAbilityLevel(u, udg_Spell_System_abil[i]) <= 0 then
                return false
            else
                call UnitRemoveAbility(u, udg_Spell_System_abil[i])
                set udg_Spell_System_success = true
                return true
            endif
        endif
        set i = i + 1
    endloop
    return false
endfunction

function StoreHero takes gamecache cache, string missionkey, string key, unit whichunit returns nothing
    local integer i = 0
    if udg_Spell_System_Active then
        loop
            exitwhen i > udg_Spell_System_last
            if GetUnitAbilityLevel(whichunit, udg_Spell_System_abil[i]) > 0 then
                call StoreInteger(cache, missionkey, key + "spell" + I2S(i), GetUnitAbilityLevel(whichunit, udg_Spell_System_spell[i]))
                if not UnitRemoveAbility(whichunit, udg_Spell_System_abil[i]) then
                    call BJDebugMsg("could not remove the ability")
                endif
            else
                call StoreInteger(cache, missionkey, key + "spell" + I2S(i), 0)
            endif
            set i = i + 1
        endloop
    endif
    call UnitRemoveAbility(whichunit, GetSpellBook())
    call TriggerSleepAction(0.0)
    call StoreUnit(cache, missionkey, key, whichunit)
endfunction

function RestoreHero takes gamecache cache, string missionkey, string key, player whichplayer, location whichloc, real angle returns unit
    local integer i = 0
    set bj_lastLoadedUnit = RestoreUnit(cache, missionkey, key, whichplayer, GetLocationX(whichloc), GetLocationY(whichloc), angle)
    call TriggerSleepAction(0.0)
    call UnitAddAbility(bj_lastLoadedUnit, GetSpellBook())
    if udg_Spell_System_Active then
        loop
            exitwhen i > udg_Spell_System_last
            if HaveStoredInteger(cache, missionkey, key + "spell" + I2S(i)) then
                if GetStoredInteger(cache, missionkey, key + "spell" + I2S(i)) > 0 then
                    call UnitAddSpell(bj_lastLoadedUnit, udg_Spell_System_item[i])
                    call SetUnitAbilityLevel(bj_lastLoadedUnit, udg_Spell_System_spell[i], GetStoredInteger(cache, missionkey, key + "spell" + I2S(i)))
                endif
            else
                call BJDebugMsg("Impossible Error")
            endif
            set i = i + 1
        endloop
    endif
    return bj_lastLoadedUnit
endfunction
I really wonder what's wrong and how this can be fixed. I'm already running out of time releasing new version of the campaign. The one who help me will get some REP!

Ohh... this is not even JASS I just figured out... (HAHAHAHAHAHAAA...) Well, this is still too hard, help help! Or wait a sec... it is after all?
 

Attachments

  • ahjajajaj.JPG
    ahjajajaj.JPG
    68.6 KB · Views: 164
Status
Not open for further replies.
Top