Advertisement
OmegaGamingHunters

Encounter Script (CYF) Update 1.10

Jan 22nd, 2018
810
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.16 KB | None | 0 0
  1. -- A basic encounter script skeleton you can copy and modify for your own creations.
  2.  
  3. music = "Heartache" --Always OGG. Extension is added automatically. Remove the first two lines for custom music.
  4. encountertext = "Toriel blocks the way!" --Modify as necessary. It will only be read out in the action select screen.
  5. nextwaves = {"Nothing"}
  6. wavetimer = 0.1
  7. arenasize = {155, 130}
  8.  
  9. enemies = {
  10. "Genocide Toriel-(Normal)",
  11. "CyanSoul"
  12. }
  13.  
  14. enemypositions = {
  15. {0, 0},
  16. {0, 142}
  17. }
  18.  
  19. ------------- Global Variables & Other Stuff----------------
  20. SetGlobal("DEAD",0)
  21. SetGlobal("help",0)
  22. SetGlobal("revive",0)
  23. SetGlobal("Soul",0)
  24. toriisded1 = false
  25. toriisded2 = false
  26. yay1 = false
  27. yay2 = false
  28. itemsused = 0
  29. Current_Turn = 0
  30. starttime = Time.time
  31. currenttime = 0
  32. current = 0
  33. ------------------------------------------------------------
  34.  
  35. function EncounterStarting()
  36.     require "Animations/Toriel_Intro"
  37.     Player.lv = 4
  38.     Player.hp = 32
  39.     Player.name = "Chara"
  40.     SetPPCollision(true)
  41.     AllowPlayerDef(true)   
  42.     Inventory.AddCustomItems({"Pie", "MnstrCndy", "MnstrCndy", "MnstrCndy", "SpidrDont", "SpidrDont", "SpidrCidr"}, {0, 0, 0, 0, 0, 0, 0})
  43.     Inventory.SetInventory({"Pie", "MnstrCndy", "MnstrCndy", "MnstrCndy", "SpidrDont", "SpidrDont", "SpidrCidr"})
  44.     State("ACTIONSELECT")
  45.     enemies[2].Call("SetActive", false)
  46.     -- If you want to change the game state immediately, this is the place.
  47. end
  48.  
  49. function Update()
  50.     if enemies[1].GetVar("hp") <= 1 and yay1 == false then
  51.         toriisded1 = true
  52.         SetGlobal("ded", true)
  53.         yay1 = true
  54.         enemies[1].SetVar("hp", 10000)
  55.         enemies[1].SetVar("def", -100)
  56.     end
  57.     if toriisded1 == true then
  58.         Audio.Stop()
  59.         HideToriel()
  60.         enemies[1].Call("SetSprite","a_toriel_fatally_wounded")    
  61.     end
  62.     if (GetGlobal("DEAD") == 1 and part == 3) then
  63.         SetGlobal("help",1)
  64.         TorielIntro()      
  65.     end
  66.     if (GetGlobal("DEAD") == 1 and part == 4) then
  67.         SetGlobal("revive",1)
  68.         Sacrifice()
  69.     end
  70.     if (GetGlobal("DEAD") == 1 and part == 6) then
  71.         --AnimateToriel()
  72.     end
  73. end
  74. part = 1
  75. function EnemyDialogueStarting()
  76.     local revive = GetGlobal("revive")
  77.     if (GetGlobal("DEAD") == 1 and part == 1) then
  78.          enemies[1].SetVar('currentdialogue',{"[waitall:4][voice:toriel1][effect:shake]Y... you...\nreally hate me\nthat much?", "[waitall:4][voice:toriel1][effect:shake]Now I see who I\nwas protecting by\nkeeping you here.", "[waitall:4][voice:toriel1][effect:shake]Not you...", "[func:SetSprite,a_toriel_fatally_wounded_smiling][waitall:4][voice:toriel1][effect:shake]But them!", "[func:SetSprite,a_toriel_fatally_wounded_before_death][waitall:8][voice:toriel1][effect:none]H a . . .[w:4]  h a . . .", "[func:SetSprite,a_toriel_fatally_wounded_before_death][func:State,ENEMYDIALOGUE]"})
  79.          part = 2
  80.          toriisded1 = false
  81.     elseif (GetGlobal("DEAD") == 1 and part == 2) then       
  82.          enemies[2].Call("SetActive", true)
  83.          enemies[2].SetVar('currentdialogue',{"[waitall:500][noskip][finished][next]", "[noskip][w:250][next]", "[novoice]Don't die yet mother.[w:60][next]", "[novoice]You are the only \none to stop them at \ntheir current state.[w:60][next]", "[novoice]Please mother, take\nmy[color:42fcff] Soul.[w:30][color:000000] And put a \nend to this horrible\n[color:ff0000]Nightmare.[color:ffffff][w:60][next]", "[novoice]Do it for[color:42fcff] me,[w:30][color:000000]\ndo it for all[color:42fcff] humans\nand monsters.[w:60][next]", "[novoice]Do it[w:60] for your \nkingdom, and most \nimportantly[w:60][next]", "[novoice]Asgore[w:90][next]", "[func:SetSprite,a_nothing][func:State,ENEMYDIALOGUE]"})
  84.          part = 3
  85.     elseif (GetGlobal("DEAD") == 1 and part == 3) then          
  86.          enemies[2].SetVar('currentdialogue',{"[waitall:100][noskip][next]", "[noskip][w:100][func:Heal][next]", "[func:State,ENEMYDIALOGUE]"})
  87.          part = 4
  88.     elseif (GetGlobal("DEAD") == 1 and part == 4) then
  89.          enemies[2].Call("SetActive", false)
  90.          enemies[1].SetVar('currentdialogue',{"[noskip][func:SetSprite,a_toriel_healed][w:100][sound:click][func:SetSprite,a_toriel_healed_standing_1][w:100][next]", "[func:State,ENEMYDIALOGUE]"})
  91.          part = 5
  92.     elseif (GetGlobal("DEAD") == 1 and part == 5) then
  93.          enemies[1].Call("SetSprite", "a_toriel_healed_standing_2")
  94.          enemies[1].SetVar('currentdialogue',{"[waitall:12][novoice][effect:none]....[w:30][waitall:1][voice:toriel]I thought it \nwouldn't come to \nthis but i know \nwhat i must do.", "[voice:toriel][effect:none]I thought i \nwouldn't have to \nkill a human[w:15], EVER!", "[func:SetSprite,a_toriel_healed_standing_1][effect:none][novoice][waitall:12]...[waitall:1][voice:toriel]but you[novoice]...", "[func:SetSprite,a_toriel_healed_standing_2][voice:toriel][effect:none]your the \nexpection.", "[voice:toriel][effect:none]I guess it's time \nfor us to say \ngoodbye.", "[noskip][voice:toriel][effect:shake][w:30][func:SetSprite,a_toriel_healed_standing_3][waitall:8]See you in hell.[func:SetSprite,a_queen_toriel_ battle_sprite][w:60][func:BattleStart][func:State,DEFENDING][next]"})                      
  95.          Opening_Start = {"Battle_Start"}
  96.          nextwaves = { Opening_Start[(#Opening_Start)] }
  97.          part = 6
  98.     elseif (GetGlobal("DEAD") == 1 and part == 6) then
  99.          SetGlobal("Soul",1)
  100.          wavetimer = 16.0
  101.     end
  102. end
  103.  
  104. -- A custom list with attacks to choose from. Actual selection happens in EnemyDialogueEnding(). Put here in case you want to use it.
  105. possible_attacks = {}
  106. Attack_Order = {"hand_opening", "hand_sweep", "circles", "bigbulletrain", "warning_fire", "circles", "warning_fire", "wavy_fire"}
  107. Random_Attacks = {"hand_sweep", "bigbulletrain", "circles", "warning_fire", "wavy_fire"}
  108.  
  109.  
  110. function EnemyDialogueEnding()
  111.     -- Good location to fill the 'nextwaves' table with the attacks you want to have simultaneously.
  112.     -- This example line below takes a random attack from 'possible_attacks'.  
  113.     if (GetGlobal("Soul") == 1 and Current_Turn <= #Attack_Order) then
  114.         Current_Turn = Current_Turn + 1
  115.         SetGlobal("Current_Turn", Current_Turn)
  116.         nextwaves = { Attack_Order[Current_Turn] }
  117.     elseif (GetGlobal("Soul") == 1 and Current_Turn >= 7) then      
  118.         nextwaves = { Random_Attacks[math.random(#Random_Attacks)] }
  119.         starttime = Time.time
  120.         currenttime = 0
  121.     end
  122. end
  123.  
  124. function DefenseEnding() --This built-in function fires after the defense round ends.
  125.     encountertext = RandomEncounterText() --This built-in function gets a random encounter text from a random enemy.
  126.     Audio["RESETDICTIONARY"] = "dogsecret"
  127. end
  128.  
  129. function HandleSpare()
  130.      State("ENEMYDIALOGUE")
  131. end
  132.  
  133. function HandleItem(ItemID)
  134.     if ItemID == "PIE" then
  135.         Player.Heal(99)
  136.         BattleDialog({"You eat the Butterscotch Pie.[w:10]\nYou HP was maxed out!"})
  137.         itemsused = itemsused + 1
  138.     end
  139.     if ItemID == "MNSTRCNDY" then
  140.         Player.Heal(10)
  141.         BattleDialog({"You eat the Monster Candy.[w:10]\nYou recovered 10 HP!"})
  142.         itemsused = itemsused + 1
  143.     end
  144.     if ItemID == "SPIDRDONT" then
  145.         Player.Heal(12)
  146.         BattleDialog({"Don't worry, spider didn't."})
  147.         itemsused = itemsused + 1
  148.     end
  149.     if ItemID == "SPIDRCIDR" then
  150.         Player.Heal(24)
  151.         BattleDialog({"You drank the Spider Cider.[w:10]\nYou recovered 24 HP!"})
  152.         itemsused = itemsused + 1
  153.     end
  154. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement