Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- The encounter wasn't my idea. I just made it a reality.
- music = "ooo" -- Music set in audio folder. If having trouble convert to .ogg.
- encountertext = "The Grey Child stands in your\rway." -- Text that appears in battle box when the ecounter starts
- nextwaves = {"bullettest_chaserorb"} -- The next wave set at start.
- wavetimer = 0.0001
- arenasize = {155, 130}
- currentitem = 1
- -- Enemies on screen, can have multiple enemies. Found in monsters folder.
- enemies = {
- "core!frisk",
- "items"
- }
- enemypositions = { -- Position of enemeies. Works in order of listing.
- {0, 0},
- {0, 0}
- }
- mask = nil
- -- A custom list with attacks to choose from. Actual selection happens in EnemyDialogueEnding(). Put here in case you want to use it.
- possible_attacks = nil
- -- What happens when you start the encounter lua script
- function EncounterStarting()
- -- If you want to change the game state immediately, this is the place.
- -- Don't ask why the player's name is in the monster's lua file it just works here.
- Player.name="Chara" -- Name of player.
- Player.lv=1 -- The player's level.
- Player.hp=20 -- The player's starting HP
- SetGlobal('turn',0) -- Sets the turn to 0 because we haven't had a turn yet.
- SetGlobal('fight',0) -- Sets the global value of fighting to 0. [See core!frisk.lua]
- SetGlobal('sparing',0) -- Sets the global value of sparing to 0 or false.
- SetGlobal('pacifist',1) -- Sets the global value of sparing to 1 or true.
- SetGlobal('question',0) -- Sets the global value of questioning to 0. [See core!frisk.lua]
- SetGlobal('flirt',0) -- Sets the global value of flirting to 0. [See core!frisk.lua]
- SetGlobal('insult',0) -- Sets the global value of insulting to 0. [See core!frisk.lua]
- SetGlobal('masked',false) -- Something to do with the item system hack :P. Hides the heart or something in the item menu.
- enemies[2].SetActive(false)
- end
- function EnemyDialogueStarting()
- -- Good location for setting monster dialogue depending on how the battle is going.
- -- Example: enemies[1].SetVar('currentdialogue', {"Check it\nout!"}) See documentation for details.
- end
- function EnemyDialogueEnding()
- -- Good location to fill the 'nextwaves' table with the attacks you want to have simultaneously.
- -- This example line below takes a random attack from 'possible_attacks'.
- nextwaves = { possible_attacks[math.random(#possible_attacks)] }
- end
- function DefenseEnding() --This built-in function fires after the defense round ends.
- enemies[1].SetActive(true)
- enemies[2].SetActive(false)
- if GetGlobal('pacifist',1) then
- turn_dialogue = {
- "You stare at Frisk.\nFrisk stares back at you.",
- }
- encountertext = turn_dialogue[GetGlobal('turn')+1]
- SetGlobal('turn',GetGlobal('turn')+1)
- end
- end
- function HandleSpare()
- if enemies[1].GetVar('canspare')==true then
- State("DONE")
- else
- State("ENEMYDIALOGUE") --By default, pressing spare only spares the enemies but stays in the menu. Changing state happens here.
- end
- end
- function HandleItem(ItemID)
- BattleDialog({"Selected item " .. ItemID .. "."})
- end
- -- THE ITEM SYSTEM ISN'T MINE CREDIT TO: carnegiesgrave. Thread: https://www.reddit.com/r/Unitale/comments/40bbgl/020a_item_menu/
- function Update()
- if GetGlobal('masked') and mask==nil then
- --We need a mask because using State('ACTMENU') hides the Player heart by default - just a bugfix, basically
- mask = CreateProjectile('ut-heart-red',0,0)
- mask.MoveToAbs(64,190,true)
- elseif GetGlobal('masked')==false and mask!=nil then
- mask.Remove()
- mask=nil
- end
- if Player.absx>=350 and Player.absx<380 and Player.absy<=32 then
- if Input.Confirm==1 then
- --Now we swap the pretend enemy with the real enemy.
- enemies[1].SetActive(false)
- enemies[2].SetActive(true)
- --If we don't change state indirectly, such as from BattleDialogue, it skips straight to the first act command
- BattleDialog({"[func:State,ACTMENU]"})
- SetGlobal('lies',true)
- SetGlobal('masked',true)
- currentitem=1
- end
- end
- --Input handling for the pretend Item menu.
- if GetGlobal('lies') then
- local inventory = enemies[2].GetVar('commands')
- --This is for handling one page of variable commands only. Nothing more will work right now
- if Input.Cancel==1 then
- SetGlobal('masked',false)
- State("ACTIONSELECT")
- SetGlobal('lies',false)
- enemies[1].SetActive(true)
- enemies[2].SetActive(false)
- elseif Input.Right==1 then
- if mask.absx==64 and #inventory>currentitem then
- currentitem = currentitem + 1
- mask.MoveTo(mask.x+264,mask.y)
- elseif mask.absx>64 then
- currentitem = currentitem - 1
- mask.MoveTo(mask.x-264,mask.y)
- end
- elseif Input.Left==1 then
- if mask.absx>64 then
- currentitem = currentitem - 1
- mask.MoveTo(mask.x-264,mask.y)
- elseif mask.absx==64 and #inventory>currentitem then
- currentitem = currentitem + 1
- mask.MoveTo(mask.x+264,mask.y)
- end
- --never program nested ifs at 1 AM
- elseif (Input.Down==1 or Input.Up==1) and mask.absy==190 then
- if #inventory==4 or (#inventory==3 and currentitem!=2) then
- currentitem = currentitem + 2
- mask.MoveTo(mask.x,mask.y-28)
- elseif #inventory==3 and currentitem==2 then
- currentitem = currentitem + 1
- mask.MoveTo(mask.x-264,mask.y-28)
- end
- elseif (Input.Down==1 or Input.Up==1) and mask.absy<190 then
- currentitem = currentitem - 2
- mask.MoveTo(mask.x,mask.y+28)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement