Auto-translated
1. function SkullEndFinal(player, answer)
if answer == 1 then
Trigger(OBJECT_TOUCH_TRIGGER, "HutSkullQuest", "SkullPusty")
MessageBox (path.."endend.txt")
sleep(2)
RemoveArtefact(heroichik, 83)
SetPlayerResource(PLAYER_1, 6, GetPlayerResource(PLAYER_1, 6) + 60000)
SetPlayerResource(PLAYER_1, 2, GetPlayerResource(PLAYER_1, 2) + 50)
sleep(2)
SetObjectiveState("SkullQuest", OBJECTIVE_COMPLETED)
elseif answer == 2 then
Trigger(OBJECT_TOUCH_TRIGGER, "HutSkullQuest", "SkullPusty")
MessageBox (path.."endend.txt")
sleep(2)
RemoveArtefact(heroichik, 83)
ChangeHeroState(heroichik, 4, 5)
sleep(2)
SetObjectiveState("SkullQuest", OBJECTIVE_COMPLETED)
elseif answer == 3 then
Trigger(OBJECT_TOUCH_TRIGGER, "HutSkullQuest", "SkullPusty")
MessageBox (path.."endend.txt")
sleep(2)
RemoveArtefact(heroichik, 83)
AddHeroCreatures(heroichik, CREATURE_DEMILICH, 45)
sleep(2)
SetObjectiveState("SkullQuest", OBJECTIVE_COMPLETED)
end
end
With options 1 and 3, everything works as expected, but with option 2, it throws an error.
The error occurs at ChangeHeroState(heroichik, 4, 5).
2. spells = {SPELL_MASS_WEAKNESS, SPELL_MASS_SLOW, SPELL_MASS_CURSE, SPELL_UNHOLY_WORD} How can I make it cast a random spell?