Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- LUA Script - precede every function and global member with lowercase name of script + '_main'
- -- Moshroom's RPG Menu Script version 1.1
- -- How to edit item/equipment/state tables:
- --
- -- 1) Create dat file to Game Guru\Files\RPG folder to override a default data set (eg. Game Guru\Files\RPG\item_name.dat)
- -- 2) Assign new value for the items. Each row represents one record in the table (eg. row 1 = Healing Potion, row 2 = High Potion, etc.)
- --
- -- Data types:
- --
- -- String (item_name.dat, item_description.dat, weapon_name.dat, armor_name.dat, accessory_name.dat, accessory_description.dat, rpg_state.dat)
- -- Numeric (item_initial.dat, item_target.dat, item_effect.dat, item_price.dat, weapon_initial.dat, weapon_price.dat, armor_initial.dat, armor_price.dat, accessory_target.dat, accessory_effect.dat, accessory_price.dat)
- --
- -- Item Targets: (item_target.dat)
- --
- -- 10 = Add HP
- -- 11 = Cure
- -- 12 = Full Cure
- -- 20 = Add Power
- -- 30 = Add Vitality
- -- 40 = Add Agility
- -- 50 = Add Sight
- -- 80 = Remove all negative status changes
- -- 84 = Remove Feeble
- -- 85 = Remove Weak
- -- 86 = Remove Slow
- -- 87 = Remove Blind
- -- 88 = Remove Venom
- -- 99 = No effect
- --
- -- Equipment Targets: (accessory_target.dat)
- --
- -- Accessory
- -- 20 = Add Power in level up
- -- 30 = Add Vitality in level up
- -- 40 = Add Agility in level up
- -- 41 = Temporarily add Agility
- -- 50 = Add Sight in level up
- -- 51 = Temporarily add Sight
- -- 80 = Prevent all negative status changes
- -- 84 = Prevent Feeble
- -- 85 = Prevent Weak
- -- 86 = Prevent Slow
- -- 87 = Prevent Blind
- -- 88 = Prevent Venom
- -- 99 = No effect
- --
- -- Weapon = Temporarily add Power (Weapon class only)
- -- Armor = Temporarily add Vitality (Armor class only)
- --
- -- States: (rpg_state.dat)
- -- 1 = Normal - no effect
- -- 2 = Critical - no effect
- -- 3 = Overdrive - no effect
- -- 4 = Feeble - reduce Power to 1
- -- 5 = Weak - reduce Vitality to 1
- -- 6 = Slow - reduce Agility to 1
- -- 7 = Blind - reduce Sight to 1
- -- 8 = Venom - gradually reduce HP until 1
- -- Define flags to communicate with other RPG scripts
- FLAG_MENU = 1
- -- Define the constants
- SAVE_DISTANCE = 100
- TIME_W = 145
- TIME_B = 200
- DIV_PARAM = 25
- EQ_PARAM = 2
- LEVEL_PARAM_A = 105
- LEVEL_PARAM_B = 75
- LEVEL_PARAM_C = 5
- NUM_DATASETS = 18
- NUM_INV = 14
- NUM_STATES = 8
- NUM_SLOTS = 7
- NUM_COUNTERS = 9999
- -- Define table for ActiveMenu
- ActiveMenu = {}
- -- Define tables for inventory
- InvItem = {}
- InvWeapon = {}
- InvArmor = {}
- InvAccessory = {}
- Item_Slot = {}
- Weapon_Slot = {}
- Armor_Slot = {}
- Accessory_Slot = {}
- -- Define tables for usable items
- Item = {"Healing Potion", "High Potion", "Boost Potion", "Elixir", "Antidote", "Stimulant", "Tonic", "Hourglass", "Eye drops", "Panacea", "Power Source", "Vitality Source", "Agility Source", "Sight Source"}
- Item_Target = {11, 11, 10, 12, 88, 84, 85, 86, 87, 80, 20, 30, 40, 50}
- Item_Effect = {25, 50, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
- Item_Description = {"Restores 25 HP.", "Restores 50 HP.", "Adds 10 HP. May inflict overdrive.", "Fully restores HP.", "Cures Venom.", "Cures Feeble.", "Cures Weak.", "Cures Slow.", "Cures Blind.", "Cures all status ailments.", "Raises Power by 1.", "Raises Vitality by 1.", "Raises Agility by 1.", "Raises Sight by 1."}
- Item_Price = {100, 200, 500, 1000, 300, 290, 280, 240, 230, 900, 5000, 5000, 5000, 5000}
- -- Define tables for equipment
- Weapon = {"Wooden Rod", "Bronze Rod", "Iron Staff", "Steel Staff", "Crozier", "Holy Sceptre"}
- Weapon_Price = {300, 1000, 2100, 4000, 5500, 8000}
- Armor = {"Burlap", "Tunic", "Vagrant Robe", "Leather Robe", "Magic Cape", "Saint Cape"}
- Armor_Price = {400, 900, 2200, 4200, 5900, 7700}
- Accessory = {"Hermes Shoes", "Spyglass", "Beaked Mask", "Gauntlet", "Cuirass", "Pendulum", "Spectacles", "Holy Pendant", "Sorcerer's Ring", "Warrior's Ring", "Thief's Ring", "Archer's Ring"}
- Accessory_Target = {41, 51, 88, 84, 85, 86, 87, 80, 20, 30, 40, 50}
- Accessory_Effect = {10, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
- Accessory_Description = {"Improves Agility.", "Improves Sight.", "Prevents Venom.", "Prevents Feeble.", "Prevents Weak.", "Prevents Slow.", "Prevents Blind.", "Prevents all status ailments.", "Raises probability of Power growth in level up.", "Raises probability of Vitality growth in level up.", "Raises probability of Agility growth in level up.", "Raises probability of Sight growth in level up."}
- Accessory_Price = {2000, 2000, 2200, 2500, 2500, 1900, 1800, 9000, 1000, 1000, 1000, 1000}
- -- Define table for status changes
- State = {}
- -- Define tables to read RPG data
- Data_File = {"RPG\\item_name.dat","RPG\\item_target.dat","RPG\\item_effect.dat","RPG\\item_description.dat","RPG\\item_price.dat","RPG\\weapon_name.dat","RPG\\weapon_price.dat","RPG\\armor_name.dat","RPG\\armor_price.dat","RPG\\accessory_name.dat","RPG\\accessory_target.dat","RPG\\accessory_effect.dat","RPG\\accessory_description.dat","RPG\\accessory_price.dat","RPG\\item_initial.dat","RPG\\weapon_initial.dat","RPG\\armor_initial.dat","RPG\\accessory_initial.dat","RPG\\rpg_state.dat"}
- -- Define table for save/load system
- Counter = {}
- DCounter = {}
- QCounter = {}
- HP = {}
- EntityX = {}
- EntityY = {}
- EntityZ = {}
- EntityName = {}
- -- Define table for menu commands
- ActiveCommand = {}
- NumCommands = {}
- function moshroom_rpg_menu_init_name(e, name)
- ActiveMenu[e] = 0
- ActiveSlot = 0
- BtnTime = 0
- ShopActive = 0
- MenuActive = 0
- -- Init the clock
- TimeCounter = 0
- TimeSecond = 0
- TimeMinute = 0
- TimeHour = 0
- TimeInit = 0
- UGTimer = 0
- -- Init the options
- CursorPosition = 1
- TextSize = 1
- FrontPageText = 1
- MessageWindow = 1
- BMessageWindow = 1
- -- Init the battle message
- BTimed = 0
- BMsgTime = 0
- BCountTime = 0
- BMessageString = 0
- BMessageTime = 0
- -- Init the RPG stats
- g_RPG_Level = 1
- g_RPG_EXP = 0
- g_RPG_Threshold = 0
- g_RPG_ToNextLevel = 0
- g_RPG_SpellPower = 100
- g_RPG_Vitality = 100
- g_RPG_Agility = 100
- g_RPG_Sight = 100
- g_RPG_State = 1
- g_RPG_Gold = 0
- -- Init the equipment
- g_Eq_Weapon = 0
- g_Eq_Armor = 0
- g_Eq_Accessory = 0
- g_Eq_Accessory_Target = 0
- g_Eq_Accessory_Effect = 0
- -- Init the abnormal states
- g_RPG_FeeblePenalty = 0
- g_RPG_WeakPenalty = 0
- g_RPG_SlowPenalty = 0
- g_RPG_BlindPenalty = 0
- -- Init the save/load system
- SavePoint = 0
- ActiveSlot = 0
- SavePhase = 0
- LoadPhase = 0
- end
- -- Control menu section with 1 column
- function Command_One(e)
- -- Initiate the command
- if ActiveCommand[ActiveMenu[e]] == nil then
- ActiveCommand[ActiveMenu[e]] = 1
- end
- -- Update menu when player presses up/down
- if g_KeyPressW == 1 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_W
- ActiveCommand[ActiveMenu[e]] = ActiveCommand[ActiveMenu[e]] - 1
- end
- if g_KeyPressS == 1 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_W
- ActiveCommand[ActiveMenu[e]] = ActiveCommand[ActiveMenu[e]] + 1
- end
- if g_MouseWheel > 0 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_W
- ActiveCommand[ActiveMenu[e]] = ActiveCommand[ActiveMenu[e]] - 1
- end
- if g_MouseWheel < 0 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_W
- ActiveCommand[ActiveMenu[e]] = ActiveCommand[ActiveMenu[e]] + 1
- end
- -- Set limits for the command - Wrap
- if ActiveCommand[ActiveMenu[e]] > NumCommands[ActiveMenu[e]] then
- ActiveCommand[ActiveMenu[e]] = 1
- end
- if ActiveCommand[ActiveMenu[e]] < 1 then
- ActiveCommand[ActiveMenu[e]] = NumCommands[ActiveMenu[e]]
- end
- end
- -- Control menu section with 2 columns
- function Command_Two(e)
- -- Initiate the command
- if ActiveCommand[ActiveMenu[e]] == nil then
- ActiveCommand[ActiveMenu[e]] = 1
- end
- -- Update menu when player presses up/down/left/right
- if g_KeyPressA == 1 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_W
- ActiveCommand[ActiveMenu[e]] = ActiveCommand[ActiveMenu[e]] - 1
- end
- if g_KeyPressW == 1 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_W
- ActiveCommand[ActiveMenu[e]] = ActiveCommand[ActiveMenu[e]] - 2
- end
- if g_KeyPressD == 1 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_W
- ActiveCommand[ActiveMenu[e]] = ActiveCommand[ActiveMenu[e]] + 1
- end
- if g_KeyPressS == 1 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_W
- ActiveCommand[ActiveMenu[e]] = ActiveCommand[ActiveMenu[e]] + 2
- end
- if g_MouseWheel > 0 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_W
- ActiveCommand[ActiveMenu[e]] = ActiveCommand[ActiveMenu[e]] - 1
- end
- if g_MouseWheel < 0 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_W
- ActiveCommand[ActiveMenu[e]] = ActiveCommand[ActiveMenu[e]] + 1
- end
- -- Set limits for the command - No wrap
- if ActiveCommand[ActiveMenu[e]] > NumCommands[ActiveMenu[e]] then
- ActiveCommand[ActiveMenu[e]] = NumCommands[ActiveMenu[e]]
- end
- if ActiveCommand[ActiveMenu[e]] < 1 then
- ActiveCommand[ActiveMenu[e]] = 1
- end
- end
- function FieldMessage(e, WindowHeight, MessageString1, MessageString2, MessageType)
- if MenuActive == 0 and ShopActive == 0 then
- -- If MessageWindow is set on, show it
- if MessageWindow == 1 then
- Panel(20,90 - 5 * WindowHeight,80,95)
- -- Show who's speaking
- Text(22,90 - 5 * (WindowHeight - 1),TextSize,"<" .. EntityName[e] .. ">")
- -- Show the message
- if MessageType == 0 then
- Text(22,90 - 5 * (WindowHeight - 2),TextSize,MessageString1)
- Text(22,90 - 5 * (WindowHeight - 3),TextSize,MessageString2)
- end
- if MessageType == 1 then
- Text(22,90 - 5 * (WindowHeight - 2),TextSize,MessageString1)
- TextCenterOnX(50,90 - 5 * (WindowHeight - 3),TextSize,"-- " .. MessageString2 .. " --")
- end
- else
- Prompt(MessageString1 .. " " .. MessageString2 .. ".")
- end
- end
- end
- function BMWindow()
- if BTimed == 1 then
- if BCountTime == 0 then
- BCountTime = g_Time
- BMsgTime = g_Time + BMessageTime
- end
- -- If the timer is running, use it
- if BCountTime ~= 0 then
- BCountTime = g_Time
- Panel(20,85,80,95)
- TextCenterOnX(50,90,TextSize,BMessageString)
- end
- -- If the the timer reaches goal, reset it and deactivate prompt
- if BCountTime > BMsgTime then
- BTimed = 0
- BMsgTime = 0
- BCountTime = 0
- end
- end
- end
- function Load_RPG_Data()
- -- Read data from the dataset defined earlier
- for DataRead = 1,NUM_DATASETS do
- local File = io.open(Data_File[DataRead], "r")
- if File ~= nil then
- for Line = 1,NUM_INV do
- -- 1 = Item Name
- if DataRead == 1 then
- Item[Line] = File:read("*l")
- if Item[Line] == nil then
- Item[Line] = "Package"
- end
- end
- -- 2 = Item Target
- if DataRead == 2 then
- Item_Target[Line] = tonumber(File:read("*l"))
- if Item_Target[Line] == nil then
- Item_Target[Line] = 99
- end
- end
- -- 3 = Item Effect
- if DataRead == 3 then
- Item_Effect[Line] = tonumber(File:read("*l"))
- if Item_Effect[Line] == nil then
- Item_Effect[Line] = 1
- end
- end
- -- 4 = Item Description
- if DataRead == 4 then
- Item_Description[Line] = File:read("*l")
- if Item_Description[Line] == nil then
- Item_Description[Line] = "Quest item."
- end
- end
- -- 5 = Item Price
- if DataRead == 5 then
- Item_Price[Line] = tonumber(File:read("*l"))
- if Item_Price[Line] == nil then
- Item_Price[Line] = 10
- end
- end
- -- 6 = Weapon Name
- if DataRead == 6 then
- Weapon[Line] = File:read("*l")
- if Weapon[Line] == nil then
- Weapon[Line] = "Staff"
- end
- end
- -- 7 = Weapon Price
- if DataRead == 7 then
- Weapon_Price[Line] = tonumber(File:read("*l"))
- if Weapon_Price[Line] == nil then
- Weapon_Price[Line] = 10
- end
- end
- -- 8 = Armor Name
- if DataRead == 8 then
- Armor[Line] = File:read("*l")
- if Armor[Line] == nil then
- Armor[Line] = "Armor"
- end
- end
- -- 9 = Weapon Price
- if DataRead == 9 then
- Armor_Price[Line] = tonumber(File:read("*l"))
- if Armor_Price[Line] == nil then
- Armor_Price[Line] = 10
- end
- end
- -- 10 = Accessory Name
- if DataRead == 10 then
- Accessory[Line] = File:read("*l")
- if Accessory[Line] == nil then
- Accessory[Line] = "Ornament"
- end
- end
- -- 11 = Accessory Target
- if DataRead == 11 then
- Accessory_Target[Line] = tonumber(File:read("*l"))
- if Accessory_Target[Line] == nil then
- Accessory_Target[Line] = 99
- end
- end
- -- 12 = Accessory Effect
- if DataRead == 12 then
- Accessory_Effect[Line] = tonumber(File:read("*l"))
- if Accessory_Effect[Line] == nil then
- Accessory_Effect[Line] = 1
- end
- end
- -- 13 = Accessory Description
- if DataRead == 13 then
- Accessory_Description[Line] = File:read("*l")
- if Accessory_Description[Line] == nil then
- Accessory_Description[Line] = "Ordinary accessory."
- end
- end
- -- 14 = Accessory Price
- if DataRead == 14 then
- Accessory_Price[Line] = tonumber(File:read("*l"))
- if Accessory_Price[Line] == nil then
- Accessory_Price[Line] = 10
- end
- end
- -- 15 = Initial Item
- if DataRead == 15 then
- InvItem[Line] = tonumber(File:read("*l"))
- if InvItem[Line] == nil or InvItem[Line] == 0 then
- InvItem[Line] = nil
- end
- end
- -- 16 = Initial Weapon
- if DataRead == 16 then
- InvWeapon[Line] = tonumber(File:read("*l"))
- if InvWeapon[Line] == nil or InvWeapon[Line] == 0 then
- InvWeapon[Line] = nil
- end
- end
- -- 17 = Initial Armor
- if DataRead == 17 then
- InvArmor[Line] = tonumber(File:read("*l"))
- if InvArmor[Line] == nil or InvArmor[Line] == 0 then
- InvArmor[Line] = nil
- end
- end
- -- 18 = Initial Accessory
- if DataRead == 18 then
- InvAccessory[Line] = tonumber(File:read("*l"))
- if InvAccessory[Line] == nil or InvAccessory[Line] == 0 then
- InvAccessory[Line] = nil
- end
- end
- end
- File:close()
- else
- -- 15 - Default initial item list depends on other RPG scripts in use
- if DataRead == 15 then
- if FLAG_SHOP == nil and FLAG_CHEST == nil and FLAG_AI == nil then
- InvItem = {5, 2, 1, 1}
- elseif FLAG_SHOP == nil and FLAG_CHEST == nil and FLAG_AI == 1 then
- InvItem = {5, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
- end
- end
- -- 16 - Default initial weapon list depends on other RPG scripts in use
- if DataRead == 16 then
- if FLAG_SHOP == nil and FLAG_CHEST == nil then
- InvWeapon = {1, 1}
- end
- end
- -- 17 - Default initial armor list depends on other RPG scripts in use
- if DataRead == 17 then
- if FLAG_SHOP == nil and FLAG_CHEST == nil then
- InvArmor = {1, 1}
- end
- end
- -- 18 - Default initial accessory list depends on other RPG scripts in use
- if DataRead == 18 then
- if FLAG_SHOP == nil and FLAG_CHEST == nil then
- InvAccessory = {0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1}
- end
- end
- end
- end
- -- If there is state dat, read it
- local SFile = io.open(Data_File[19], "r")
- if SFile == nil then
- -- If there is no file, use the default values
- State = {"Normal", "Critical", "Overdrive", "Feeble", "Weak", "Slow", "Blind", "Venom"}
- else
- -- If there is a File, read it and store it to State table
- local SLine = 1
- -- Store as many states as there are in the file
- while true do
- State[SLine] = SFile:read("*l")
- if State[SLine] == nil then break end
- SLine = SLine + 1
- end
- SFile:close()
- end
- end
- function RPG_State()
- if g_RPG_State < 4 then
- -- If player is not on abnormal status, show status depending on HP
- if g_PlayerHealth <= g_RPG_MAXHP and g_PlayerHealth >= g_RPG_MAXHP / 4 then
- g_RPG_State = 1 -- Normal
- end
- if g_PlayerHealth < g_RPG_MAXHP / 4 then
- g_RPG_State = 2 -- Critical
- end
- if g_PlayerHealth > g_RPG_MAXHP then
- g_RPG_State = 3 -- Overdrive
- end
- -- Set penalties as 0
- g_RPG_FeeblePenalty = 0
- g_RPG_WeakPenalty = 0
- g_RPG_SlowPenalty = 0
- g_RPG_BlindPenalty = 0
- else
- if g_RPG_State == 4 then -- Feeble
- g_RPG_FeeblePenalty = g_RPG_SpellPower - DIV_PARAM
- g_RPG_WeakPenalty = 0
- g_RPG_SlowPenalty = 0
- g_RPG_BlindPenalty = 0
- end
- if g_RPG_State == 5 then -- Weak
- g_RPG_WeakPenalty = tonumber(g_RPG_Vitality - DIV_PARAM)
- g_RPG_FeeblePenalty = 0
- g_RPG_SlowPenalty = 0
- g_RPG_BlindPenalty = 0
- end
- if g_RPG_State == 6 then -- Slow
- g_RPG_SlowPenalty = g_RPG_Agility - DIV_PARAM
- g_RPG_FeeblePenalty = 0
- g_RPG_WeakPenalty = 0
- g_RPG_BlindPenalty = 0
- end
- if g_RPG_State == 7 then -- Blind
- g_RPG_BlindPenalty = g_RPG_Sight - DIV_PARAM
- g_RPG_FeeblePenalty = 0
- g_RPG_WeakPenalty = 0
- g_RPG_SlowPenalty = 0
- end
- if g_RPG_State == 8 then -- Venom
- g_RPG_FeeblePenalty = 0
- g_RPG_WeakPenalty = 0
- g_RPG_SlowPenalty = 0
- g_RPG_BlindPenalty = 0
- Venom()
- end
- end
- end
- function Venom()
- if VTimed == nil or VTimed == 1 then
- -- Reset the clock
- HurtTime = g_Time + 2500
- VTimed = 2
- end
- if VTimed == 2 then
- -- Run the clock
- VCountTime = g_Time
- if VCountTime > HurtTime and g_PlayerHealth > 1 then
- SetPlayerHealth(g_PlayerHealth - 1)
- VTimed = 1
- end
- end
- -- If Player gets killed, remove Venom
- if g_PlayerHealth == 0 then
- g_RPG_State = 1
- end
- end
- function RPG_Timer()
- -- Run the timer
- if TimeCounter < g_Time then
- TimeSecond = TimeSecond + 1
- TimeCounter = g_Time + 1000
- end
- if TimeSecond >= 60 then
- TimeMinute = TimeMinute + 1
- TimeSecond = 0
- end
- if TimeMinute >= 60 then
- TimeHour = TimeHour + 1
- TimeMinute = 0
- end
- end
- function moshroom_rpg_menu_main(e)
- -- INITIATION --
- -- Initiate RPG Module parts that can't be initiated in the init() function
- if g_RPG_MAXHP == nil then
- g_RPG_MAXHP = g_PlayerHealth
- end
- if TimeInit == 0 then
- Load_RPG_Data()
- TimeInit = 1
- end
- -- BACKGROUND PROCESS --
- -- Process player state and timer
- RPG_State()
- RPG_Timer()
- -- Count leveling variables
- g_RPG_Threshold = g_RPG_Level * LEVEL_PARAM_A + (g_RPG_Level - 1) * LEVEL_PARAM_B + (g_RPG_Level - 2) * LEVEL_PARAM_C
- g_RPG_ToNextLevel = g_RPG_Threshold - g_RPG_EXP
- -- Set accessory target and effect
- g_Eq_Accessory_Target = Accessory_Target[g_Eq_Accessory]
- g_Eq_Accessory_Effect = Accessory_Effect[g_Eq_Accessory]
- -- Process Battle Message Window
- if BMessageWindow == 1 then
- BMWindow()
- end
- -- Test the distance to the Save point
- PlayerDist = GetPlayerDistance(e)
- -- MENU ACCESS --
- if ActiveMenu[e] == 0 then
- -- Access menu by pressing Q button
- if g_InKey == "q" and g_Time > BtnTime and ShopActive == 0 or g_InKey == "Q" and g_Time > BtnTime and ShopActive == 0 or g_MouseClick == 4 and g_Time > BtnTime and ShopActive == 0 then
- BtnTime = g_Time + TIME_B
- OX = g_PlayerPosX
- OY = g_PlayerPosY
- OZ = g_PlayerPosZ
- UGTimer = g_Time + 10
- MenuActive = 1
- end
- if MenuActive == 1 and UGTimer < g_Time then
- if OX == g_PlayerPosX and OY == g_PlayerPosY and OZ == g_PlayerPosZ then
- PlayNon3DSound(e,1)
- FreezePlayer()
- FreezeAI()
- HideHuds()
- ActivateMouse()
- ActiveMenu[e] = 1
- else
- PromptDuration("To access RPG menu, stop and press Q or middle mouse button.",500)
- MenuActive = 0
- end
- end
- else
- -- Draw the menu base: Global panels
- -- Draw top panel
- Panel(0,0,100,10)
- -- Draw the left panel
- TextCenterOnX(12.5,20,TextSize,"Inventory")
- TextCenterOnX(12.5,30,TextSize,"Equipment")
- TextCenterOnX(12.5,40,TextSize,"Status")
- TextCenterOnX(12.5,50,TextSize,"Options")
- Panel(0,10,25,80)
- -- Draw time panel
- Panel(0,80,25,90)
- TextCenterOnX(12.5,85,TextSize,"Play Time: " .. TimeHour .. ":" .. TimeMinute .. ":" .. TimeSecond)
- -- Draw the main panel
- Panel(25,10,100,90)
- -- Draw bottom panel
- Panel(0,90,100,100)
- end
- -- MENUS --
- -- 1: Main menu
- if ActiveMenu[e] == 1 then
- -- Initiate the active command
- NumCommands[ActiveMenu[e]] = 4
- Command_One(e)
- -- Top panel text
- TextCenterOnX(50,5,TextSize,"Main menu")
- -- Draw main panel content
- if FrontPageText == 1 then
- Text(30,20,TextSize,"Navigate in the RPG menu by using A, S, W and D keys or mouse wheel.")
- Text(30,25,TextSize,"Press E or left mouse button to select, press Q or right mouse button to exit.")
- end
- Panel(0,10,25,80)
- -- Draw cursor
- Panel(1,15 + 10 * (ActiveCommand[ActiveMenu[e]] - 1),24,25 + 10 * (ActiveCommand[ActiveMenu[e]] - 1))
- TextCenterOnX(12.5,20,TextSize,"Inventory")
- TextCenterOnX(12.5,30,TextSize,"Equipment")
- TextCenterOnX(12.5,40,TextSize,"Status")
- TextCenterOnX(12.5,50,TextSize,"Options")
- -- Show text on the bottom panel
- if ActiveCommand[ActiveMenu[e]] == 1 then
- TextCenterOnX(50,95,TextSize,"Press E to access inventory.")
- end
- if ActiveCommand[ActiveMenu[e]] == 2 then
- TextCenterOnX(50,95,TextSize,"Press E to access equipment.")
- end
- if ActiveCommand[ActiveMenu[e]] == 3 then
- TextCenterOnX(50,95,TextSize,"Press E to access status.")
- end
- if ActiveCommand[ActiveMenu[e]] == 4 then
- TextCenterOnX(50,95,TextSize,"Press E to configure your settings.")
- end
- if ActiveCommand[ActiveMenu[e]] == 5 then
- TextCenterOnX(50,95,TextSize,"Press E to save your process.")
- end
- if ActiveCommand[ActiveMenu[e]] == 6 then
- TextCenterOnX(50,95,TextSize,"Press E to load a saved game.")
- end
- -- Move to the next menu by pressing E button
- if g_KeyPressE == 1 and g_Time > BtnTime or g_MouseClick == 1 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_B
- ActiveMenu[e] = ActiveCommand[ActiveMenu[e]] + 1
- end
- -- Exit menu by pressing Q button
- if g_InKey == "q" and g_Time > BtnTime or g_InKey == "Q" and g_Time > BtnTime or g_MouseClick == 2 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_B
- UnFreezePlayer()
- UnFreezeAI()
- ShowHuds()
- DeactivateMouse()
- if CursorPosition == 1 then
- ActiveCommand[ActiveMenu[e]] = 1
- end
- ActiveMenu[e] = 0
- MenuActive = 0
- end
- end
- -- 2: Item menu
- if ActiveMenu[e] == 2 then
- -- Initiate the active command
- NumCommands[ActiveMenu[e]] = NUM_INV
- Command_Two(e)
- -- Top panel text
- TextCenterOnX(50,5,TextSize,"Inventory")
- -- Draw the main panel
- Panel(25,10,100,90)
- -- Draw cursor
- if (ActiveCommand[ActiveMenu[e]] % 2 == 0) then
- cx = 67.5
- cy = 5 + 10 * (ActiveCommand[ActiveMenu[e]] / 2)
- else
- cx = 28
- cy = 5 + 10 * ((ActiveCommand[ActiveMenu[e]] + 1) / 2)
- end
- Panel(cx,cy,cx + 29.75,cy + 10)
- -- Draw the item list
- InvRead = 0
- ItemSlot = 0
- while InvRead < NUM_INV do
- InvRead = InvRead + 1
- if InvItem[InvRead] == nil then
- -- Dispose next item slot (to prevent bug that duplicates last item slot of the inventory if all of an item from a middle slot is used)
- Item_Slot[ItemSlot + 1] = nil
- else
- -- If item count equals number, activate item slot
- ItemSlot = ItemSlot + 1
- -- Draw text
- if ItemSlot % 2 == 0 then
- tx = 69.5
- ty = 10 + 10 * (ItemSlot / 2)
- else
- tx = 30
- ty = 10 + 10 * ((ItemSlot + 1) / 2)
- end
- Text(tx,ty,TextSize,Item[InvRead])
- Text(tx + 23,ty,TextSize,InvItem[InvRead])
- -- Save the item id to table Item_Slot
- Item_Slot[ItemSlot] = InvRead
- end
- end
- -- Draw the bottom panel text
- if InvItem[Item_Slot[ActiveCommand[ActiveMenu[e]]]] ~= nil then
- if Item_Target[Item_Slot[ActiveCommand[ActiveMenu[e]]]] < 20 then
- TextCenterOnX(50,95,TextSize,Item_Description[Item_Slot[ActiveCommand[ActiveMenu[e]]]] .. " (Current HP: " .. g_PlayerHealth .. " / " .. g_RPG_MAXHP .. ")")
- elseif Item_Target[Item_Slot[ActiveCommand[ActiveMenu[e]]]] == 20 then
- TextCenterOnX(50,95,TextSize,Item_Description[Item_Slot[ActiveCommand[ActiveMenu[e]]]] .. " (Current Power: " .. g_RPG_SpellPower / DIV_PARAM .. ")")
- elseif Item_Target[Item_Slot[ActiveCommand[ActiveMenu[e]]]] == 30 then
- TextCenterOnX(50,95,TextSize,Item_Description[Item_Slot[ActiveCommand[ActiveMenu[e]]]] .. " (Current Vitality: " .. g_RPG_Vitality / DIV_PARAM .. ")")
- elseif Item_Target[Item_Slot[ActiveCommand[ActiveMenu[e]]]] == 40 then
- TextCenterOnX(50,95,TextSize,Item_Description[Item_Slot[ActiveCommand[ActiveMenu[e]]]] .. " (Current Agility: " .. g_RPG_Agility / DIV_PARAM .. ")")
- elseif Item_Target[Item_Slot[ActiveCommand[ActiveMenu[e]]]] == 50 then
- TextCenterOnX(50,95,TextSize,Item_Description[Item_Slot[ActiveCommand[ActiveMenu[e]]]] .. " (Current Sight: " .. g_RPG_Sight / DIV_PARAM .. ")")
- elseif Item_Target[Item_Slot[ActiveCommand[ActiveMenu[e]]]] >= 80 and Item_Target[Item_Slot[ActiveCommand[ActiveMenu[e]]]] < 90 then
- TextCenterOnX(50,95,TextSize,Item_Description[Item_Slot[ActiveCommand[ActiveMenu[e]]]] .. " (Current State: " .. State[g_RPG_State] .. ")")
- else
- TextCenterOnX(50,95,TextSize,Item_Description[Item_Slot[ActiveCommand[ActiveMenu[e]]]])
- end
- -- Use an item by pressing E
- if g_KeyPressE == 1 and g_Time > BtnTime and InvItem[Item_Slot[ActiveCommand[ActiveMenu[e]]]] > 0 or g_MouseClick == 1 and g_Time > BtnTime and InvItem[Item_Slot[ActiveCommand[ActiveMenu[e]]]] > 0 then
- PlayNon3DSound(e,1)
- -- Test whether item is usable
- if Item_Target[Item_Slot[ActiveCommand[ActiveMenu[e]]]] ~= 99 then
- -- Remove the item from the inventory
- InvItem[Item_Slot[ActiveCommand[ActiveMenu[e]]]] = InvItem[Item_Slot[ActiveCommand[ActiveMenu[e]]]] - 1
- end
- -- The effect depends on Item_Target
- if Item_Target[Item_Slot[ActiveCommand[ActiveMenu[e]]]] == 10 then
- -- Add HP
- SetPlayerHealth(g_PlayerHealth + Item_Effect[Item_Slot[ActiveCommand[ActiveMenu[e]]]])
- elseif Item_Target[Item_Slot[ActiveCommand[ActiveMenu[e]]]] == 11 then
- -- Only restore HP up to MAXHP
- if g_PlayerHealth + Item_Effect[Item_Slot[ActiveCommand[ActiveMenu[e]]]] <= g_RPG_MAXHP then
- SetPlayerHealth(g_PlayerHealth + Item_Effect[Item_Slot[ActiveCommand[ActiveMenu[e]]]])
- else
- if g_PlayerHealth < g_RPG_MAXHP then
- SetPlayerHealth(g_RPG_MAXHP)
- end
- end
- elseif Item_Target[Item_Slot[ActiveCommand[ActiveMenu[e]]]] == 12 then
- -- Set HP as MAXHP
- if g_PlayerHealth < g_RPG_MAXHP then
- SetPlayerHealth(g_RPG_MAXHP)
- end
- elseif Item_Target[Item_Slot[ActiveCommand[ActiveMenu[e]]]] == 20 then
- -- Add SpellPower and SetPlayerPower to increase fireball size
- g_RPG_SpellPower = g_RPG_SpellPower + Item_Effect[Item_Slot[ActiveCommand[ActiveMenu[e]]]] * DIV_PARAM
- SetPlayerPower(e, g_RPG_SpellPower)
- elseif Item_Target[Item_Slot[ActiveCommand[ActiveMenu[e]]]] == 30 then
- -- Add Vitality
- g_RPG_Vitality = g_RPG_Vitality + Item_Effect[Item_Slot[ActiveCommand[ActiveMenu[e]]]] * DIV_PARAM
- elseif Item_Target[Item_Slot[ActiveCommand[ActiveMenu[e]]]] == 40 then
- -- Add Agility
- g_RPG_Agility = g_RPG_Agility + Item_Effect[Item_Slot[ActiveCommand[ActiveMenu[e]]]] * DIV_PARAM
- elseif Item_Target[Item_Slot[ActiveCommand[ActiveMenu[e]]]] == 50 then
- -- Add Sight
- g_RPG_Sight = g_RPG_Sight + Item_Effect[Item_Slot[ActiveCommand[ActiveMenu[e]]]] * DIV_PARAM
- elseif Item_Target[Item_Slot[ActiveCommand[ActiveMenu[e]]]] == 80 then
- -- Remove abnormal status
- g_RPG_State = 1
- elseif Item_Target[Item_Slot[ActiveCommand[ActiveMenu[e]]]] == 84 then
- -- Remove Feeble
- if g_RPG_State == 4 then
- g_RPG_State = 1
- end
- elseif Item_Target[Item_Slot[ActiveCommand[ActiveMenu[e]]]] == 85 then
- -- Remove Weak
- if g_RPG_State == 5 then
- g_RPG_State = 1
- end
- elseif Item_Target[Item_Slot[ActiveCommand[ActiveMenu[e]]]] == 86 then
- -- Remove Slow
- if g_RPG_State == 6 then
- g_RPG_State = 1
- end
- elseif Item_Target[Item_Slot[ActiveCommand[ActiveMenu[e]]]] == 87 then
- -- Remove Blind
- if g_RPG_State == 7 then
- g_RPG_State = 1
- end
- elseif Item_Target[Item_Slot[ActiveCommand[ActiveMenu[e]]]] == 88 then
- -- Remove Venom
- if g_RPG_State == 8 then
- g_RPG_State = 1
- end
- end
- -- Reset the clock
- BtnTime = g_Time + TIME_B
- end
- end
- -- Exit menu by pressing Q button
- if g_InKey == "q" and g_Time > BtnTime or g_InKey == "Q" and g_Time > BtnTime or g_MouseClick == 2 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_B
- -- Dispose the Item_Slot table
- for Disposer = 1,NUM_INV do
- Item_Slot[Disposer] = nil
- end
- for Disposer = 1,NUM_INV do
- if InvItem[Disposer] == 0 then
- InvItem[Disposer] = nil
- end
- end
- if CursorPosition == 1 then
- ActiveCommand[ActiveMenu[e]] = 1
- end
- ActiveMenu[e] = 1
- end
- end
- -- 3: Equip menu
- if ActiveMenu[e] == 3 then
- -- Only show Equip menu in 3rd person view and if there is at least one RPG compatible AI on the map
- if FLAG_AI == 1 and g_PlayerThirdPerson == 1 then
- -- Initiate the active command
- NumCommands[ActiveMenu[e]] = 3
- Command_One(e)
- -- Top panel text
- TextCenterOnX(50,5,TextSize,"Equipment")
- -- Draw the main panel
- Panel(25,10,100,90)
- -- Draw the cursor
- Panel(28,15 + 10 * (ActiveCommand[ActiveMenu[e]] - 1),59.75,25 + 10 * (ActiveCommand[ActiveMenu[e]] - 1))
- -- Draw the base statistics
- Text(67.5,20,TextSize,"HP:")
- Text(67.5,25,TextSize,"Power:")
- Text(67.5,30,TextSize,"Vitality:")
- Text(67.5,35,TextSize,"Agility:")
- Text(67.5,40,TextSize,"Sight:")
- Text(30,20,TextSize,"Weapon:")
- Text(30,30,TextSize,"Armor:")
- Text(30,40,TextSize,"Accessory:")
- Text(82.5,20,TextSize,g_PlayerHealth .. " / " .. g_RPG_MAXHP)
- -- Count player statistics by level and equipment
- Text(82.5,25,TextSize,g_RPG_SpellPower / DIV_PARAM + g_Eq_Weapon * EQ_PARAM)
- Text(82.5,30,TextSize,g_RPG_Vitality / DIV_PARAM + g_Eq_Armor * EQ_PARAM)
- if g_Eq_Accessory_Target == 41 then
- -- Special case: Hermes shoes
- Text(82.5,35,TextSize,g_RPG_Agility / DIV_PARAM + g_Eq_Accessory_Effect)
- else
- Text(82.5,35,TextSize,g_RPG_Agility / DIV_PARAM)
- end
- if g_Eq_Accessory_Target == 51 then
- -- Special case: Spyglass
- Text(82.5,40,TextSize,g_RPG_Sight / DIV_PARAM + g_Eq_Accessory_Effect)
- else
- Text(82.5,40,TextSize,g_RPG_Sight / DIV_PARAM)
- end
- -- Show player equipment
- if g_Eq_Weapon == 0 then
- Text(45,20,TextSize,"None")
- else
- Text(45,20,TextSize,Weapon[g_Eq_Weapon])
- end
- if g_Eq_Armor == 0 then
- Text(45,30,TextSize,"None")
- else
- Text(45,30,TextSize,Armor[g_Eq_Armor])
- end
- if g_Eq_Accessory == 0 then
- Text(45,40,TextSize,"None")
- else
- Text(45,40,TextSize,Accessory[g_Eq_Accessory])
- end
- -- Move to the next menu by pressing E button
- if g_KeyPressE == 1 and g_Time > BtnTime or g_MouseClick == 1 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_B
- ActiveMenu[e] = 30 + ActiveCommand[ActiveMenu[e]]
- end
- end
- -- If there are no RPG compatible AI in the map, changing euipment is pointless
- if FLAG_AI == nil and g_PlayerThirdPerson == 1 then
- -- Top panel text
- TextCenterOnX(50,5,TextSize,"Equipment")
- -- Draw the main panel
- Panel(25,10,100,90)
- -- Draw
- Text(30,20,TextSize,"You don't have any equipment.")
- end
- -- In 1st player mode, equipment is changed outside RPG menu and equipment submenu only shows the amount of weapons
- if g_PlayerThirdPerson == 0 then
- -- Top panel text
- TextCenterOnX(50,5,TextSize,"Equipment")
- -- Draw the main panel
- Panel(25,10,100,90)
- if g_PlayerGunCount == 0 then
- Text(30,20,TextSize,"You don't have any equipment.")
- end
- if g_PlayerGunCount == 1 then
- Text(30,20,TextSize,"You are holding ".. g_PlayerGunCount .. " weapon.")
- end
- if g_PlayerGunCount > 1 then
- Text(30,20,TextSize,"You are holding ".. g_PlayerGunCount .. " weapons.")
- Text(30,25,TextSize,"Use 0-9 keys to change equipped weapon in the field.")
- end
- end
- -- Exit menu by pressing Q button
- if g_InKey == "q" and g_Time > BtnTime or g_InKey == "Q" and g_Time > BtnTime or g_MouseClick == 2 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_B
- if CursorPosition == 1 then
- ActiveCommand[ActiveMenu[e]] = 1
- end
- ActiveMenu[e] = 1
- end
- end
- -- 31: Weapon submenu
- if ActiveMenu[e] == 31 then
- -- Initiate the active command
- NumCommands[ActiveMenu[e]] = NUM_INV
- Command_Two(e)
- -- Top panel text
- TextCenterOnX(50,5,TextSize,"Choose your weapon")
- -- Draw the main panel
- Panel(25,10,100,90)
- -- Draw cursor
- if (ActiveCommand[ActiveMenu[e]] % 2 == 0) then
- cx = 67.5
- cy = 5 + 10 * (ActiveCommand[ActiveMenu[e]] / 2)
- else
- cx = 28
- cy = 5 + 10 * ((ActiveCommand[ActiveMenu[e]] + 1) / 2)
- end
- Panel(cx,cy,cx + 29.75,cy + 10)
- -- Draw the weapon list
- InvRead = 0
- WeaponSlot = 0
- while InvRead < NUM_INV do
- InvRead = InvRead + 1
- if InvWeapon[InvRead] == nil or InvWeapon[InvRead] < 1 then
- -- Dispose next weapon slot
- Weapon_Slot[WeaponSlot + 1] = nil
- else
- -- If weapon count equals number, activate weapon slot
- WeaponSlot = WeaponSlot + 1
- -- Draw text
- if WeaponSlot % 2 == 0 then
- tx = 69.5
- ty = 10 + 10 * (WeaponSlot / 2)
- else
- tx = 30
- ty = 10 + 10 * ((WeaponSlot + 1) / 2)
- end
- Text(tx,ty,TextSize,Weapon[InvRead])
- Text(tx + 23,ty,TextSize,InvWeapon[InvRead])
- -- Save the item id to table Item_Slot
- Weapon_Slot[WeaponSlot] = InvRead
- end
- end
- if InvWeapon[Weapon_Slot[ActiveCommand[ActiveMenu[e]]]] ~= nil then
- -- Draw the bottom panel text
- TextCenterOnX(50,95,TextSize,"Raises Power by " .. Weapon_Slot[ActiveCommand[ActiveMenu[e]]] * EQ_PARAM .. ".")
- -- Equip by pressing E
- if g_KeyPressE == 1 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_B
- -- Equip
- g_Eq_Weapon = Weapon_Slot[ActiveCommand[ActiveMenu[e]]]
- -- Dispose the Weapon_Slot table
- for Disposer = 1,NUM_INV do
- Weapon_Slot[Disposer] = nil
- end
- if CursorPosition == 1 then
- ActiveCommand[ActiveMenu[e]] = 1
- end
- ActiveMenu[e] = 3
- end
- else
- if g_KeyPressE == 1 and g_Time > BtnTime or g_MouseClick == 1 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_B
- -- Remove the equipment by pressing E
- g_Eq_Weapon = 0
- -- Dispose the Weapon_Slot table
- for Disposer = 1,NUM_INV do
- Weapon_Slot[Disposer] = nil
- end
- if CursorPosition == 1 then
- ActiveCommand[ActiveMenu[e]] = 1
- end
- ActiveMenu[e] = 3
- end
- end
- -- Exit menu by pressing Q button
- if g_InKey == "q" and g_Time > BtnTime or g_InKey == "Q" and g_Time > BtnTime or g_MouseClick == 2 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_B
- -- Dispose the Item_Slot table
- for Disposer = 1,NUM_INV do
- Weapon_Slot[Disposer] = nil
- end
- if CursorPosition == 1 then
- ActiveCommand[ActiveMenu[e]] = 1
- end
- ActiveMenu[e] = 3
- end
- end
- -- 32: Armor submenu
- if ActiveMenu[e] == 32 then
- -- Initiate the active command
- NumCommands[ActiveMenu[e]] = NUM_INV
- Command_Two(e)
- -- Top panel text
- TextCenterOnX(50,5,TextSize,"Choose your armor")
- -- Draw the main panel
- Panel(25,10,100,90)
- -- Draw cursor
- if (ActiveCommand[ActiveMenu[e]] % 2 == 0) then
- cx = 67.5
- cy = 5 + 10 * (ActiveCommand[ActiveMenu[e]] / 2)
- else
- cx = 28
- cy = 5 + 10 * ((ActiveCommand[ActiveMenu[e]] + 1) / 2)
- end
- Panel(cx,cy,cx + 29.75,cy + 10)
- -- Draw the weapon list
- InvRead = 0
- ArmorSlot = 0
- while InvRead < NUM_INV do
- InvRead = InvRead + 1
- if InvArmor[InvRead] == nil or InvArmor[InvRead] < 1 then
- -- Dispose next armor slot
- Armor_Slot[ArmorSlot + 1] = nil
- else
- -- If armor count equals number, activate weapon slot
- ArmorSlot = ArmorSlot + 1
- -- Draw text
- if ArmorSlot % 2 == 0 then
- tx = 69.5
- ty = 10 + 10 * (ArmorSlot / 2)
- else
- tx = 30
- ty = 10 + 10 * ((ArmorSlot + 1) / 2)
- end
- Text(tx,ty,TextSize,Armor[InvRead])
- Text(tx + 23,ty,TextSize,InvArmor[InvRead])
- -- Save the item id to table Item_Slot
- Armor_Slot[ArmorSlot] = InvRead
- end
- end
- if InvArmor[Armor_Slot[ActiveCommand[ActiveMenu[e]]]] ~= nil then
- -- Draw the bottom panel text
- TextCenterOnX(50,95,TextSize,"Raises Vitality by " .. Armor_Slot[ActiveCommand[ActiveMenu[e]]] * EQ_PARAM .. ".")
- -- Equip by pressing E
- if g_KeyPressE == 1 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_B
- -- Equip
- g_Eq_Armor = Armor_Slot[ActiveCommand[ActiveMenu[e]]]
- -- Dispose the Armor_Slot table
- for Disposer = 1,NUM_INV do
- Armor_Slot[Disposer] = nil
- end
- if CursorPosition == 1 then
- ActiveCommand[ActiveMenu[e]] = 1
- end
- ActiveMenu[e] = 3
- end
- else
- if g_KeyPressE == 1 and g_Time > BtnTime or g_MouseClick == 1 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_B
- -- Remove the equipment by pressing E
- g_Eq_Armor = 0
- -- Dispose the Armor_Slot table
- for Disposer = 1,NUM_INV do
- Armor_Slot[Disposer] = nil
- end
- if CursorPosition == 1 then
- ActiveCommand[ActiveMenu[e]] = 1
- end
- ActiveMenu[e] = 3
- end
- end
- -- Exit menu by pressing Q button
- if g_InKey == "q" and g_Time > BtnTime or g_InKey == "Q" and g_Time > BtnTime or g_MouseClick == 2 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_B
- -- Dispose the Item_Slot table
- for Disposer = 1,NUM_INV do
- Armor_Slot[Disposer] = nil
- end
- if CursorPosition == 1 then
- ActiveCommand[ActiveMenu[e]] = 1
- end
- ActiveMenu[e] = 3
- end
- end
- -- 33: Accessory submenu
- if ActiveMenu[e] == 33 then
- -- Initiate the active command
- NumCommands[ActiveMenu[e]] = NUM_INV
- Command_Two(e)
- -- Top panel text
- TextCenterOnX(50,5,TextSize,"Choose your accessory")
- -- Draw the main panel
- Panel(25,10,100,90)
- -- Draw cursor
- if (ActiveCommand[ActiveMenu[e]] % 2 == 0) then
- cx = 67.5
- cy = 5 + 10 * (ActiveCommand[ActiveMenu[e]] / 2)
- else
- cx = 28
- cy = 5 + 10 * ((ActiveCommand[ActiveMenu[e]] + 1) / 2)
- end
- Panel(cx,cy,cx + 29.75,cy + 10)
- -- Draw the Accessory list
- InvRead = 0
- AccessorySlot = 0
- while InvRead < NUM_INV do
- InvRead = InvRead + 1
- if InvAccessory[InvRead] == nil or InvAccessory[InvRead] < 1 then
- -- Dispose next armor slot
- Accessory_Slot[AccessorySlot + 1] = nil
- else
- -- If Accessory count equals number, activate Accessory slot
- AccessorySlot = AccessorySlot + 1
- -- Draw text
- if AccessorySlot % 2 == 0 then
- tx = 69.5
- ty = 10 + 10 * (AccessorySlot / 2)
- else
- tx = 30
- ty = 10 + 10 * ((AccessorySlot + 1) / 2)
- end
- Text(tx,ty,TextSize,Accessory[InvRead])
- Text(tx + 23,ty,TextSize,InvAccessory[InvRead])
- -- Save the item id to table Accessory_Slot
- Accessory_Slot[AccessorySlot] = InvRead
- end
- end
- if InvAccessory[Accessory_Slot[ActiveCommand[ActiveMenu[e]]]] ~= nil then
- -- Draw the bottom panel text
- TextCenterOnX(50,95,TextSize,Accessory_Description[Accessory_Slot[ActiveCommand[ActiveMenu[e]]]])
- -- Equip by pressing E
- if g_KeyPressE == 1 and g_Time > BtnTime or g_MouseClick == 1 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_B
- -- Equip
- g_Eq_Accessory = Accessory_Slot[ActiveCommand[ActiveMenu[e]]]
- -- Dispose the Accessory_Slot table
- for Disposer = 1,NUM_INV do
- Accessory_Slot[Disposer] = nil
- end
- if CursorPosition == 1 then
- ActiveCommand[ActiveMenu[e]] = 1
- end
- ActiveMenu[e] = 3
- end
- else
- if g_KeyPressE == 1 and g_Time > BtnTime or g_MouseClick == 1 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_B
- -- Remove the Accessory by pressing E
- g_Eq_Accessory = 0
- -- Dispose the Accessory_Slot table
- for Disposer = 1,NUM_INV do
- Accessory_Slot[Disposer] = nil
- end
- if CursorPosition == 1 then
- ActiveCommand[ActiveMenu[e]] = 1
- end
- ActiveMenu[e] = 3
- end
- end
- -- Exit menu by pressing Q button
- if g_InKey == "q" and g_Time > BtnTime or g_InKey == "Q" and g_Time > BtnTime or g_MouseClick == 2 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_B
- -- Dispose the Accessory_Slot table
- for Disposer = 1,NUM_INV do
- Accessory_Slot[Disposer] = nil
- end
- if CursorPosition == 1 then
- ActiveCommand[ActiveMenu[e]] = 1
- end
- ActiveMenu[e] = 3
- end
- end
- -- 4: Status menu
- if ActiveMenu[e] == 4 then
- -- Initiate the active command
- NumCommands[ActiveMenu[e]] = 1
- Command_One(e)
- -- Top panel text
- TextCenterOnX(50,5,TextSize,"Status")
- -- Draw the main panel
- Panel(25,10,100,90)
- Text(30,20,TextSize,"HP:")
- Text(67.5,20,TextSize,"State:")
- Text(45,20,TextSize,g_PlayerHealth .. " / " .. g_RPG_MAXHP)
- Text(82.5,20,TextSize,State[g_RPG_State])
- if FLAG_AI == 1 then
- Text(30,30,TextSize,"Gold:")
- Text(30,35,TextSize,"Level:")
- Text(67.5,30,TextSize,"EXP:")
- Text(67.5,35,TextSize,"Next:")
- Text(30,45,TextSize,"Power:")
- Text(30,50,TextSize,"Vitality:")
- Text(30,55,TextSize,"Agility:")
- Text(30,60,TextSize,"Sight:")
- Text(67.5,45,TextSize,"Lives:")
- Text(45,30,TextSize,g_RPG_Gold)
- Text(45,35,TextSize,g_RPG_Level)
- -- Count player statistics by level and equipment
- Text(45,45,TextSize,g_RPG_SpellPower / DIV_PARAM + g_Eq_Weapon * EQ_PARAM)
- Text(45,50,TextSize,g_RPG_Vitality / DIV_PARAM + g_Eq_Armor * EQ_PARAM)
- Text(82.5,30,TextSize,g_RPG_EXP)
- Text(82.5,35,TextSize,g_RPG_ToNextLevel)
- Text(82.5,45,TextSize,g_PlayerLives)
- -- Show RPG equipment if 3rd player mode is active
- if g_PlayerThirdPerson == 1 then
- Text(30,70,TextSize,"Weapon:")
- Text(30,75,TextSize,"Armor:")
- Text(30,80,TextSize,"Accessory:")
- if g_Eq_Accessory_Target == 41 then
- -- Special case: Hermes shoes
- Text(45,55,TextSize,g_RPG_Agility / DIV_PARAM + g_Eq_Accessory_Effect)
- else
- Text(45,55,TextSize,g_RPG_Agility / DIV_PARAM)
- end
- if g_Eq_Accessory_Target == 51 then
- -- Special case: Spyglass
- Text(45,60,TextSize,g_RPG_Sight / DIV_PARAM + g_Eq_Accessory_Effect)
- else
- Text(45,60,TextSize,g_RPG_Sight / DIV_PARAM)
- end
- -- Show player equipment
- if g_Eq_Weapon == 0 then
- Text(45,70,TextSize,"None")
- else
- Text(45,70,TextSize,Weapon[g_Eq_Weapon])
- end
- if g_Eq_Armor == 0 then
- Text(45,75,TextSize,"None")
- else
- Text(45,75,TextSize,Armor[g_Eq_Armor])
- end
- if g_Eq_Accessory == 0 then
- Text(45,80,TextSize,"None")
- else
- Text(45,80,TextSize,Accessory[g_Eq_Accessory])
- end
- else
- -- Show Sight and Agility without accessory bonuses
- Text(45,55,TextSize,g_RPG_Agility / DIV_PARAM)
- Text(45,60,TextSize,g_RPG_Sight / DIV_PARAM)
- -- Show number of collected weapons if 1st person mode is active
- Text(30,70,TextSize,"Weapons:")
- Text(45,70,TextSize,g_PlayerGunCount)
- end
- else
- -- If there are no RPG compatible AI in the map, showing RPG statistics is pointless
- Text(30,30,TextSize,"Lives:")
- Text(45,30,TextSize,g_PlayerLives)
- -- If there is a shop in the map, show gold
- if FLAG_SHOP == 1 then
- Text(67.5,30,TextSize,"Gold:")
- Text(82.5,30,TextSize,g_RPG_Gold)
- end
- if g_PlayerThirdPerson == 1 then
- if FLAG_SHOP == 1 or FLAG_MAGIC == 1 then
- Text(30,40,TextSize,"Power:")
- Text(45,40,TextSize,g_RPG_SpellPower / DIV_PARAM)
- end
- else
- -- Show number of collected weapons if 1st person mode is active
- Text(30,40,TextSize,"Weapons:")
- Text(45,40,TextSize,g_PlayerGunCount)
- end
- end
- -- Exit menu by pressing Q button
- if g_InKey == "q" and g_Time > BtnTime or g_InKey == "Q" and g_Time > BtnTime or g_MouseClick == 2 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_B
- ActiveMenu[e] = 1
- end
- end
- -- 5: Config menu
- if ActiveMenu[e] == 5 then
- -- Initiate the active command
- if FLAG_DIALOG == 1 and FLAG_AI == 1 then
- NumCommands[ActiveMenu[e]] = 5
- elseif FLAG_DIALOG == 1 or FLAG_AI == 1 then
- NumCommands[ActiveMenu[e]] = 4
- else
- NumCommands[ActiveMenu[e]] = 3
- end
- Command_One(e)
- -- Top panel text
- TextCenterOnX(50,5,TextSize,"Configure")
- -- Draw the main panel
- Panel(25,10,100,90)
- -- Draw cursor
- Panel(28,15 + 10 * (ActiveCommand[ActiveMenu[e]] - 1),97,25 + 10 * (ActiveCommand[ActiveMenu[e]] - 1))
- -- Draw text
- Text(30,20,TextSize,"Text size")
- Text(30,30,TextSize,"Cursor position")
- Text(30,40,TextSize,"Front page content")
- if FLAG_DIALOG == 1 and FLAG_AI == 1 then
- Text(30,50,TextSize,"Field Message")
- if MessageWindow == 1 then
- Text(77.5,50,TextSize,"Windowed")
- end
- if MessageWindow == 0 then
- Text(77.5,50,TextSize,"Prompt")
- end
- Text(30,60,TextSize,"Battle Message")
- if BMessageWindow == 1 then
- Text(77.5,60,TextSize,"Windowed")
- end
- if BMessageWindow == 0 then
- Text(77.5,60,TextSize,"Prompt")
- end
- elseif FLAG_DIALOG == 1 then
- Text(30,50,TextSize,"Dialogue style")
- if MessageWindow == 1 then
- Text(77.5,50,TextSize,"Windowed")
- end
- if MessageWindow == 0 then
- Text(77.5,50,TextSize,"Prompt")
- end
- elseif FLAG_AI == 1 then
- Text(30,50,TextSize,"Battle Message")
- if BMessageWindow == 1 then
- Text(77.5,50,TextSize,"Windowed")
- end
- if BMessageWindow == 0 then
- Text(77.5,50,TextSize,"Prompt")
- end
- end
- if TextSize == 1 then
- Text(77.5,20,TextSize,"Default")
- end
- if TextSize == 2 then
- Text(77.5,20,TextSize,"Small")
- end
- if TextSize == 3 then
- Text(77.5,20,TextSize,"Large")
- end
- if CursorPosition == 1 then
- Text(77.5,30,TextSize,"Default")
- end
- if CursorPosition == 2 then
- Text(77.5,30,TextSize,"Memory")
- end
- if FrontPageText == 1 then
- Text(77.5,40,TextSize,"Default")
- end
- if FrontPageText == 2 then
- Text(77.5,40,TextSize,"Nothing")
- end
- -- Process info text and E key
- if ActiveCommand[ActiveMenu[e]] == 1 then
- TextCenterOnX(50,95,TextSize,"Press E to change the text size.")
- -- Edit options by pressing E button
- if g_KeyPressE == 1 and g_Time > BtnTime or g_MouseClick == 1 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_B
- if TextSize == 1 then
- TextSize = 3
- else
- TextSize = 1
- end
- end
- end
- if ActiveCommand[ActiveMenu[e]] == 2 then
- TextCenterOnX(50,95,TextSize,"Press E to change the cursor position.")
- -- Edit options by pressing E button
- if g_KeyPressE == 1 and g_Time > BtnTime or g_MouseClick == 1 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_B
- if CursorPosition == 1 then
- CursorPosition = 2
- else
- CursorPosition = 1
- ActiveCommand[2] = 1
- ActiveCommand[3] = 1
- ActiveCommand[6] = 1
- ActiveCommand[7] = 1
- end
- end
- end
- if ActiveCommand[ActiveMenu[e]] == 3 then
- TextCenterOnX(50,95,TextSize,"Press E to change the front page content.")
- -- Edit options by pressing E button
- if g_KeyPressE == 1 and g_Time > BtnTime or g_MouseClick == 1 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_B
- if FrontPageText == 1 then
- FrontPageText = 2
- else
- FrontPageText = 1
- end
- end
- end
- if ActiveCommand[ActiveMenu[e]] == 4 then
- if FLAG_DIALOG == nil and FLAG_AI == 1 then
- TextCenterOnX(50,95,TextSize,"Press E to change the battle message style.")
- -- Edit options by pressing E button
- if g_KeyPressE == 1 and g_Time > BtnTime or g_MouseClick == 1 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_B
- if BMessageWindow == 1 then
- BMessageWindow = 0
- else
- BMessageWindow = 1
- end
- end
- else
- TextCenterOnX(50,95,TextSize,"Press E to change the dialogue style.")
- -- Edit options by pressing E button
- if g_KeyPressE == 1 and g_Time > BtnTime or g_MouseClick == 1 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_B
- if MessageWindow == 1 then
- MessageWindow = 0
- else
- MessageWindow = 1
- end
- end
- end
- end
- if ActiveCommand[ActiveMenu[e]] == 5 then
- TextCenterOnX(50,95,TextSize,"Press E to change the battle message style.")
- -- Edit options by pressing E button
- if g_KeyPressE == 1 and g_Time > BtnTime or g_MouseClick == 1 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_B
- if BMessageWindow == 1 then
- BMessageWindow = 0
- else
- BMessageWindow = 1
- end
- end
- end
- -- Exit menu by pressing Q button
- if g_InKey == "q" and g_Time > BtnTime or g_InKey == "Q" and g_Time > BtnTime or g_MouseClick == 2 and g_Time > BtnTime then
- PlayNon3DSound(e,1)
- BtnTime = g_Time + TIME_B
- if CursorPosition == 1 then
- ActiveCommand[ActiveMenu[e]] = 1
- end
- ActiveMenu[e] = 1
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement