- Joined
- Aug 14, 2006
- Messages
- 7,614
Hey.
I have a system that worked before, but it seems like the newest version of Warcraft III broke it somehow. I would like you to check this system out and fix the possible errors.
The system works excellent, but when saving and loading the game in same chapter the combat kings which have levels from 1 to 10 are always reseted to level 1 when the game is loaded. For example, if Galeoth have level 5 Mana Breaker Combat King, player saves the game and then loads it, he should have that level 5 Mana Breaker, not level 1.
The one who can help will have some rep & credits.
FIRST: ITEM
SECOND: DUMMY SPELL BOOK
THIRD: SPELL ITSELF
I have a system that worked before, but it seems like the newest version of Warcraft III broke it somehow. I would like you to check this system out and fix the possible errors.
The system works excellent, but when saving and loading the game in same chapter the combat kings which have levels from 1 to 10 are always reseted to level 1 when the game is loaded. For example, if Galeoth have level 5 Mana Breaker Combat King, player saves the game and then loads it, he should have that level 5 Mana Breaker, not level 1.
The one who can help will have some rep & credits.
-
Save Data
-
Events
-
Game - The game is about to be saved
-
-
Conditions
-
Actions
-
Game Cache - Create a game cache from TCOCacheTemp_3.w3v
-
Set GameCache = (Last created game cache)
-
Custom script: call StoreHeroSpells ( udg_GameCache, "TCO_Heroes", "TCO_Galeoth", udg_AAAGaleoth )
-
Save GameCache
-
-
-
Load Data
-
Events
-
Game - A saved game is loaded
-
-
Conditions
-
Actions
-
Game Cache - Create a game cache from TCOCacheTemp_3.w3v
-
Set GameCache = (Last created game cache)
-
Custom script: call RestoreHeroSpells ( udg_GameCache, "TCO_Heroes", "TCO_Galeoth", udg_AAAGaleoth )
-
-
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 StoreHeroSpells takes gamecache cache, string missionkey, string key, unit whichunit returns nothing
local integer i = 0
if udg_Spell_System_Active then
//call BJDebugMsg("Storing spells...")
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]))
//call BJDebugMsg("Spell stored: " + I2S(i))
else
call StoreInteger(cache, missionkey, key + "spell" + I2S(i), 0)
endif
set i = i + 1
endloop
endif
call SaveGameCache(cache)
endfunction
function RestoreHeroSpells takes gamecache cache, string missionkey, string key, unit whichunit returns nothing
local integer i = 0
if udg_Spell_System_Active then
//call BJDebugMsg("Loading spells...")
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 UnitAddAbility(whichunit, udg_Spell_System_abil[i])
call SetUnitAbilityLevel(whichunit, udg_Spell_System_spell[i], GetStoredInteger(cache, missionkey, key + "spell" + I2S(i)))
//call BJDebugMsg("Spell loaded: " + I2S(i))
endif
endif
set i = i + 1
endloop
endif
endfunction
function StoreHero takes gamecache cache, string missionkey, string key, unit whichunit returns nothing
call StoreHeroSpells(cache, missionkey, key, whichunit)
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
set bj_lastLoadedUnit = RestoreUnit(cache, missionkey, key, whichplayer, GetLocationX(whichloc), GetLocationY(whichloc), angle)
call UnitAddAbility(bj_lastLoadedUnit, GetSpellBook())
call RestoreHeroSpells(cache, missionkey, key, bj_lastLoadedUnit)
return bj_lastLoadedUnit
endfunction
FIRST: ITEM
SECOND: DUMMY SPELL BOOK
THIRD: SPELL ITSELF
-
-------- ========= COMBAT KINGS ========= --------
-
-------- Counter Attack --------
-
Custom script: call CreateSpell('I656', 'A6AP', 'A6B2')
-
-------- Evasion --------
-
Custom script: call CreateSpell('I654', 'A6AQ', 'A64T')
-
-------- Lucky Strike --------
-
Custom script: call CreateSpell('I653', 'A6AR', 'A64S')
-
-------- Natural Armor --------
-
Custom script: call CreateSpell('I657', 'A6AS', 'A6B3')
-
-------- Stunner --------
-
Custom script: call CreateSpell('I655', 'A6AT', 'A6B1')
-
-------- Blind --------
-
Custom script: call CreateSpell('I6B1', 'A6E4', 'A64M')
-
-------- Disarm --------
-
Custom script: call CreateSpell('I6B3', 'A6AF', 'A6AO')
-
-------- Stunner --------
-
Custom script: call CreateSpell('I655', 'A6AT', 'A6B1')
-
-------- Force Blow --------
-
Custom script: call CreateSpell('I6B6', 'A6E7', 'A64F')
-
-------- Immobility --------
-
Custom script: call CreateSpell('I6B2', 'A6E5', 'A6DZ')
-
-------- Mana Breaker --------
-
Custom script: call CreateSpell('I6B5', 'A6E6', 'A6EV')
-
-------- Mute --------
-
Custom script: call CreateSpell('I6B4', 'A6E8', 'A6E0')
Last edited: