[ create a new paste ] login | about

Link: http://codepad.org/gOP3ngQd    [ raw code | fork ]

Lua, pasted on Jan 4:
-- A basic encounter script skeleton you can copy and modify for your own creations.

music = "---" --Always OGG or WAV. Extension is added automatically. Remove the first two lines for custom music.
encountertext = "You feel like you're going to\nhave a bad time." --Modify as necessary. It will only be read out in the action select screen.
nextwaves = {"ACTIONSELECT"}
wavetimer = 4.0
arenasize = {155, 130}


enemies = {
"sans"
}

enemypositions = {
{0, 0}
}



-- A custom list with attacks to choose from. Actual selection happens in EnemyDialogueEnding(). Put here in case you want to use it.
possible_attacks = {"bullettest_chaserorb","Speak","ACTIONSELECT"}



function EncounterStarting()
    -- If you want to change the game state immediately, this is the place.)
	--currentdialogue = {"One","Two"}
	
	SetGlobal('phase', 0)
    State("ENEMYDIALOGUE")

	
	
	
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.
	local phase = GetGlobal("phase")
 
    if phase == 0 then
        SetDialogue({"[[effect:none][noskip][font:sans]it's a beautiful\nday outside.",
			"[effect:none][noskip][font:sans]birds are singing,\nflowers are\nblooming...",
			"[effect:none][noskip][font:sans]on days like these,\nkids like you...",
			"[font:monster][novoice][noskip][waitall:2]Should\nbe\nburning\nin hell."})
    elseif phase == 1 then
        SetBubble("rightwide")
        SetDialogue({"[font:sans]huh",
            "[font:sans]always wondered why\npeople never use\ntheir strongest\nattack first"})
    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'.
	--if i == 1 then
	--	nextwaves = { possible_attacks[math.random(#possible_attacks)] }
	--	nextwaves = {"Speak"}
	--	i = 0
	--else
	--	nextwaves = { possible_attacks[math.random(#possible_attacks)] }
	--end
    local phase = GetGlobal("phase")
    if phase == 0 then
        nextwaves = {"Speak"} -- the first attack wave
    elseif phase == 1 then
        nextwaves = {"ACTIONSELECT"} -- make a wave script that only has 'function Update() State("ACTIONSELECT") end' in it
        SetGlobal('phase', 2)
    end
end

function DefenseEnding() --This built-in function fires after the defense round ends.

	encountertext = RandomEncounterText() --This built-in function gets a random encounter text from a random enemy.
	
end

function HandleSpare()
     State("ENEMYDIALOGUE") --By default, pressing spare only spares the enemies but stays in the menu. Changing state happens here.
end

function HandleItem(ItemID)
    BattleDialog({"Selected item " .. ItemID .. "."})
end

function SetBubble(bubble)
    enemies[1].SetVar('dialogbubble', bubble)
end
 
function SetDialogue(dialogues)
    enemies[1].SetVar('currentdialogue', dialogues)
end


Output:
No errors or program output.


Create a new paste based on this one


Comments: