//*************************************************************************************************************************************************************************************
//
// RPG Creator Basic Function Descriptions By Grabiti
//
//
//
//
// Internal System Functions Index
//
// function ToNotation takes integer input returns string
// ???
//
// function ToInteger takes string input returns integer
// ???
//
// function ToNotation2 takes integer input returns string
// Convert the given decimal to a binary value
//
// function ToInteger2 takes string input returns integer
// Converts the given binary to a decimal value
//
// function CodeLength takes string input, integer notation returns string
// ???
//
// function CodeLength2 takes string input, integer maxLength returns string
// ???
//
// function NameToInteger takes string name returns integer
// Converts the given string to a number
//
// function IsNumber takes string input returns boolean
// Check if the given text is a number
//
// function IsSpecial takes string input returns boolean
// Check if the given text is a symbol
//
// function IsSmallAlphabet takes string input returns boolean
// Check if the given text is lowercase
//
// function IsSmallAlphabet takes string input returns boolean
// Check if the given text is lowercase
//
// function CodeColor takes string input returns string
// ColorCodes the given string and returns new format
//
// function PrintCode takes player p, string saveResult, integer codeLine returns string
// Output the code to the player
//
// function HashSetting takes nothing returns nothing
// Save the object in setup HeroItem trigger to the hashtable.
//
// function MakeFile takes player p, string fileName, string string1, string string2, string string3, string string4 returns nothing
// Create and save a text file to CustomGameData/
//
// function DataOnBoolean takes integer loopA returns boolean
// returns true if the given value is an array value or cipher, otherwise returns false
//
// function SaveDataHash takes player p returns nothing
// Save the udg_data variables from the Save trigger to the hashtable
//
//
//
//
// User-Friendly Functions
//
// function AlphaToNormal takes unit whichUnit, real tick returns nothing
// Transforms the unit instantly and gradually fades it in (Gets less transparent with every tick internal)
//
// function NormalToAlpha takes unit whichUnit, real tick returns nothing
// Transforms the unit instantly and gradually fades it out (Gets more transparent with every tick internval)
//
// function DummyToAlpha takes unit whichUnit, real tick returns nothing
// Creates a dummy unit instantly and gradually fades it out (Gets more transparent with every tick interval)
//
// function MessageToTarget takes unit target, string text, integer alpha, real size, real speed, real time, real low, real high, real decline, real cycle, integer red, integer green, integer blue, boolean same returns nothing
// Creates a floating text of a set size at the set location and reduces the size of the floating text by a set value at the specified intervals
//
//
//
//
// Save Function
//
// function HeroSave takes player p, string message returns nothing
// Save function.
//
//
//
//
// Load Function
//
// function HeroLoad takes player p, string message returns nothing
// Load function.
//
//*************************************************************************************************************************************************************************************
//************************************************************************************************************************************************************************
//*
//* Internal System Functions
//*
//************************************************************************************************************************************************************************
function ToNotation takes integer input returns string
local string inputStr = I2S(input)
local string result = null
local integer mod
loop
exitwhen input <= 0
set mod = ModuloInteger(input, udg_keyLength)
set result = SubString(udg_keySet, mod, mod + 1) + result
set input = input / udg_keyLength
endloop
return result
endfunction
function ToInteger takes string input returns integer
local integer length = StringLength(input)
local string current = null
local integer result = 0
local integer loopA
local integer loopB
set loopA = 0
loop
exitwhen loopA >= length
set result = result * udg_keyLength
set current = SubString(input, loopA, loopA + 1)
set loopB = 0
loop
exitwhen (loopB >= udg_keyLength) or (current == SubString(udg_keySet, loopB, loopB + 1))
set loopB = loopB + 1
endloop
if (loopB <= udg_keyLength) then
set result = result + loopB
endif
set loopA = loopA + 1
endloop
return result
endfunction
function ToNotation2 takes integer input returns string
local string keySet = "01"
local integer keyLength = StringLength(keySet)
local string inputStr = I2S(input)
local string result = null
local integer mod
loop
exitwhen input <= 0
set mod = ModuloInteger(input, keyLength)
set result = SubString(keySet, mod, mod + 1) + result
set input = input / keyLength
endloop
return result
endfunction
function ToInteger2 takes string input returns integer
local string keySet = "01"
local integer keyLength = StringLength(keySet)
local integer length = StringLength(input)
local string current = null
local integer result = 0
local integer loopA
local integer loopB
set loopA = 0
loop
exitwhen loopA >= length
set result = result * keyLength
set current = SubString(input, loopA, loopA + 1)
set loopB = 0
loop
exitwhen (loopB >= keyLength) or (current == SubString(keySet, loopB, loopB + 1))
set loopB = loopB + 1
endloop
if (loopB <= keyLength) then
set result = result + loopB
endif
set loopA = loopA + 1
endloop
return result
endfunction
function CodeLength takes string input, integer notation returns string
local integer length = StringLength(input)
local integer blank = length - notation
if (blank < 0) then
loop
exitwhen blank >= 0
set input = udg_keyFirst + input
set blank = blank + 1
endloop
endif
return input
endfunction
function CodeLength2 takes string input, integer maxLength returns string
local integer length = StringLength(input)
local integer blank = length - maxLength
if (blank < 0) then
loop
exitwhen blank >= 0
set input = "0" + input
set blank = blank + 1
endloop
endif
return input
endfunction
function NameToInteger takes string name returns integer
local string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890~`!#$^&*()-_=+|{}[]:;<>,.?@"
local string cutString
local integer alphabetLength = StringLength(alphabet)
local integer nameLength = StringLength(name)
local integer cutLength
local integer result = 0
local integer loopA
local integer loopB
set loopA = 0
loop
exitwhen loopA > nameLength
set cutString = SubString(name, loopA, loopA + 1)
set loopB = 0
loop
exitwhen loopB > alphabetLength
if (cutString == SubString(alphabet, loopB, loopB + 1)) then
set result = result + (loopB * loopA)
endif
set loopB = loopB + 1
endloop
set loopA = loopA + 1
endloop
return result
endfunction
function IsNumber takes string input returns boolean
local integer loopA
set loopA = 0
loop
exitwhen loopA > 9
if (input == I2S(loopA)) then
return true
endif
set loopA = loopA + 1
endloop
return false
endfunction
function IsSpecial takes string input returns boolean
local string alphabet = udg_specialChar
local integer loopA
set loopA = 0
loop
exitwhen loopA > StringLength(alphabet)
if (input == SubString(alphabet, loopA, loopA + 1)) then
return true
endif
set loopA = loopA + 1
endloop
return false
endfunction
function IsSmallAlphabet takes string input returns boolean
local string alphabet = udg_smallAlphabetChar
local integer loopA
set loopA = 0
loop
exitwhen loopA > StringLength(alphabet)
if (input == SubString(alphabet, loopA, loopA + 1)) then
return true
endif
set loopA = loopA + 1
endloop
return false
endfunction
function IsBigAlphabet takes string input returns boolean
local string alphabet = udg_bigAlphabetChar
local integer loopA
set loopA = 0
loop
exitwhen loopA > StringLength(alphabet)
if (input == SubString(alphabet, loopA, loopA + 1)) then
return true
endif
set loopA = loopA + 1
endloop
return false
endfunction
function CodeColor takes string input returns string
local string result = ""
local string small = "|cff8080FF"
local string big = "|cff75E975"
local string special = "|cffFF8000"
local string number = "|cffFEFE7F"
local string checkStr
local boolean prevSmall = false
local boolean prevBig = false
local boolean prevSpecial = false
local boolean prevNumber = false
local integer loopA
set loopA = 0
loop
exitwhen loopA > StringLength(input)
set checkStr = SubString(input, loopA, loopA + 1)
if (IsNumber(checkStr) == true) then
if (prevNumber == true) then
set result = result + checkStr
else
set result = result + number + checkStr
endif
set prevNumber = true
set prevSpecial = false
set prevSmall = false
set prevBig = false
endif
if (IsSpecial(checkStr) == true) then
if (prevSpecial == true) then
set result = result + checkStr
else
set result = result + special + checkStr
endif
set prevNumber = false
set prevSpecial = true
set prevSmall = false
set prevBig = false
endif
if (IsSmallAlphabet(checkStr) == true) then
if (prevSmall == true) then
set result = result + checkStr
else
set result = result + small + checkStr
endif
set prevNumber = false
set prevSpecial = false
set prevSmall = true
set prevBig = false
endif
if (IsBigAlphabet(checkStr) == true) then
if (prevBig == true) then
set result = result + checkStr
else
set result = result + big + checkStr
endif
set prevNumber = false
set prevSpecial = false
set prevSmall = false
set prevBig = true
endif
set loopA = loopA + 1
endloop
set result = result + "|r"
return result
endfunction
function HashSetting takes nothing returns nothing
local integer loopA
set udg_saveHeroHash = InitHashtable()
set udg_saveItemHash = InitHashtable()
set loopA = 1
loop
exitwhen loopA > 8192
if (udg_saveHero[loopA] != 0) then
call SaveInteger(udg_saveHeroHash, 0, udg_saveHero[loopA], loopA)
endif
if (udg_saveItem[loopA] != 0) then
call SaveInteger(udg_saveItemHash, 0, udg_saveItem[loopA], loopA)
endif
if (ModuloInteger(loopA, 700) == 0) then
call TriggerSleepAction(0.01)
endif
set loopA = loopA + 1
endloop
call SaveInteger(udg_saveHeroHash, 0, 0, 0)
call SaveInteger(udg_saveItemHash, 0, 0, 0)
endfunction
function MakeFile takes player p, string message, string lv returns nothing
local string gold = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataGold)
local string lumber = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataLumber)
local string char = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroType)
local string heroExp = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroExp)
local string heroStr = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroStr)
local string heroAgi = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroAgi)
local string heroInt = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroInt)
local string heroItem1 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroItem1)
local string heroItem2 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroItem2)
local string heroItem3 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroItem3)
local string heroItem4 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroItem4)
local string heroItem5 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroItem5)
local string heroItem6 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroItem6)
local string heroCharge1 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroCharge1)
local string heroCharge2 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroCharge2)
local string heroCharge3 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroCharge3)
local string heroCharge4 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroCharge4)
local string heroCharge5 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroCharge5)
local string heroCharge6 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroCharge6)
local string bagItem1 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataBagItem1)
local string bagItem2 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataBagItem2)
local string bagItem3 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataBagItem3)
local string bagItem4 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataBagItem4)
local string bagItem5 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataBagItem5)
local string bagItem6 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataBagItem6)
local string bagCharge1 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataBagCharge1)
local string bagCharge2 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataBagCharge2)
local string bagCharge3 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataBagCharge3)
local string bagCharge4 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataBagCharge4)
local string bagCharge5 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataBagCharge5)
local string bagCharge6 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataBagCharge6)
local string saveTick = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataSaveTick)
local string code1 = LoadStr(udg_makeFileHash, GetHandleId(p), 1)
local string code2 = LoadStr(udg_makeFileHash, GetHandleId(p), 2)
local string code3 = LoadStr(udg_makeFileHash, GetHandleId(p), 3)
local string code4 = LoadStr(udg_makeFileHash, GetHandleId(p), 4)
local string code5 = LoadStr(udg_makeFileHash, GetHandleId(p), 5)
local string code6 = LoadStr(udg_makeFileHash, GetHandleId(p), 6)
local string code7 = LoadStr(udg_makeFileHash, GetHandleId(p), 7)
local string code8 = LoadStr(udg_makeFileHash, GetHandleId(p), 8)
local string code9 = LoadStr(udg_makeFileHash, GetHandleId(p), 9)
local string code10 = LoadStr(udg_makeFileHash, GetHandleId(p), 10)
local string code11 = LoadStr(udg_makeFileHash, GetHandleId(p), 11)
local string code12 = LoadStr(udg_makeFileHash, GetHandleId(p), 12)
local string code13 = LoadStr(udg_makeFileHash, GetHandleId(p), 13)
local string code14 = LoadStr(udg_makeFileHash, GetHandleId(p), 14)
local string code15 = LoadStr(udg_makeFileHash, GetHandleId(p), 15)
local string code16 = LoadStr(udg_makeFileHash, GetHandleId(p), 16)
local string code17 = LoadStr(udg_makeFileHash, GetHandleId(p), 17)
local string code18 = LoadStr(udg_makeFileHash, GetHandleId(p), 18)
local string code19 = LoadStr(udg_makeFileHash, GetHandleId(p), 19)
local string code20 = LoadStr(udg_makeFileHash, GetHandleId(p), 20)
local string code21 = LoadStr(udg_makeFileHash, GetHandleId(p), 21)
local string code22 = LoadStr(udg_makeFileHash, GetHandleId(p), 22)
local string code23 = LoadStr(udg_makeFileHash, GetHandleId(p), 23)
local string code24 = LoadStr(udg_makeFileHash, GetHandleId(p), 24)
local string code25 = LoadStr(udg_makeFileHash, GetHandleId(p), 25)
local string code26 = LoadStr(udg_makeFileHash, GetHandleId(p), 26)
local string code27 = LoadStr(udg_makeFileHash, GetHandleId(p), 27)
local string code28 = LoadStr(udg_makeFileHash, GetHandleId(p), 28)
local string code29 = LoadStr(udg_makeFileHash, GetHandleId(p), 29)
local string code30 = LoadStr(udg_makeFileHash, GetHandleId(p), 30)
local string fileName = GetPlayerName(p) + "_" + saveTick + "_" + I2S(GetRandomInt(1000000000, 2000000000))
if (GetLocalPlayer() == p) then
call PreloadGenClear()
call PreloadGenStart()
call Preload("----------------- Save Code ------------------")
if (code1 != null) then
call Preload("Code1: " + code1 + " ")
endif
if (code2 != null) then
call Preload("Code2: " + code2 + " ")
endif
if (code3 != null) then
call Preload("Code3: " + code3 + " ")
endif
if (code4 != null) then
call Preload("Code4: " + code4 + " ")
endif
if (code5 != null) then
call Preload("Code5: " + code5 + " ")
endif
if (code6 != null) then
call Preload("Code6: " + code6 + " ")
endif
if (code7 != null) then
call Preload("Code7: " + code7 + " ")
endif
if (code8 != null) then
call Preload("Code8: " + code8 + " ")
endif
if (code9 != null) then
call Preload("Code9: " + code9 + " ")
endif
if (code10 != null) then
call Preload("Code10: " + code10 + " ")
endif
if (code11 != null) then
call Preload("Code11: " + code11 + " ")
endif
if (code12 != null) then
call Preload("Code12: " + code12 + " ")
endif
if (code13 != null) then
call Preload("Code13: " + code13 + " ")
endif
if (code14 != null) then
call Preload("Code14: " + code14 + " ")
endif
if (code15 != null) then
call Preload("Code15: " + code15 + " ")
endif
if (code16 != null) then
call Preload("Code16: " + code16 + " ")
endif
if (code17 != null) then
call Preload("Code17: " + code17 + " ")
endif
if (code18 != null) then
call Preload("Code18: " + code18 + " ")
endif
if (code19 != null) then
call Preload("Code19: " + code19 + " ")
endif
if (code20 != null) then
call Preload("Code20: " + code20 + " ")
endif
if (code21 != null) then
call Preload("Code21: " + code21 + " ")
endif
if (code22 != null) then
call Preload("Code22: " + code22 + " ")
endif
if (code23 != null) then
call Preload("Code23: " + code23 + " ")
endif
if (code24 != null) then
call Preload("Code24: " + code24 + " ")
endif
if (code25 != null) then
call Preload("Code25: " + code25 + " ")
endif
if (code26 != null) then
call Preload("Code26: " + code26 + " ")
endif
if (code27 != null) then
call Preload("Code27: " + code27 + " ")
endif
if (code28 != null) then
call Preload("Code28: " + code28 + " ")
endif
if (code29 != null) then
call Preload("Code29: " + code29 + " ")
endif
if (code30 != null) then
call Preload("Code30: " + code30 + " ")
endif
call Preload("----------------- Data Stats -----------------")
if (gold != "0") then
call Preload("Gold: " + gold)
endif
if (lumber != "0") then
call Preload("Lumber: " + lumber)
endif
if (char != "0") then
call Preload("Char: " + char)
endif
if (lv != "0") then
call Preload("Lv: " + lv)
endif
if (heroExp != "0") then
call Preload("Exp: " + heroExp)
endif
if (heroStr != "0") then
call Preload("Str: " + heroStr)
endif
if (heroAgi != "0") then
call Preload("Agi: " + heroAgi)
endif
if (heroInt != "0") then
call Preload("Int: " + heroInt)
endif
if (heroItem1 != "0") then
call Preload("HeroItem1: '" + heroItem1 + "' Charges: " + heroCharge1)
endif
if (heroItem2 != "0") then
call Preload("HeroItem2: '" + heroItem2 + "' Charges: " + heroCharge2)
endif
if (heroItem3 != "0") then
call Preload("HeroItem3: '" + heroItem3 + "' Charges: " + heroCharge3)
endif
if (heroItem4 != "0") then
call Preload("HeroItem4: '" + heroItem4 + "' Charges: " + heroCharge4)
endif
if (heroItem5 != "0") then
call Preload("HeroItem5: '" + heroItem5 + "' Charges: " + heroCharge5)
endif
if (heroItem6 != "0") then
call Preload("HeroItem6: '" + heroItem6 + "' Charges: " + heroCharge6)
endif
if (bagItem1 != "0") then
call Preload("BagItem1: '" + bagItem1 + "' Charges: " + bagCharge1)
endif
if (bagItem2 != "0") then
call Preload("BagItem2: '" + bagItem2 + "' Charges: " + bagCharge2)
endif
if (bagItem3 != "0") then
call Preload("BagItem3: '" + bagItem3 + "' Charges: " + bagCharge3)
endif
if (bagItem4 != "0") then
call Preload("BagItem4: '" + bagItem4 + "' Charges: " + bagCharge4)
endif
if (bagItem5 != "0") then
call Preload("BagItem5: '" + bagItem5 + "' Charges: " + bagCharge5)
endif
if (bagItem6 != "0") then
call Preload("BagItem6: '" + bagItem6 + "' Charges: " + bagCharge6)
endif
call Preload("---------------- Chat Message ----------------")
call Preload(message)
call Preload("Grabiti's RPG Creator: http://cafe.naver.com/rpgcreator")
call PreloadGenEnd(udg_MapName + "\\" + fileName + ".txt")
call PreloadEnd(3.0)
call DisplayTimedTextToPlayer(p, 0.0, 0.0, 10.0, "|cfffffc01_____ __\\Grabiti's RPG Creator\\" + udg_MapName + " ___ " + fileName + ".txt__ _______.|r\n|c00DFFB4F_ __ Grabiti__ RPG Creator 1.08_ ____ ____ ____.|r")
call FlushChildHashtable(udg_dataTextStringHash, GetHandleId(p))
call FlushChildHashtable(udg_makeFileHash, GetHandleId(p))
endif
endfunction
function PrintCodeTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local player p = LoadPlayerHandle(udg_printCodeHash, GetHandleId(t), 0)
local string saveResult = LoadStr(udg_printCodeHash, GetHandleId(t), 0)
local integer codeLine = LoadInteger(udg_printCodeHash, GetHandleId(t), 0)
if (saveResult != null) then
call DisplayTimedTextToPlayer(p, 0.0, 0.0, 999.0, "|c00DFFB4FCode" + I2S(codeLine) + "\n" + CodeColor(saveResult))
endif
call FlushChildHashtable(udg_printCodeHash, GetHandleId(t))
call DestroyTimer(t)
set t = null
set p = null
endfunction
function PrintCode takes player p, string saveResult, integer codeLine returns nothing
local timer t = CreateTimer()
call SavePlayerHandle(udg_printCodeHash, GetHandleId(t), 0, p)
call SaveStr(udg_printCodeHash, GetHandleId(t), 0, saveResult)
call SaveInteger(udg_printCodeHash, GetHandleId(t), 0, codeLine)
call TimerStart(t, 0.0, false, function PrintCodeTimer)
set t = null
endfunction
function DataOnBoolean takes integer loopA returns boolean
if (loopA == udg_saveDataLengthCheck) or (loopA == udg_saveDataLength1) or (loopA == udg_saveDataLength2) or (loopA == udg_saveDataLength3) or (loopA == udg_saveDataLength4) or (loopA == udg_saveDataLength5) or (loopA == udg_saveDataLength6) or (loopA == udg_saveDataLength7) or (loopA == udg_saveDataLength8) or (loopA == udg_saveDataLength9) or (loopA == udg_saveDataLength10) or (loopA == udg_saveDataLength11) or (loopA == udg_saveDataLength12) or (loopA == udg_saveDataLength13) or (loopA == udg_saveDataLength14) or (loopA == udg_saveDataLength15) or (loopA == udg_saveDataLength16) or (loopA == udg_saveDataLength17) or (loopA == udg_saveDataLength18) or (loopA == udg_saveDataLength19) or (loopA == udg_saveDataLength20) or (loopA == udg_saveDataLength21) or (loopA == udg_saveDataLength22) or (loopA == udg_saveDataLength23) or (loopA == udg_saveDataLength24) or (loopA == udg_saveDataEncryption) then
return true
else
return false
endif
endfunction
function SaveDataHash takes player p returns nothing
local integer loopA
set loopA = 1
loop
exitwhen loopA > udg_saveDataN
call SaveInteger(udg_dataHash, GetConvertedPlayerId(p), loopA, udg_data[loopA])
set loopA = loopA + 1
endloop
endfunction
//************************************************************************************************************************************************************************
//*
//* User-Friendly Functions
//*
//************************************************************************************************************************************************************************
function AlphaToNormalTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit whichUnit = LoadUnitHandle(udg_alphaToNormalHash, GetHandleId(t), 0)
local integer timerLoop = LoadInteger(udg_alphaToNormalHash, GetHandleId(t), 1)
if (timerLoop > 0) then
set timerLoop = timerLoop - 1
call SetUnitVertexColorBJ(whichUnit, 100, 100, 100, I2R(timerLoop * 10))
call SaveInteger(udg_alphaToNormalHash, GetHandleId(t), 1, timerLoop)
else
call FlushChildHashtable(udg_alphaToNormalHash, GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set whichUnit = null
endfunction
function AlphaToNormal takes unit whichUnit, real tick returns nothing
local timer t = CreateTimer()
local integer timerLoop = 10
call SetUnitVertexColorBJ(whichUnit, 100, 100, 100, 100.0)
call SaveUnitHandle(udg_alphaToNormalHash, GetHandleId(t), 0, whichUnit)
call SaveInteger(udg_alphaToNormalHash, GetHandleId(t), 1, timerLoop)
call TimerStart(t, tick, true, function AlphaToNormalTimer)
set t = null
endfunction
function NormalToAlphaTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit whichUnit = LoadUnitHandle(udg_normalToAlphaHash, GetHandleId(t), 0)
local integer timerLoop = LoadInteger(udg_normalToAlphaHash, GetHandleId(t), 1)
if (timerLoop > 0) then
set timerLoop = timerLoop - 1
call SetUnitVertexColorBJ(whichUnit, 100, 100, 100, 100.0 - I2R(timerLoop * 10))
call SaveInteger(udg_normalToAlphaHash, GetHandleId(t), 1, timerLoop)
else
call FlushChildHashtable(udg_normalToAlphaHash, GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set whichUnit = null
endfunction
function NormalToAlpha takes unit whichUnit, real tick returns nothing
local timer t = CreateTimer()
local integer timerLoop = 10
call SetUnitVertexColorBJ(whichUnit, 100, 100, 100, 0.0)
call SaveUnitHandle(udg_normalToAlphaHash, GetHandleId(t), 0, whichUnit)
call SaveInteger(udg_normalToAlphaHash, GetHandleId(t), 1, timerLoop)
call TimerStart(t, tick, true, function NormalToAlphaTimer)
set t = null
endfunction
function DummyToAlphaTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit tempUnit = LoadUnitHandle(udg_dummyToAlphaHash, GetHandleId(t), 0)
local integer timerLoop = LoadInteger(udg_dummyToAlphaHash, GetHandleId(t), 1)
if (timerLoop > 0) then
set timerLoop = timerLoop - 1
call SetUnitVertexColorBJ(tempUnit, 100, 100, 100, 100.0 - I2R(timerLoop * 10))
call SaveInteger(udg_dummyToAlphaHash, GetHandleId(t), 1, timerLoop)
else
call RemoveUnit(tempUnit)
call FlushChildHashtable(udg_dummyToAlphaHash, GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set tempUnit = null
endfunction
function DummyToAlpha takes unit whichUnit, real tick returns nothing
local timer t = CreateTimer()
local unit tempUnit
local integer timerLoop = 10
set tempUnit = CreateUnit(GetOwningPlayer(whichUnit), GetUnitTypeId(whichUnit), GetUnitX(whichUnit), GetUnitY(whichUnit), GetUnitFacing(GetTriggerUnit()))
call UnitAddAbility(tempUnit, 'Aloc')
call UnitMakeAbilityPermanent(tempUnit, true, 'Aloc')
call SaveUnitHandle(udg_dummyToAlphaHash, GetHandleId(t), 0, tempUnit)
call SaveInteger(udg_dummyToAlphaHash, GetHandleId(t), 1, timerLoop)
call TimerStart(t, tick, true, function DummyToAlphaTimer)
set t = null
set tempUnit = null
endfunction
function MessageToTargetNonOverlap takes nothing returns nothing
local timer sameTimer = GetExpiredTimer()
local integer targetId = LoadInteger(udg_messageToTargetHash, GetHandleId(sameTimer), 0)
call FlushChildHashtable(udg_messageToTargetHash, targetId)
call FlushChildHashtable(udg_messageToTargetHash, GetHandleId(sameTimer))
call DestroyTimer(sameTimer)
set sameTimer = null
endfunction
function MessageToTargetTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local texttag textTag = LoadTextTagHandle(udg_messageToTargetHash, GetHandleId(t), 0)
local string text = LoadStr(udg_messageToTargetHash, GetHandleId(t), 1)
local real size = LoadReal(udg_messageToTargetHash, GetHandleId(t), 2)
local real decline = LoadReal(udg_messageToTargetHash, GetHandleId(t), 3)
local real cycle = LoadReal(udg_messageToTargetHash, GetHandleId(t), 4)
local integer loopN = LoadInteger(udg_messageToTargetHash, GetHandleId(t), 5)
if (loopN > 0) then
set loopN = loopN - 1
set decline = decline / 100
set size = size / (1 + decline)
set decline = decline * 100
call SetTextTagText(textTag, text, size * 0.023 / 10)
call SaveTextTagHandle(udg_messageToTargetHash, GetHandleId(t), 0, textTag)
call SaveStr(udg_messageToTargetHash, GetHandleId(t), 1, text)
call SaveReal(udg_messageToTargetHash, GetHandleId(t), 2, size)
call SaveReal(udg_messageToTargetHash, GetHandleId(t), 3, decline)
call SaveReal(udg_messageToTargetHash, GetHandleId(t), 4, cycle)
call SaveInteger(udg_messageToTargetHash, GetHandleId(t), 5, loopN)
else
call FlushChildHashtable(udg_messageToTargetHash, GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set textTag = null
endfunction
function MessageToTarget takes unit target, string text, integer alpha, real size, real speed, real time, real low, real high, integer decline, real cycle, integer red, integer green, integer blue, boolean same returns nothing
local timer t
local timer sameTimer
local texttag textTag
local real vel = speed * 0.071 / 128
local real xvel = vel * Cos(GetRandomReal(low, high) * bj_DEGTORAD)
local real yvel = vel * Sin(GetRandomReal(low, high) * bj_DEGTORAD)
local integer loopN = 5
if (same == true) then
if (HaveSavedHandle(udg_messageToTargetHash, GetHandleId(target), 0)) then
set sameTimer = LoadTimerHandle(udg_messageToTargetHash, GetHandleId(target), 0)
if (TimerGetRemaining(sameTimer) != 0.0) then
set t = null
set sameTimer = null
set textTag = null
return
endif
endif
set sameTimer = CreateTimer()
call SaveTimerHandle(udg_messageToTargetHash, GetHandleId(target), 0, sameTimer)
call SaveInteger(udg_messageToTargetHash, GetHandleId(sameTimer), 0, GetHandleId(target))
call TimerStart(sameTimer, 0.001, false, function MessageToTargetNonOverlap)
endif
set textTag = CreateTextTag()
call SetTextTagText(textTag, text, size * 0.023 / 10)
call SetTextTagPosUnit(textTag, target, 0.00)
call SetTextTagColor(textTag, red, green, blue, alpha)
call SetTextTagPermanent(textTag, false)
call SetTextTagLifespan(textTag, time)
call SetTextTagFadepoint(textTag, 0.00)
call SetTextTagVelocity(textTag, xvel, yvel)
set t = CreateTimer()
call SaveTextTagHandle(udg_messageToTargetHash, GetHandleId(t), 0, textTag)
call SaveStr(udg_messageToTargetHash, GetHandleId(t), 1, text)
call SaveReal(udg_messageToTargetHash, GetHandleId(t), 2, size)
call SaveReal(udg_messageToTargetHash, GetHandleId(t), 3, decline)
call SaveReal(udg_messageToTargetHash, GetHandleId(t), 4, cycle)
call SaveInteger(udg_messageToTargetHash, GetHandleId(t), 5, loopN)
call TimerStart(t, cycle, true, function MessageToTargetTimer)
set t = null
set sameTimer = null
set textTag = null
endfunction
Name | Type | is_array | initial_value |
afkPreventAnswer | integer | No | |
afkPreventBoolean | boolean | Yes | |
afkPreventTick | integer | No | |
AFKPreventTime | real | No | |
afkPreventTimer | timer | No | |
afkPreventTimerWindow | timerdialog | No | |
alphaToNormalHash | hashtable | No | |
bag | unit | Yes | |
bagUnitType | unitcode | No | |
bagZoneLoc | location | Yes | |
bagZoneRect | rect | Yes | |
bigAlphabetChar | string | No | |
camDistance | integer | Yes | 1650 |
cleanBoolean | boolean | No | |
cleanTimer | timer | No | |
cleanTimerdialog | timerdialog | No | |
codeLine | integer | Yes | |
codeLoadingNow | boolean | Yes | |
codeSavingNow | boolean | Yes | |
codeString | string | Yes | |
codeTyping | boolean | Yes | |
codeTypingTick | integer | Yes | |
damagePrintAction | triggeraction | No | |
data | integer | Yes | |
dataHash | hashtable | No | |
dataLength1 | string | Yes | |
dataLength10 | string | Yes | |
dataLength11 | string | Yes | |
dataLength12 | string | Yes | |
dataLength13 | string | Yes | |
dataLength14 | string | Yes | |
dataLength15 | string | Yes | |
dataLength16 | string | Yes | |
dataLength17 | string | Yes | |
dataLength18 | string | Yes | |
dataLength19 | string | Yes | |
dataLength2 | string | Yes | |
dataLength20 | string | Yes | |
dataLength21 | string | Yes | |
dataLength22 | string | Yes | |
dataLength23 | string | Yes | |
dataLength24 | string | Yes | |
dataLength3 | string | Yes | |
dataLength4 | string | Yes | |
dataLength5 | string | Yes | |
dataLength6 | string | Yes | |
dataLength7 | string | Yes | |
dataLength8 | string | Yes | |
dataLength9 | string | Yes | |
dataLengthCheck | string | Yes | |
dataTextStringHash | hashtable | No | |
dummyToAlphaHash | hashtable | No | |
fileSaveDialog | dialog | No | |
fileSaveTimer | timer | No | |
hero | unit | Yes | |
heroLoaded | boolean | No | |
keyFirst | string | No | |
keyLength | integer | No | |
keySet | string | No | |
loadLength | integer | No | |
location | location | No | |
location2 | location | No | |
makeFileHash | hashtable | No | |
MapName | string | No | |
messageToTargetHash | hashtable | No | |
normalToAlphaHash | hashtable | No | |
playerColor | string | Yes | |
printCodeHash | hashtable | No | |
real | real | No | |
regionHash | hashtable | No | |
regionI | integer | No | |
regionTimerHash | hashtable | No | |
regionU | unit | Yes | |
reviveTimer | timer | Yes | |
reviveTimerdialog | timerdialog | Yes | |
saveData | integer | Yes | |
saveDataBagCharge1 | integer | No | |
saveDataBagCharge2 | integer | No | |
saveDataBagCharge3 | integer | No | |
saveDataBagCharge4 | integer | No | |
saveDataBagCharge5 | integer | No | |
saveDataBagCharge6 | integer | No | |
saveDataBagItem1 | integer | No | |
saveDataBagItem2 | integer | No | |
saveDataBagItem3 | integer | No | |
saveDataBagItem4 | integer | No | |
saveDataBagItem5 | integer | No | |
saveDataBagItem6 | integer | No | |
saveDataEncryption | integer | No | |
saveDataGold | integer | No | |
saveDataHeroAgi | integer | No | |
saveDataHeroCharge1 | integer | No | |
saveDataHeroCharge2 | integer | No | |
saveDataHeroCharge3 | integer | No | |
saveDataHeroCharge4 | integer | No | |
saveDataHeroCharge5 | integer | No | |
saveDataHeroCharge6 | integer | No | |
saveDataHeroExp | integer | No | |
saveDataHeroInt | integer | No | |
saveDataHeroItem1 | integer | No | |
saveDataHeroItem2 | integer | No | |
saveDataHeroItem3 | integer | No | |
saveDataHeroItem4 | integer | No | |
saveDataHeroItem5 | integer | No | |
saveDataHeroItem6 | integer | No | |
saveDataHeroStr | integer | No | |
saveDataHeroType | integer | No | |
saveDataLength1 | integer | No | |
saveDataLength10 | integer | No | |
saveDataLength11 | integer | No | |
saveDataLength12 | integer | No | |
saveDataLength13 | integer | No | |
saveDataLength14 | integer | No | |
saveDataLength15 | integer | No | |
saveDataLength16 | integer | No | |
saveDataLength17 | integer | No | |
saveDataLength18 | integer | No | |
saveDataLength19 | integer | No | |
saveDataLength2 | integer | No | |
saveDataLength20 | integer | No | |
saveDataLength21 | integer | No | |
saveDataLength22 | integer | No | |
saveDataLength23 | integer | No | |
saveDataLength24 | integer | No | |
saveDataLength3 | integer | No | |
saveDataLength4 | integer | No | |
saveDataLength5 | integer | No | |
saveDataLength6 | integer | No | |
saveDataLength7 | integer | No | |
saveDataLength8 | integer | No | |
saveDataLength9 | integer | No | |
saveDataLengthCheck | integer | No | |
saveDataLumber | integer | No | |
saveDataN | integer | No | |
saveDataSaveTick | integer | No | |
saveDataVersion | integer | No | |
saveHero | unitcode | Yes | |
saveHeroHash | hashtable | No | |
saveItem | itemcode | Yes | |
saveItemHash | hashtable | No | |
saveString | string | Yes | |
saveTick | integer | Yes | |
selectTimer | timer | Yes | |
selectUnitType | unitcode | Yes | UnitTypeNull |
smallAlphabetChar | string | No | |
specialChar | string | No | |
TestID | string | No | |
TestMode | boolean | No | |
ToolsAFKPrevent | boolean | No | |
ToolsCam | boolean | No | |
ToolsClean | boolean | No | |
ToolsDamagePrint | boolean | No | |
ToolsDice | boolean | No | |
ToolsFileSave | boolean | No | |
ToolsPatrol | boolean | No | |
ToolsSuicide | boolean | No | |
ToolsTeamKill | boolean | No | |
ToolsUnitBorrow | boolean | No |
function Trig_system_F9 takes nothing returns nothing
local quest qst
local string str
set qst = CreateQuest()
call QuestSetTitle(qst, "|c00DFFB4FGrabiti's RPG Creator 1.07|r")
set str = "|cff47455A? |cffB4C3FFRPG Name : |cffFFCD28" + udg_MapName
set str = str + "\n|cff47455A? |c00DFFB4FThis map is made with Grabiti's RPG Creator 1.08."
set str = str + "\n|cff47455A? |cfffffc01When you save your hero will not be removed! Your save code will also be saved to |cffFFCD28Warcraft 3 Folder\\Grabiti's RPG Creator\\RPG Name"
set str = str + "\n|cff47455A? |cffB4C3FFCharges of Items are Saved, And the Inentory of your Backpack are also Saved."
set str = str + "\n|cff47455A? |cff78EFADFor more information visit |cff63CC63http://cafe.naver.com/rpgcreator|r |cffed1106[Requires Cafe.Naver Account and to be Verified in the Forum Board]|r"
call QuestSetDescription(qst, str)
call QuestSetIconPath(qst, "ReplaceableTextures\\CommandButtons\\BTNAmbush.blp")
call QuestSetRequired(qst, true)
set qst = CreateQuest()
call QuestSetTitle(qst, "|cff557DE1Basic Commands|r")
set str = "|cffffcc00-Cam <50~150> : |rAdjusts your camera's Field of View."
set str = str + "\n|cffffcc00-Suicide : |rKills your hero."
set str = str + "\n|cffffcc00-Dice : |r1~100 Outputs a random number between 1 and 100."
set str = str + "\n|cffffcc00-Save : |rSaves your hero."
set str = str + "\n|cffffcc00-Load : |rLoads your hero. (You must type the code after typing -Load.)"
call QuestSetDescription(qst, str)
call QuestSetIconPath(qst, "ReplaceableTextures\\CommandButtons\\BTNAmbush.blp")
call QuestSetRequired(qst, true)
set qst = null
endfunction
function InitTrig_system_F9 takes nothing returns nothing
endfunction
function Trig_CreepRegion_Timer takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer unitType = LoadInteger(udg_regionTimerHash, GetHandleId(t), 0)
local integer unitCode = LoadInteger(udg_regionTimerHash, GetHandleId(t), 1)
local real x = LoadReal(udg_regionHash, 1, unitCode)
local real y = LoadReal(udg_regionHash, 2, unitCode)
local unit tempUnit
local integer timerLoop = 10
// Unit will respawn after timer expires.
set tempUnit = CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE), unitType, x, y, GetRandomReal(0, 360))
call AlphaToNormal(tempUnit, 0.02)
call SaveUnitHandle(udg_regionHash, 0, unitCode, tempUnit)
// Flush handle id from the hashtable to prevent memory leaks
call FlushChildHashtable(udg_regionTimerHash, GetHandleId(t))
call DestroyTimer(t)
set t = null
set tempUnit = null
endfunction
function Trig_CreepRegion_Actions takes nothing returns nothing
local timer t
local integer unitType = GetUnitTypeId(GetTriggerUnit())
local integer unitCode
local unit tempUnit
local integer loopA
// Wait to respawn if the point value of the unit is not 100
if (GetUnitPointValue(GetTriggerUnit()) != 100) then
set loopA = 1
loop
exitwhen loopA > udg_regionI
set tempUnit = LoadUnitHandle(udg_regionHash, 0, loopA)
if (GetTriggerUnit() == tempUnit) then
set unitCode = loopA
exitwhen true
endif
set loopA = loopA + 1
endloop
set t = CreateTimer()
call SaveInteger(udg_regionTimerHash, GetHandleId(t), 0, unitType)
call SaveInteger(udg_regionTimerHash, GetHandleId(t), 1, unitCode)
call TimerStart(t, I2R(GetUnitPointValueByType(GetUnitTypeId(GetTriggerUnit()))), false, function Trig_CreepRegion_Timer)
endif
// Flush handle id from the hashtable to prevent memory leaks
set t = null
set tempUnit = null
endfunction
//===========================================================================
function InitTrig_CreepRegion takes nothing returns nothing
set udg_regionTimerHash = InitHashtable()
set gg_trg_CreepRegion = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(gg_trg_CreepRegion, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddAction(gg_trg_CreepRegion, function Trig_CreepRegion_Actions)
endfunction
function Trig_DamagePrint_Actions takes nothing returns nothing
if (udg_ToolsDamagePrint == true) and (GetEventDamage() > 0) then
if (GetPlayerController(GetOwningPlayer(GetTriggerUnit())) == MAP_CONTROL_USER) then
call MessageToTarget(GetTriggerUnit(), "|cfffffc01" + I2S(R2I(GetEventDamage())) + "|r", 0, 14.0, 90, 2.0, 60, 120, 7, 0.02, 255, 255, 255, true)
else
call MessageToTarget(GetTriggerUnit(), "|cffff0202" + I2S(R2I(GetEventDamage())) + "|r", 0, 14.0, 90, 2.0, 60, 120, 7, 0.02, 255, 255, 255, true)
endif
endif
endfunction
//===========================================================================
function InitTrig_DamagePrint takes nothing returns nothing
set gg_trg_DamagePrint = CreateTrigger()
set udg_damagePrintAction = TriggerAddAction(gg_trg_DamagePrint, function Trig_DamagePrint_Actions)
endfunction