- -- A basic encounter script skeleton you can copy and modify for your own creations.
- difficulty = 2
- DET = 0
- music = "Justice" --Always OGG. Extension is added automatically. Remove the first two lines for custom music.
- encountertext = "There You Are =)"
- nextwaves = {"nowave"}
- wavetimer = 6.0
- arenasize = {205, 200}
- enemies = {
- "poseur"
- }
- enemypositions = {
- {0, 0}
- }
- introtimer = 0
- introphase = 0
- function Update()
- if introtimer ~= nil and introtimer < 901 then
- introtimer = introtimer + 1
- end
- if introtimer ~= nil and introtimer < 360 and introphase == 0 then
- dog.sprite.rotation = dog.sprite.rotation + 1
- elseif introtimer ~= nil and introtimer == 360 and introphase == 0 then
- introphase = 1
- dog.sprite.rotation = 0
- error.sprite.Set("crack_1")
- dog.sprite.Set("dogscared")
- Audio.PlaySound("break_1")
- elseif introphase == 1 and introtimer < 440 then
- error.sprite.MoveTo(320 - (((80 - (introtimer - 360)) / 7)*math.sin(introtimer)),240 + (((80 - (introtimer - 360)) / 5)*math.sin(introtimer)))
- dog.sprite.MoveTo(580 + (((80 - (introtimer - 360)) / 2)*math.sin(introtimer)),60 - (((80 - (introtimer - 360)) / 1)*math.sin(introtimer)))
- elseif introphase == 1 and introtimer == 480 then
- introphase = 2
- Audio.PlaySound("break_2")
- error.sprite.Set("crack_2")
- elseif introphase == 2 and introtimer < 570 then
- error.sprite.MoveTo(320 - (((80 - (introtimer - 480)) / 14)*math.sin(introtimer)),240 + (((80 - (introtimer - 480)) / 7)*math.sin(introtimer)))
- dog.sprite.MoveTo(580 + (((80 - (introtimer - 480)) / 4)*math.sin(introtimer)),60 - (((80 - (introtimer - 480)) / 2.5)*math.sin(introtimer)))
- elseif introphase == 2 and introtimer == 600 then
- introphase = 3
- Audio.PlaySound("break_3")
- error.sprite.Set("crack_3")
- elseif introphase == 3 and introtimer < 680 then
- error.sprite.MoveTo(320 - (((80 - (introtimer - 600)) / 20)*math.sin(introtimer)),240 + (((80 - (introtimer - 600)) / 10)*math.sin(introtimer)))
- dog.sprite.MoveTo(580 + (((80 - (introtimer - 600)) / 5)*math.sin(introtimer)),60 - (((80 - (introtimer - 600)) / 3)*math.sin(introtimer)))
- elseif introphase == 3 and introtimer == 740 then
- introphase = 4
- Audio.PlaySound("explode")
- elseif introphase == 4 and introtimer == 750 then
- error.Remove()
- dog.sprite.Set("dogfall")
- dog.SetVar("velx",0)
- dog.SetVar("vely",1)
- SetGlobal("bit1",CreateProjectileAbs("bit_1",138.5,249))
- GetGlobal("bit1").SetVar("velx",0)
- GetGlobal("bit1").SetVar("vely",0)
- SetGlobal("bit2",CreateProjectileAbs("bit_2",200,400))
- GetGlobal("bit2").SetVar("velx",0)
- GetGlobal("bit2").SetVar("vely",1)
- SetGlobal("bit3",CreateProjectileAbs("bit_3",479,389.5))
- GetGlobal("bit3").SetVar("velx",1)
- GetGlobal("bit3").SetVar("vely",2)
- SetGlobal("bit4",CreateProjectileAbs("bit_4",515,196))
- GetGlobal("bit4").SetVar("velx",2)
- GetGlobal("bit4").SetVar("vely",3)
- SetGlobal("bit5",CreateProjectileAbs("bit_5",485,112))
- GetGlobal("bit5").SetVar("velx",1)
- GetGlobal("bit5").SetVar("vely",2)
- SetGlobal("bit6",CreateProjectileAbs("bit_6",144,126))
- GetGlobal("bit6").SetVar("velx",-1)
- GetGlobal("bit6").SetVar("vely",1)
- dog.SendToTop()
- elseif introphase == 4 and introtimer ~= nil and introtimer >= 750 and introtimer < 900 then
- if dog ~= nil and GetGlobal("bit1") ~= nil and GetGlobal("bit2") ~= nil and GetGlobal("bit3") ~= nil and GetGlobal("bit4") ~= nil then
- if GetGlobal("bit5") ~= nil and GetGlobal("bit6") ~= nil then
- dog.SetVar("velx",dog.GetVar("velx") + 0.04)
- dog.SetVar("vely",dog.GetVar("vely") - 0.12)
- dog.Move(dog.GetVar("velx"),dog.GetVar("vely"))
- if introtimer%2 == 0 then
- dog.sprite.rotation = dog.sprite.rotation - 1
- end
- GetGlobal("bit1").SetVar("velx",GetGlobal("bit1").GetVar("velx") - 0.04)
- GetGlobal("bit1").SetVar("vely",GetGlobal("bit1").GetVar("vely") - 0.12)
- GetGlobal("bit1").Move(GetGlobal("bit1").GetVar("velx"),GetGlobal("bit1").GetVar("vely"))
- if introtimer%2 == 0 then
- GetGlobal("bit1").sprite.rotation = GetGlobal("bit1").sprite.rotation + 1
- end
- GetGlobal("bit2").SetVar("velx",GetGlobal("bit2").GetVar("velx") + 0.02)
- GetGlobal("bit2").SetVar("vely",GetGlobal("bit2").GetVar("vely") - 0.12)
- GetGlobal("bit2").Move(GetGlobal("bit2").GetVar("velx"),GetGlobal("bit2").GetVar("vely"))
- if introtimer%3 == 0 then
- GetGlobal("bit2").sprite.rotation = GetGlobal("bit2").sprite.rotation + 1
- end
- GetGlobal("bit3").SetVar("velx",GetGlobal("bit3").GetVar("velx") + 0.02)
- GetGlobal("bit3").SetVar("vely",GetGlobal("bit3").GetVar("vely") - 0.12)
- GetGlobal("bit3").Move(GetGlobal("bit3").GetVar("velx"),GetGlobal("bit3").GetVar("vely"))
- if introtimer%2 == 0 then
- GetGlobal("bit3").sprite.rotation = GetGlobal("bit3").sprite.rotation - 1
- end
- GetGlobal("bit4").SetVar("velx",GetGlobal("bit4").GetVar("velx") - 0.04)
- GetGlobal("bit4").SetVar("vely",GetGlobal("bit4").GetVar("vely") - 0.12)
- GetGlobal("bit4").Move(GetGlobal("bit4").GetVar("velx"),GetGlobal("bit3").GetVar("vely"))
- if introtimer%1 == 0 then
- GetGlobal("bit4").sprite.rotation = GetGlobal("bit4").sprite.rotation - 1
- end
- GetGlobal("bit5").SetVar("velx",GetGlobal("bit5").GetVar("velx") - 0.04)
- GetGlobal("bit5").SetVar("vely",GetGlobal("bit5").GetVar("vely") - 0.12)
- GetGlobal("bit5").Move(GetGlobal("bit5").GetVar("velx"),GetGlobal("bit5").GetVar("vely"))
- if introtimer%3 == 0 then
- GetGlobal("bit5").sprite.rotation = GetGlobal("bit5").sprite.rotation + 1
- end
- GetGlobal("bit6").SetVar("velx",GetGlobal("bit6").GetVar("velx") - 0.04)
- GetGlobal("bit6").SetVar("vely",GetGlobal("bit6").GetVar("vely") - 0.12)
- GetGlobal("bit6").Move(GetGlobal("bit5").GetVar("velx"),GetGlobal("bit6").GetVar("vely"))
- if introtimer%2 == 0 then
- GetGlobal("bit6").sprite.rotation = GetGlobal("bit6").sprite.rotation + 1
- end
- end
- end
- elseif introtimer == 901 then
- introtimer = 902
- end
- if introtimer ~= nil and introtimer%5 == 0 then
- State("DIALOGRESULT")
- end
- if introtimer == 902 then
- dog.Remove()
- GetGlobal("bit1").Remove()
- GetGlobal("bit2").Remove()
- GetGlobal("bit3").Remove()
- GetGlobal("bit4").Remove()
- GetGlobal("bit5").Remove()
- GetGlobal("bit6").Remove()
- introtimer = nil
- --BattleDialog({"[starcolor:000000][noskip][next]"})
- State("ENEMYDIALOGUE")
- end
- end
- function OnHit(bullet)
- Audio.Play()
- end
- function EncounterStarting()
- Player.name = "MC"
- Player.lv = 20
- Player.hp = 99
- Audio.Stop()
- error = CreateProjectileAbs("fake_error",320,240)
- dog = CreateProjectileAbs("dog",580,60)
- Inventory.AddCustomItems({"Starfait"}, {0})
- Inventory.SetInventory({"Starfait"})
- end
- SetGlobal("intro",true)
- function EnemyDialogueStarting()
- local intro = GetGlobal("intro") --updates the variable "intro" everytime the EnemyDialogueStarting() function is triggered
- if intro == true then
- enemies[1].SetVar('currentdialogue', {"[effect:none]*Monika smiles \nsweetly to you*", "Heya...","[effect:none]You've been \npretty busy \nwith those girls, \nhuh?","[effect:none]Can't believe \nabout you didn't \neven spare \nyour childchood \nfriend,Sayori.","What kind of \nmonster are \nyou MC?","[effect:none]You killed all \nof them with \ncold blood.","[effect:none]And now you \nare sitting and \nplaying this \ngame to see \nmy death \ntoo?", "[effect:none]That's Pretty \nsick if you ask \nme.","...","[effect:none]Anyways...","[noskip][effect:none]Here's the tip \nof the day.","[effect:none]Don't forget to \nsave your game!" ,"[noskip][effect:none][novoice][waitall:5]This could get... \nReally... \n[color:ff0000]frustrating [w:10][next]"})
- SetGlobal("intro", false) -- sets the variable "intro" to false so that this line of dialogue only plays once
- end
- 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'.
- end
- function DefenseEnding() --This built-in function fires after the defense round ends.
- encountertext = RandomEncounterText()
- if (GetGlobal("rage") > 0 and ShowedDialog == false) then
- ShowedDialog = true
- encountertext = "Looks like Monika let his\rdefense down."
- end
- end
- function HandleSpare()
- State("ENEMYDIALOGUE")
- if GetGlobal("rage") > 0 then
- BattleDialog({"Trump won't let you go until\ryou've payed for your sins."})
- elseif GetGlobal("spareable") == 1 then
- BattleDialog({"This is where you'd spare him.\nGood job."})
- else
- BattleDialog({"[color:ff0000]Finish Your Job."})
- if GetGlobal("rage") > 3 then
- nextwaves = {"dunkedon"}
- BattleDialog({"Im glad you did it."})
- end
- function HandleItem(ItemID)
- if ItemID == "STARFAIT" then
- Player.Heal(14)
- BattleDialog({"You eat the Starfait. \nYou recovered 14 HP!"})
- end
- end
- end
- end