Name | Type | is_array | initial_value |
//TESH.scrollpos=286
//TESH.alwaysfold=0
/////////////////////////////////////////////////////
// Letterbox Choose System //
// by: McThyzer //
// //
// v1.3 //
// //
// Give Credits if you use! //
// If you have ideas or found buggs... //
// inWc: vol-lol //
// Hive: McDoNaLdGaNgStA //
// //
/////////////////////////////////////////////////////
library LCS initializer init
globals
private boolean repeating = true //when you've selected the last option and press "down", do you want to return to the start?
private string highlighting = "|cffff9900" //the highlighting color of the selected option
private boolean autoclose = false //When the user has choosen an option the LCS-Mode is turned off?
private boolean exitwhenesc = true //Exits the LCS when pressing Escape?
private sound updownsound = CreateSound("Sound\\Interface\\MouseClick1.wav", false, false, false, 10, 10, "") //just a "click" sound :)
private sound rightsound = CreateSound("Sound\\Interface\\BigButtonClick.wav", false, false, false, 10, 10, "") //just a "click" sound :)
private real delay = 0.5 //in what time does the interface fadein/out
private hashtable HTstr = InitHashtable() //Saves the Strings and Messages for each player
private hashtable HTfun = InitHashtable() // Saves the Functions which are executed.
private hashtable HTex = InitHashtable() // For extra stuff (like "Which String is marked?")
private hashtable HTfun2 = InitHashtable() //Saves the Functions for the "left" key.
public integer LCSLastPickedOptionId = 0
endglobals
private function LCSString takes integer whichplayer returns string
local string str = ""
local integer i = 1
if LoadInteger(HTex, whichplayer, 0) > 4 then
set i = LoadInteger(HTex, whichplayer, 0) - 4
endif
loop
exitwhen i > LoadInteger(HTstr, whichplayer, 0)
if i == LoadInteger(HTex, whichplayer, 0) then
set str = str + highlighting
endif
set str = str + LoadStr(HTstr, whichplayer, i)
if i == LoadInteger(HTex, whichplayer, 0) then
set str = str + "|r"
endif
set str = str + "|n"
set i = i + 1
endloop
return str
endfunction
private function LCSOn takes nothing returns boolean
return LoadBoolean(HTex, GetPlayerId(GetTriggerPlayer()), 3)
endfunction
function LCSClear takes integer whichplayer, boolean all returns nothing
local integer i = 1
loop
exitwhen i > LoadInteger(HTstr, whichplayer, 0)
call SaveStr(HTstr, whichplayer, i, "")
call SaveStr(HTfun, whichplayer, i, "")
set i = i + 1
endloop
call SaveInteger(HTstr, whichplayer, 0, 0)
call SaveInteger(HTex, whichplayer, 0, 1)
if all == true then
call SaveUnitHandle(HTex, whichplayer, 1, null)
call SaveStr(HTex, whichplayer, 2, "")
endif
endfunction
private function LCSTextReset takes integer whichplayer returns nothing
local string str = LCSString(whichplayer)
call TransmissionFromUnitWithNameBJ( bj_FORCE_PLAYER[whichplayer], LoadUnitHandle(HTex, whichplayer, 1), LoadStr(HTex, whichplayer, 2), null, str, bj_TIMETYPE_SET, 9999, false)
loop
exitwhen LoadStr(HTfun, whichplayer, LoadInteger(HTex, whichplayer, 0)) != "lcsfake"
call SaveInteger(HTex, whichplayer, 0, LoadInteger(HTex, whichplayer, 0) + 1)
endloop
endfunction
function LCSOptionChange takes integer whichplayer, integer option, string newtext, boolean exefunc, string newfunc1, string newfunc2 returns nothing
if newtext != "" then
call SaveStr(HTstr, whichplayer, option, newtext)
endif
if exefunc == false then
call SaveStr(HTfun, whichplayer, option, null)
else
if newfunc1 != "" then
call SaveStr(HTfun, whichplayer, option, newfunc1)
endif
if newfunc2 != "" then
call SaveStr(HTfun2, whichplayer, option, newfunc2)
endif
endif
call LCSTextReset(whichplayer)
endfunction
function LCSOptionClear takes integer whichplayer, integer option returns nothing
local integer i = option
local integer amount = LoadInteger(HTstr, whichplayer, 0) - 1
loop
exitwhen i > amount
call SaveStr(HTstr, whichplayer, i, LoadStr(HTstr, whichplayer, i + 1))
call SaveStr(HTfun, whichplayer, i, LoadStr(HTfun, whichplayer, i + 1))
call SaveStr(HTfun2, whichplayer, i, LoadStr(HTfun2, whichplayer, i + 1))
set i = i + 1
endloop
call SaveInteger(HTstr, whichplayer, 0, amount)
call LCSTextReset(whichplayer)
endfunction
function LCSRem takes integer whichplayer returns nothing
call LCSClear(whichplayer, true)
if GetLocalPlayer() == Player(whichplayer) then
call ShowInterface(true, delay)
call PanCameraTo(GetUnitX(LoadUnitHandle(HTex, whichplayer, 1)),GetUnitY(LoadUnitHandle(HTex, whichplayer, 1)))
endif
call SaveBoolean(HTex, whichplayer, 3, false)
endfunction
function LCSShow takes integer whichplayer, unit hero, string name returns nothing
call LCSClear(whichplayer, true)
if GetLocalPlayer() == Player(whichplayer) then
call ClearTextMessages()
call ShowInterface(false, delay)
call EnableUserControl(true)
endif
call SetCameraTargetControllerNoZForPlayer(Player(whichplayer), hero, 0, 0, false)
call SaveUnitHandle(HTex, whichplayer, 1, hero)
call SaveStr(HTex, whichplayer, 2, name)
call SaveBoolean(HTex, whichplayer, 3, true)
call LCSTextReset(whichplayer)
set hero = null
endfunction
function lcsfake takes nothing returns nothing
endfunction
function LCSOptionAdd takes integer whichplayer, string text, string funcName, string leftfunc returns nothing
local integer i = LoadInteger(HTstr, whichplayer, 0) + 1
call SaveStr(HTstr, whichplayer, i, text)
call SaveStr(HTfun, whichplayer, i, funcName)
call SaveStr(HTfun2, whichplayer, i, leftfunc)
if leftfunc == "" then
call SaveStr(HTfun2, whichplayer, i, null)
endif
call SaveInteger(HTstr, whichplayer, 0, i)
if LCSOn() == true then
call LCSTextReset(whichplayer)
endif
endfunction
function LCSFakeAdd takes integer whichplayer, string text returns nothing
local integer i = LoadInteger(HTstr, whichplayer, 0) + 1
call SaveStr(HTstr, whichplayer, i, text)
call SaveStr(HTfun, whichplayer, i, "lcsfake")
call SaveInteger(HTstr, whichplayer, 0, i)
if LCSOn() == true then
call LCSTextReset(whichplayer)
endif
endfunction
private function up takes nothing returns nothing
local integer i = LoadInteger(HTex, GetPlayerId(GetTriggerPlayer()), 0)
if (GetLocalPlayer() == GetTriggerPlayer()) then
call StartSound( updownsound )
endif
if i == 1 and repeating == true then
set i = LoadInteger(HTstr, GetPlayerId(GetTriggerPlayer()), 0)
elseif i == 1 and repeating == false then
set i = i
elseif i > 1 then
set i = i - 1
endif
if LoadStr(HTfun, GetPlayerId(GetTriggerPlayer()), i) == "lcsfake" then
set i = i - 1
if i == 0 and repeating == true then
set i = LoadInteger(HTstr, GetPlayerId(GetTriggerPlayer()), 0)
endif
endif
call SaveInteger(HTex, GetPlayerId(GetTriggerPlayer()), 0, i)
call LCSTextReset(GetPlayerId(GetTriggerPlayer()))
endfunction
private function down takes nothing returns nothing
local integer i = LoadInteger(HTex, GetPlayerId(GetTriggerPlayer()), 0)
if (GetLocalPlayer() == GetTriggerPlayer()) then
call StartSound( updownsound )
endif
if i == LoadInteger(HTstr, GetPlayerId(GetTriggerPlayer()), 0) and repeating == true then
set i = 1
elseif i == LoadInteger(HTstr, GetPlayerId(GetTriggerPlayer()), 0) and repeating == false then
set i = i
elseif i < LoadInteger(HTstr, GetPlayerId(GetTriggerPlayer()), 0) then
set i = i + 1
endif
if LoadStr(HTfun, GetPlayerId(GetTriggerPlayer()), i) == "lcsfake" then
set i = i + 1
if i == LoadInteger(HTstr, GetPlayerId(GetTriggerPlayer()), 0) and repeating == true then
set i = 1
endif
endif
call SaveInteger(HTex, GetPlayerId(GetTriggerPlayer()), 0, i)
call LCSTextReset(GetPlayerId(GetTriggerPlayer()))
endfunction
function LCSGetPicked takes nothing returns integer
return LCSLastPickedOptionId
endfunction
private function right takes nothing returns nothing
set LCSLastPickedOptionId = LoadInteger(HTex, GetPlayerId(GetTriggerPlayer()), 0)
if LoadStr(HTfun, GetPlayerId(GetTriggerPlayer()), LoadInteger(HTex, GetPlayerId(GetTriggerPlayer()), 0)) != null then
call ExecuteFunc(LoadStr(HTfun, GetPlayerId(GetTriggerPlayer()), LoadInteger(HTex, GetPlayerId(GetTriggerPlayer()), 0)))
endif
if (GetLocalPlayer() == GetTriggerPlayer()) then
call StartSound( rightsound )
endif
if autoclose == true then
call LCSRem(GetPlayerId(GetTriggerPlayer()))
endif
endfunction
private function left takes nothing returns nothing
if LoadStr(HTfun2, GetPlayerId(GetTriggerPlayer()), LoadInteger(HTex, GetPlayerId(GetTriggerPlayer()), 0)) != null then
set LCSLastPickedOptionId = LoadInteger(HTex, GetPlayerId(GetTriggerPlayer()), 0)
call ExecuteFunc(LoadStr(HTfun2, GetPlayerId(GetTriggerPlayer()), LoadInteger(HTex, GetPlayerId(GetTriggerPlayer()), 0)))
if (GetLocalPlayer() == GetTriggerPlayer()) then
call StartSound( rightsound )
endif
if autoclose == true then
call LCSRem(GetPlayerId(GetTriggerPlayer()))
endif
endif
endfunction
private function esc takes nothing returns nothing
local integer id = GetPlayerId(GetTriggerPlayer())
if exitwhenesc == true then
call LCSRem(id)
else
call PolledWait(0.01)
call LCSTextReset(id)
endif
endfunction
private function init takes nothing returns nothing
local trigger LCSup = CreateTrigger()
local trigger LCSdown = CreateTrigger()
local trigger LCSright = CreateTrigger()
local trigger LCSleft = CreateTrigger()
local trigger LCSEsc = CreateTrigger()
local integer i = 0
loop
exitwhen i > 12
call TriggerRegisterPlayerKeyEventBJ( LCSup, Player(i), bj_KEYEVENTTYPE_DEPRESS, bj_KEYEVENTKEY_UP )
call TriggerRegisterPlayerKeyEventBJ( LCSdown, Player(i), bj_KEYEVENTTYPE_DEPRESS, bj_KEYEVENTKEY_DOWN )
call TriggerRegisterPlayerKeyEventBJ( LCSright, Player(i), bj_KEYEVENTTYPE_DEPRESS, bj_KEYEVENTKEY_RIGHT )
call TriggerRegisterPlayerKeyEventBJ( LCSleft, Player(i), bj_KEYEVENTTYPE_DEPRESS, bj_KEYEVENTKEY_LEFT )
call TriggerRegisterPlayerEvent(LCSEsc, Player(i), EVENT_PLAYER_END_CINEMATIC)
call SaveBoolean(HTex, i, 3, false)
set i = i + 1
endloop
call TriggerAddCondition(LCSup, Condition(function LCSOn))
call TriggerAddCondition(LCSdown, Condition(function LCSOn))
call TriggerAddCondition(LCSright, Condition(function LCSOn))
call TriggerAddCondition(LCSleft, Condition(function LCSOn))
call TriggerAddCondition(LCSEsc, Condition(function LCSOn))
call TriggerAddAction(LCSup, function up)
call TriggerAddAction(LCSdown, function down)
call TriggerAddAction(LCSright, function right)
call TriggerAddAction(LCSleft, function left)
call TriggerAddAction(LCSEsc, function esc)
endfunction
endlibrary
//TESH.scrollpos=19
//TESH.alwaysfold=0
FUNCTIONS WHICH YOU CAN USE:
call LCSShow(<integer>, <unit>, <string>)
-> It Shows one Player the "LCS"-Menu.
- integer is the Player you want to show the LCS-Screen. (Lets the Interface Disappear!)
- unit is which unit "talks" to the Player. In RPG i would pick the MainHero.
- string is the Unit name.
call LCSClear(<integer>, <boolean>)
-> it clears the LCS for an specific player.
- integer is the Player whichs LCS-Screen should be Cleared.
- when the boolean is true it will clear all, else it will let the extra things, it is perfect for complex things, like the Altar
call LCSOptionAdd(<integer>, <string>, <string>)
-> It Adds an option to the LCS of an specific player.
- integer is the Player you want to Show the Text.
- string is the Text displayed.
- string is the Function which is executed when the option is choosen.
call LCSRem(<integer>)
-> removes the LCS for an player, the interface is showen again, the LCS is cleared for that player and thats all :)
- integer is the Player whichs LCS-Screen should be removed.
call LCSOptionClear(<integer>, <integer>)
-> removes one single option for one player.
- integer is the player for whom the option is removed
- integer is the option id which is removed
call LCSGetPicked()
-> returns the last choosen optionid
call LCSOptionChange(<integer>, <integer>, <string>, <boolean>, <string>)
-> changes the text and/or the function of an option
- integer is the player for whom the option is changed
- integer is the option id of the option which is changed
- string is the new name of the option. Use "" when you dont want to change the function.
- boolean is true if an function shall be executed, false when nothing shall happen
- string is the new function, when boolean is true. Use "" when you dont want to change the function.
call LCSFakeAdd(<integer>, <string>)
-> Adds an text which cannot be selected to the LCS for an specific player.
- integer is the player for whom the text is shown.
- string is the text shown.
//TESH.scrollpos=0
//TESH.alwaysfold=0
/////////////////////////////////////////////////////////////////////////////////////////////////////
- Letterbox Choose System v1.1 -
- Changed description to a better one
- Changed "AddText" to "AddOption"
- Fixed an bugg that occurs when pressing the 'Esc' key while LCS is on.
- Added an feature: "exitwhenesc", when it is true and a player presses esc, the LCS will close, else nothing will happen
- Added a function "LCSOptionClear" for clearing a single Option.
- Added a function "LCSOptionChange" for changing the text and/or the function of an option
/////////////////////////////////////////////////////////////////////////////////////////////////////
- Letterbox Choose System v1.2 -
- Added "Revive" to the Altar
- Improved the "Troll spawner" trigger
- Added "Dialog" example. (Clockwerk Goblin, bottom left)
/////////////////////////////////////////////////////////////////////////////////////////////////////
- Letterbox Choose System v1.3 -
- Improved the "LCSOptionAdd" function to add an trigger which is executed when pressing the "left" key.
- Improved the "LCSOptionChange" function to change the "left"-key trigger
- Added a function "LCSFakeAdd" to add an text which cannot be selected.
//TESH.scrollpos=10
//TESH.alwaysfold=0
//! textmacro Unit takes NAME, ID
function $NAME$ takes nothing returns nothing
call CreateUnit(GetTriggerPlayer(), '$ID$', GetUnitX(gg_unit_nmer_0001), GetUnitY(gg_unit_nmer_0001), 0)
endfunction
//! endtextmacro
scope Mercenarys initializer Init
function exitmerc takes nothing returns nothing
call LCSRem(GetPlayerId(GetTriggerPlayer()))
//Resets the LCS for the player and makes it disappear.
endfunction
//! runtextmacro Unit("footman", "hfoo")
//! runtextmacro Unit("knight", "hkni")
//! runtextmacro Unit("sorc", "hsor")
//! runtextmacro Unit("rifle", "hrif")
//! runtextmacro Unit("priest", "hmpr")
//! runtextmacro Unit("break", "hspt")
private function Actions takes nothing returns nothing
call LCSShow(GetPlayerId(GetTriggerPlayer()), gg_unit_nmer_0001, "Mercenary Camp")
//Shows the LCS (removes the interface) for the player selecting.
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00Mercenary Camp|r: What unit do you want to get?")
//Makes the "Mercenary Camp" ask something.
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Footman", "footman", "")
//Adds a chooseable point to the Player with the label "Footman" and when it's choosed the trigger "footman" is executed.
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Knight", "knight", "")
//Adds a chooseable point to the Player with the label "Knight" and when it's choosed the trigger "knight" is executed.
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Sorceress", "sorc", "")
//Adds a chooseable point to the Player with the label "Sorceress" and when it's choosed the trigger "sorc" is executed.
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Rifleman", "rifle", "")
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Priest", "priest", "")
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Spell Breaker", "break", "")
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Exit", "exitmerc", "")
//Adds a chooseable point to the Player with the label "Exit" and when it's choosed the trigger "exit" is executed.
endfunction
private function Conditions takes nothing returns boolean
return GetTriggerUnit() == gg_unit_nmer_0001
//The Menu is just shown up when the Selected unit is the Merdecenary Camp.
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local integer i = 0
set gg_trg_SELECT = CreateTrigger()
loop
exitwhen i == 12
call TriggerRegisterPlayerUnitEvent(gg_trg_SELECT, Player(i), EVENT_PLAYER_UNIT_SELECTED, null)
set i = i + 1
endloop
call TriggerAddAction( gg_trg_SELECT, function Actions )
call TriggerAddCondition(gg_trg_SELECT, function Conditions)
endfunction
endscope
//TESH.scrollpos=72
//TESH.alwaysfold=0
//! textmacro CreateHero takes NR, ID
function hero$NR$ takes nothing returns nothing
call CreateUnit(GetTriggerPlayer(), '$ID$', GetUnitX(gg_unit_halt_0002), GetUnitY(gg_unit_halt_0002), 0)
endfunction
//! endtextmacro
scope Altar initializer Init
globals
private hashtable HT = InitHashtable()
private integer TempInteger
endglobals
//! runtextmacro CreateHero("1", "Hpal")
//! runtextmacro CreateHero("2", "Hamg")
//! runtextmacro CreateHero("3", "Hmkg")
//! runtextmacro CreateHero("4", "Hblm")
//! runtextmacro CreateHero("5", "Obla")
//! runtextmacro CreateHero("6", "Ofar")
//! runtextmacro CreateHero("7", "Otch")
//! runtextmacro CreateHero("8", "Oshd")
//! runtextmacro CreateHero("9", "Ekee")
//! runtextmacro CreateHero("10", "Emoo")
//! runtextmacro CreateHero("11", "Edem")
//! runtextmacro CreateHero("12", "Ewar")
//! runtextmacro CreateHero("13", "Udea")
//! runtextmacro CreateHero("14", "Ulic")
//! runtextmacro CreateHero("15", "Udre")
//! runtextmacro CreateHero("16", "Ucrl")
function race1 takes nothing returns nothing
call LCSClear(GetPlayerId(GetTriggerPlayer()), false)
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Paladin", "hero1", "") //Hpal
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Archmage", "hero2", "") //Hamg
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Mountain King", "hero3", "") //Hmkg
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Bloodmage", "hero4", "") //Hblm
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Back", "mainmenu", "")
endfunction
function race2 takes nothing returns nothing
call LCSClear(GetPlayerId(GetTriggerPlayer()), false)
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Blademaster", "hero5", "") //Obla
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Far Seer", "hero6", "") //Ofar
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Tauren Chieftain", "hero7", "") //Otch
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Shadow Hunter", "hero8", "") //Oshd
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Back", "mainmenu", "")
endfunction
function race3 takes nothing returns nothing
call LCSClear(GetPlayerId(GetTriggerPlayer()), false)
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Keeper of the Grove", "hero9", "") //Ekee
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Priestess of the Moon", "hero10", "") //Emoo
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Demon Hunter", "hero11", "") //Edem
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Warden", "hero12", "") //Ewar
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Back", "mainmenu", "")
endfunction
function race4 takes nothing returns nothing
call LCSClear(GetPlayerId(GetTriggerPlayer()), false)
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Death Knight", "hero13", "") //Udea
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Lich", "hero14", "") //Ulic
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Dreadlord", "hero15", "") //Udre
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Crypt Lord", "hero16", "") //Ucrl
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Back", "mainmenu", "")
endfunction
function reviving takes nothing returns nothing
local integer i = LCSGetPicked()
call ReviveHero(LoadUnitHandle(HT, GetPlayerId(GetTriggerPlayer()), LCSGetPicked()), GetUnitX(gg_unit_halt_0002), GetUnitY(gg_unit_halt_0002), true)
call LCSOptionClear(GetPlayerId(GetTriggerPlayer()), LCSGetPicked())
loop
exitwhen LoadUnitHandle(HT, GetPlayerId(GetTriggerPlayer()), i) == null
call SaveUnitHandle(HT, GetPlayerId(GetTriggerPlayer()), i, LoadUnitHandle(HT, GetPlayerId(GetTriggerPlayer()), i + 1))
set i = i + 1
endloop
endfunction
private function heroadd takes nothing returns nothing
set TempInteger = TempInteger + 1
call LCSOptionAdd(GetPlayerId(GetOwningPlayer(GetEnumUnit())), GetUnitName(GetEnumUnit()) + " - " + GetHeroProperName(GetEnumUnit()), "reviving", "")
call SaveUnitHandle(HT, GetPlayerId(GetOwningPlayer(GetEnumUnit())), TempInteger, GetEnumUnit())
endfunction
private function gconds takes nothing returns boolean
return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) == true ) and (GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) == 0)
endfunction
function ress takes nothing returns nothing
local group g = CreateGroup()
call FlushChildHashtable(HT, GetPlayerId(GetTriggerPlayer()))
call LCSClear(GetPlayerId(GetTriggerPlayer()), false)
set bj_wantDestroyGroup = true
set TempInteger = 0
call GroupAddGroup(GetUnitsOfPlayerMatching(GetTriggerPlayer(), Condition(function gconds)), g)
call ForGroup( g, function heroadd )
set TempInteger = 0
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Back", "mainmenu", "")
call DestroyGroup(g)
set g = null
endfunction
function exithero takes nothing returns nothing
call FlushChildHashtable(HT, GetPlayerId(GetTriggerPlayer()))
call LCSRem(GetPlayerId(GetTriggerPlayer()))
endfunction
function mainmenu takes nothing returns nothing
call LCSClear(GetPlayerId(GetTriggerPlayer()), false)
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Humans", "race1", "")
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Orcs", "race2", "")
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Nightelfs", "race3", "")
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Undeads", "race4", "")
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Revive", "ress", "")
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Exit", "exithero", "")
endfunction
private function Actions takes nothing returns nothing
call LCSShow(GetPlayerId(GetTriggerPlayer()), gg_unit_halt_0002, "Altar of Kings")
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00Altar of Kings:|r Choose your Race and your Hero")
call mainmenu()
endfunction
private function Conditions takes nothing returns boolean
return GetTriggerUnit() == gg_unit_halt_0002
//The Menu is just shown up when the Selected unit is the Altar.
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local integer i = 0
set gg_trg_HERO = CreateTrigger()
loop
exitwhen i == 12
call TriggerRegisterPlayerUnitEvent(gg_trg_HERO, Player(i), EVENT_PLAYER_UNIT_SELECTED, null)
set i = i + 1
endloop
call TriggerAddCondition(gg_trg_HERO, function Conditions)
call TriggerAddAction( gg_trg_HERO, function Actions )
endfunction
endscope
//TESH.scrollpos=24
//TESH.alwaysfold=0
scope Trolls initializer Init
globals
private integer array amount[12]
endglobals
function exittrolls takes nothing returns nothing
call LCSRem(GetPlayerId(GetTriggerPlayer()))
set amount[GetPlayerId(GetTriggerPlayer())] = 0
endfunction
private function mainscreen takes nothing returns nothing
call LCSFakeAdd(GetPlayerId(GetTriggerPlayer()), "|cffff0000To Spawn the Trolls just select the '[x] Trolls'|r")
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "+", "increasetrolls", "")
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "[" + I2S(amount[GetPlayerId(GetTriggerPlayer())]) + "] Trolls", "spawntrolls", "")
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "-", "decreasetrolls", "")
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Exit", "exittrolls", "")
endfunction
function spawntrolls takes nothing returns nothing
local integer i = 1
loop
exitwhen i > amount[GetPlayerId(GetTriggerPlayer())]
call CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE), 'nftr', GetUnitX(gg_unit_nfh0_0073), GetUnitY(gg_unit_nfh0_0073), 0)
set i = i + 1
endloop
set amount[GetPlayerId(GetTriggerPlayer())] = 0
call LCSClear(GetPlayerId(GetTriggerPlayer()), false)
call mainscreen()
endfunction
private function Actions takes nothing returns nothing
call LCSShow(GetPlayerId(GetTriggerPlayer()), gg_unit_nfh0_0073, "Forest Troll Hut")
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00Forest Troll Hut|r: How much Trolls should be spawned?")
call mainscreen()
endfunction
function decreasetrolls takes nothing returns nothing
set amount[GetPlayerId(GetTriggerPlayer())] = amount[GetPlayerId(GetTriggerPlayer())] - 1
if amount[GetPlayerId(GetTriggerPlayer())] < 0 then
set amount[GetPlayerId(GetTriggerPlayer())] = 0
endif
call LCSOptionChange(GetPlayerId(GetTriggerPlayer()), 3, "[" + I2S(amount[GetPlayerId(GetTriggerPlayer())]) + "] Trolls", true, "", "")
endfunction
function increasetrolls takes nothing returns nothing
set amount[GetPlayerId(GetTriggerPlayer())] = amount[GetPlayerId(GetTriggerPlayer())] + 1
call LCSOptionChange(GetPlayerId(GetTriggerPlayer()), 3, "[" + I2S(amount[GetPlayerId(GetTriggerPlayer())]) + "] Trolls", true, "", "")
endfunction
private function Conditions takes nothing returns boolean
return GetTriggerUnit() == gg_unit_nfh0_0073
endfunction
private function Init takes nothing returns nothing
local integer i = 0
set gg_trg_TROLLSPAWNER = CreateTrigger( )
call TriggerAddAction( gg_trg_TROLLSPAWNER, function Actions )
loop
exitwhen i == 12
call TriggerRegisterPlayerUnitEvent(gg_trg_TROLLSPAWNER, Player(i), EVENT_PLAYER_UNIT_SELECTED, null)
set i = i + 1
endloop
call TriggerAddCondition(gg_trg_TROLLSPAWNER, function Conditions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
//! textmacro Questions takes Q, NR
call LCSOptionAdd(GetPlayerId(GetOwningPlayer(GetTriggerUnit())), "$Q$", "answ$NR$", "answ$NR$")
//! endtextmacro
//! textmacro Answers takes NR, A
function answ$NR$ takes nothing returns nothing
call ClearTextMessagesBJ(bj_FORCE_PLAYER[GetPlayerId(GetOwningPlayer(GetTriggerUnit()))])
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00McThyzer|r: $A$")
call LCSOptionClear(GetPlayerId(GetTriggerPlayer()), LCSGetPicked())
endfunction
//! endtextmacro
scope Talker initializer Init
globals
private boolean questdone = false
endglobals
private function Conditions takes nothing returns boolean
return ( GetOrderTargetUnit() == gg_unit_Ntin_0072 ) and ( DistanceBetweenPoints(GetUnitLoc(gg_unit_Ntin_0072), GetUnitLoc(GetTriggerUnit())) < 600.00 ) and ( IsUnitIdType(GetUnitTypeId(GetTriggerUnit()), UNIT_TYPE_HERO) == true )
endfunction
//! runtextmacro Answers("1", "Thanks, I'm fine.")
//! runtextmacro Answers("2", "I'm sorry, but I've nothing to do for you.")
//! runtextmacro Answers("3", "Mööp!")
//! runtextmacro Answers("4", "Ermm... O.o")
//! runtextmacro Answers("5", "Zzzzzzz")
function answ6 takes nothing returns nothing
call ClearTextMessagesBJ(bj_FORCE_PLAYER[GetPlayerId(GetOwningPlayer(GetTriggerUnit()))])
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00McThyzer|r: Oh realy? Thanks! I'll catch him later.")
set questdone = true
call LCSOptionClear(GetPlayerId(GetTriggerPlayer()), LCSGetPicked())
endfunction
function exittalk takes nothing returns nothing
call ClearTextMessagesBJ(bj_FORCE_PLAYER[GetPlayerId(GetOwningPlayer(GetTriggerUnit()))])
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00McThyzer|r: See you.")
call LCSRem(GetPlayerId(GetTriggerPlayer()))
endfunction
private function Actions takes nothing returns nothing
call LCSShow(GetPlayerId(GetOwningPlayer(GetTriggerUnit())), gg_unit_Ntin_0072, "McThyzer - Triggerer")
call DisplayTextToPlayer(GetOwningPlayer(GetTriggerUnit()), 0, 0, "|cffffcc00McThyzer|r: Hey, yo! What you wanna know?")
//! runtextmacro Questions("How are you?", "1")
//! runtextmacro Questions("Do you have any Quest for me?", "2")
//! runtextmacro Questions("Meep!", "3")
//! runtextmacro Questions("Why you look like Tinker?", "4")
//! runtextmacro Questions("I'm bored :)", "5")
if questdone == false and accepted == true then
//! runtextmacro Questions("I saw an machine in south west, I shall say that he's alive.", "6")
endif
call LCSOptionAdd(GetPlayerId(GetOwningPlayer(GetTriggerUnit())), "Thanks, that was all!", "exittalk", "")
endfunction
//===========================================================================
private function Init takes nothing returns nothing
set gg_trg_TALK = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_TALK, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
call TriggerAddCondition( gg_trg_TALK, Condition( function Conditions ) )
call TriggerAddAction( gg_trg_TALK, function Actions )
endfunction
endscope
//TESH.scrollpos=67
//TESH.alwaysfold=0
scope Dialog initializer Init
globals
boolean accepted = false
endglobals
private function Conditions takes nothing returns boolean
return ( GetOrderTargetUnit() == gg_unit_ncgb_0075 ) and ( DistanceBetweenPoints(GetUnitLoc(gg_unit_ncgb_0075), GetUnitLoc(GetTriggerUnit())) < 600.00 ) and ( IsUnitIdType(GetUnitTypeId(GetTriggerUnit()), UNIT_TYPE_HERO) == true )
endfunction
function exitdialog1 takes nothing returns nothing
call ClearTextMessagesBJ(bj_FORCE_PLAYER[GetPlayerId(GetOwningPlayer(GetTriggerUnit()))])
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00You|r: I dont want to talk with a... machine!")
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00Clockwerk Goblin|r: Bye, stranger.")
call LCSRem(GetPlayerId(GetTriggerPlayer()))
endfunction
function exitdialog takes nothing returns nothing
call ClearTextMessagesBJ(bj_FORCE_PLAYER[GetPlayerId(GetOwningPlayer(GetTriggerUnit()))])
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00You|r: Bye.")
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00Clockwerk Goblin|r: Bye, stranger.")
call LCSRem(GetPlayerId(GetTriggerPlayer()))
endfunction
function diaok takes nothing returns nothing
call LCSClear(GetPlayerId(GetTriggerPlayer()), false)
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00You|r: Ok, I'll do it!")
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00Clockwerk Goblin|r: Thanks...")
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00Hint:|r The master is in the top-right corner.|r")
set accepted = true
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Bye.", "exitdialog", "")
endfunction
function diano takes nothing returns nothing
call LCSClear(GetPlayerId(GetTriggerPlayer()), false)
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00You|r: No, I have other things to do.")
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00Clockwerk Goblin|r: Oh...")
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Bye.", "exitdialog", "")
endfunction
function diatask takes nothing returns nothing
call LCSClear(GetPlayerId(GetTriggerPlayer()), false)
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00Clockwerk Goblin|r: It would be nice if you could go to my master in the North-East and say him, that I am alive. That's all.")
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Ok, I'll do it!", "diaok", "")
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "No, I have other things to do.", "diano", "")
endfunction
function diatas takes nothing returns nothing
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00You|r: What is the task?")
call diatask()
endfunction
function diatas2 takes nothing returns nothing
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00You|r: You talked about an task, what is it?")
call diatask()
endfunction
function diatas3 takes nothing returns nothing
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00You|r: Ah, ok. What's the task?")
call diatask()
endfunction
function diawhydev takes nothing returns nothing
call LCSClear(GetPlayerId(GetTriggerPlayer()), false)
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00You|r: How you got divided?")
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00Clockwerk Goblin|r: Stupid Question, dont you see that Trolls? They are responsible for it!")
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Ah, ok. What's the task?", "diatas3", "")
endfunction
function diawhy takes nothing returns nothing
call LCSClear(GetPlayerId(GetTriggerPlayer()), false)
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00You|r: Why the heck are you here?")
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00Clockwerk Goblin|r: I am here, because I was divided from my creator.")
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "How you got divided?", "diawhydev", "")
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "You talked about an task, what is it?", "diatas2", "")
endfunction
function diawho takes nothing returns nothing
call LCSClear(GetPlayerId(GetTriggerPlayer()), false)
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00You|r: Hello, who are you?")
call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "|cffffcc00Clockwerk Goblin|r: I am an machine, as you see. I have a task for you!")
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "Why the heck are you here?", "diawhy", "")
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "What is the task?", "diatas", "")
call LCSOptionAdd(GetPlayerId(GetTriggerPlayer()), "I dont want to talk with a... machine!", "exitdialog1", "")
endfunction
private function Actions takes nothing returns nothing
if accepted == false then
call LCSShow(GetPlayerId(GetOwningPlayer(GetTriggerUnit())), gg_unit_ncgb_0075, "Clockwerk Goblin")
call DisplayTextToPlayer(GetOwningPlayer(GetTriggerUnit()), 0, 0, "|cffffcc00Clockwerk Goblin|r: Hello, stranger. I have a task for you!")
call LCSOptionAdd(GetPlayerId(GetOwningPlayer(GetTriggerUnit())), "Hello, who are you?", "diawho", "")
call LCSOptionAdd(GetPlayerId(GetOwningPlayer(GetTriggerUnit())), "What is the task?", "diatas", "")
call LCSOptionAdd(GetPlayerId(GetOwningPlayer(GetTriggerUnit())), "I dont want to talk with a... machine!", "exitdialog1", "")
else
call DisplayTextToPlayer(GetOwningPlayer(GetTriggerUnit()), 0, 0, "|cffffcc00Clockwerk Goblin|r: Thank you, stranger.")
endif
endfunction
//===========================================================================
private function Init takes nothing returns nothing
set gg_trg_TALK = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_TALK, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
call TriggerAddCondition( gg_trg_TALK, Condition( function Conditions ) )
call TriggerAddAction( gg_trg_TALK, function Actions )
endfunction
endscope