index nil value
i've got the error chunk_2:(29,17-159): attempt to index a nil value i don't know what i did wrong. Can someone help. -- A basic monster script skeleton you can copy and modify for your own creations. comments = {"Smells like the work\rof an enemy stand.", "Poseur is posing like his\rlife depends on it.", "Poseur's limbs shouldn't be\rmoving in this way."} commands = {"Quack", "Laugh", "Insult"} randomdialogue = {"Random\nDialogue\n1.", "Random\nDialogue\n2.", "Random\nDialogue\n3."}
sprite = "angrydon" --Always PNG. Extension is added automatically.
name = "Donald Duck"
hp = 100
atk = 1
def = 1
check = "Quack... Wait, he can talk."
dialogbubble = "right" -- See documentation for what bubbles you have available.
canspare = false
cancheck = true
-- Happens after the slash animation but before
function HandleAttack(attackstatus)
if attackstatus == -1 then
-- player pressed fight but didn't press Z afterwards
else
enemies[1].Call('SetSprite', "hitdon")
end
end
-- This handles the commands; all-caps versions of the commands list you have above.
function HandleCustomCommand(command)
if command == "QUACK" then
BattleDialog{("You said quack.")}
enemies[1].Call('currentdialogue', {"Wait...[func:SetSprite,surpdon]", "You're a duck too?", "Well...[func:SetSprite,sparedon]", "I guess i will\nspareyou"})
enemies[1].SetVar('def', -666666)
nextwaves = {}
enemies[1].SetVar('canspare', true)
elseif command == "LAUGH" then
BattleDialog{("You laughed.")}
enemies[1].Call('currentdialogue', {"Wait...[func:SetSprite,surpdon]", "You think i am funny?", "Well...[func:SetSprite,sparedon]", "I kinda am", "I guess i will\nspareyou"})
enemies[1].SetVar('def', -666666)
nextwaves = {}
enemies[1].SetVar('canspare', true)
elseif command == "INSULT" then
BattleDialog{("You said ducks\nare stupid")}
enemies[1].Call('currentdialogue', {"Ducks have feelings too!"})
end
end
P.S. if it is a really obvious mistake, then the reason is that i'm new with coding
Posted Jun 3, 2017, 4:46 PM UTC
035