HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Hero Save

03-25-2004, 11:29 PM#1
Kelna2
Ok, I know that this is a big one, I know what each trigger does ( to a pretty good extent ), But I don't know how to specify the trigger to fit the hero, or item. Below is the trigger, Thank you for reading.

This is found at http://www.prepatch.com/gmg/readme.htm
along with a simple explanation

function MidStr takes string s, integer l, integer n returns string
if ( n <= 0 ) then
return ""
endif
return SubString( s, l, l + n )
endfunction


function displaytp takes integer i, string s returns nothing
call DisplayTextToPlayer(Player(i), 0, 0, "HS" + s)
endfunction

function StrLen takes string s returns integer
local integer Count = 1
loop
exitwhen SubStringBJ(s, Count, Count) == ""
set Count = Count + 1
endloop
return Count - 1
endfunction

function MakeItem takes string chattext, integer x returns nothing
local string temp
set temp = MidStr(chattext, 7, StrLen(chattext))
call DisplayTextToPlayer(Player(x), 0, 0, temp)
call UnitAddItemByIdSwapped(S2I(temp), udg_Hero_Save_Unit[0] )
endfunction

function Save takes integer x returns nothing
local integer temp
call TriggerSleepAction( 1 )
call ClearTextMessages ()
call displaytp(x,"Active")
call TriggerSleepAction( 1 )
call ClearTextMessages ()
call displaytp(x,"HEROD" + I2S(UnitId(UnitId2String(udg_Hero_Save_Unit_Id[x]))))
call TriggerSleepAction( 1 )
call ClearTextMessages ()
set udg_Hero_Save_Stat_INT[x] = GetHeroStatBJ(bj_HEROSTAT_INT, udg_Hero_Save_Unit[x], false)
call displaytp(x,"HEROI" + I2S(udg_Hero_Save_Stat_INT[x]))
call TriggerSleepAction( 1 )
call ClearTextMessages ()
set udg_Hero_Save_Stat_STR[x] = GetHeroStatBJ(bj_HEROSTAT_STR, udg_Hero_Save_Unit[x], false)
call displaytp(x,"HEROS" + I2S(udg_Hero_Save_Stat_STR[x]))
call TriggerSleepAction( 1 )
call ClearTextMessages ()
set udg_Hero_Save_Stat_AGI[x] = GetHeroStatBJ(bj_HEROSTAT_AGI, udg_Hero_Save_Unit[x], false)
call displaytp(x,"HEROA" + I2S(udg_Hero_Save_Stat_AGI[x]))
call TriggerSleepAction( 1 )
call ClearTextMessages ()
set temp = GetItemTypeId(UnitItemInSlot(udg_Hero_Save_Unit[x], 0))
call displaytp(x,"ITEM1" + I2S(temp))
call TriggerSleepAction( 1 )
call ClearTextMessages ()
set temp = GetItemTypeId(UnitItemInSlot(udg_Hero_Save_Unit[x], 1))
call displaytp(x,"ITEM2" + I2S(temp))
call TriggerSleepAction( 1 )
call ClearTextMessages ()
set temp = GetItemTypeId(UnitItemInSlot(udg_Hero_Save_Unit[x], 2))
call displaytp(x,"ITEM3" + I2S(temp))
call TriggerSleepAction( 1 )
call ClearTextMessages ()
set temp = GetItemTypeId(UnitItemInSlot(udg_Hero_Save_Unit[x], 3))
call displaytp(x,"ITEM4" + I2S(temp))
call TriggerSleepAction( 1 )
call ClearTextMessages ()
set temp = GetItemTypeId(UnitItemInSlot(udg_Hero_Save_Unit[x], 4))
call displaytp(x,"ITEM5" + I2S(temp))
call TriggerSleepAction( 1 )
call ClearTextMessages ()
set temp = GetItemTypeId(UnitItemInSlot(udg_Hero_Save_Unit[x], 5))
call displaytp(x,"ITEM6" + I2S(temp))
call TriggerSleepAction( 1 )
call ClearTextMessages ()
call displaytp(x, "Deactive")
endfunction

//CODE PART 2
//Sample Load
Load P1
Events
Player - Player 1 (Red) types a chat message containing HS as A substring
Conditions
Hero_Save_Check[0] Equal to True
Actions
Custom script: call MakeItem ( GetEventPlayerChatString(), 0 )
If ((Substring((Entered chat string), 3, 6)) Equal to ITEM) then do (If ((Substring((Entered chat string), 7, 7)) Equal to 1) then do (Custom script: call MakeItem ( GetEventPlayerChatString(), 0 )) else do (Do nothing)) else do (Do nothing)
If ((Substring((Entered chat string), 3, 6)) Equal to ITEM) then do (If ((Substring((Entered chat string), 7, 7)) Equal to 2) then do (Custom script: call MakeItem(GetEventPlayerChatString(), 0)) else do (Do nothing)) else do (Do nothing)
If ((Substring((Entered chat string), 3, 6)) Equal to ITEM) then do (If ((Substring((Entered chat string), 7, 7)) Equal to 3) then do (Custom script: call MakeItem(GetEventPlayerChatString(), 0)) else do (Do nothing)) else do (Do nothing)
If ((Substring((Entered chat string), 3, 6)) Equal to ITEM) then do (If ((Substring((Entered chat string), 7, 7)) Equal to 4) then do (Custom script: call MakeItem(GetEventPlayerChatString(), 0)) else do (Do nothing)) else do (Do nothing)
If ((Substring((Entered chat string), 3, 6)) Equal to ITEM) then do (If ((Substring((Entered chat string), 7, 7)) Equal to 5) then do (Custom script: call MakeItem(GetEventPlayerChatString(), 0)) else do (Do nothing)) else do (Do nothing)
If ((Substring((Entered chat string), 3, 6)) Equal to ITEM) then do (If ((Substring((Entered chat string), 7, 7)) Equal to 6) then do (Custom script: call MakeItem(GetEventPlayerChatString(), 0)) else do (Do nothing)) else do (Do nothing)
03-27-2004, 02:50 AM#2
BuRnInSpartan
whats a hero save?
03-28-2004, 04:05 PM#3
Kelna2
Hero Save is a really big trigger that saves data to the grandmastergames server and gives the data a code that only works on your computer so that it can be loaded up next game, this trigger has been used in the following maps: Curse of Time, Legacies, and Diablo 2 beta.
03-29-2004, 10:48 PM#4
Kelna2
Woot! That old trigger up above doesn't matter anymore! I fixed all my problems and MANY MANY MANY more!
I HIGHLY RECAMEND: http://umswe.wc3campaigns.com/weu/