Skip to content
User Avatar
#3385
Auto-translated
Hello, working class. The problem is this: I need to track the activation of a quest – the conditions are the story coefficient and whether the player has captured a city. Here's the code. I start the thread at the beginning of the script, but the game gives an error in the console when loading. What's wrong? Other threads run normally, but this one...
Value was NIL when getting global with name 'ActFinalSQ'
ERROR: StartThread first parameter must be a function
startThread(ActFinalSQ)

function ActFinalSQ()
if A == 2 and SetObjectOwner('humanTown2', 1) then
MessageBox("/Maps/SingleMissions/ChoiseOTW1/ActFSQ0.txt")
SetObjectPosition('AratF', 67, 67, 0)
SetObjectPosition('AstridaF', 69, 70, 0)
SetObjectPosition('LoggensF', 65, 70, 0)
sleep(2)
MoveCamera(67, 67, 0, 2, 1, 285, 1, 0)
sleep(10)
MessageBox("/Maps/SingleMissions/ChoiseOTW1/ActFSQ1.txt")
GetObjectiveState('FSQ', 1, OBJECTIVE_ACTIVE)
end
end


Added 39 minutes ago
And here's my second question. I don't understand how QuestionBox works. I'll present the code below. What I want is for dialogs to appear when interacting with an object, and these dialogs change depending on the in-game coefficient. At one point, a question box should be presented to the player, but at the same time, the function that is assigned to the question box when "OK" is pressed is executed, then the function for "CANCEL", and then, in addition, the action that is performed for a different coefficient. I'm already getting a headache because everything seems to work – the functions are executed, but not as they should! Please help me solve these problems – what needs to be changed?
function Ensleg() --dialog function
if B == 1 then -- first official meeting, dialog
MessageBox("/Maps/SingleMissions/ChoiseOTW1/ED1.txt")
sleep(2)
MessageBox("/Maps/SingleMissions/ChoiseOTW1/ED2.txt")
sleep(2)
MessageBox("/Maps/SingleMissions/ChoiseOTW1/ED3.txt")
sleep(2)
B = 5
if B == 5 then --asks about teleporting to the crypt
QuestionBox("/Maps/SingleMissions/ChoiseOTW1/EQ.txt", AEY(), AEN())
if B == 0 then -- meeting when the quest is not active.
MessageBox("/Maps/SingleMissions/ChoiseOTW1/ED0.txt")
if B == 2 then -- meeting after the fight in the crypt
SQFinal()
if B == 3 then -- meeting after completing the quest
MessageBox("/Maps/SingleMissions/ChoiseOTW1/EE.txt")
if B == 4 then -- if the player started a dialog near the crypt, it asks about returning.
QuestionBox("/Maps/SingleMissions/ChoiseOTW1/EQ2.txt", AEY2(), AEN())
end
end
end
end
end
end

Trigger(OBJECT_TOUCH_TRIGGER, "ensleg", "Ensleg");

function AEY() -- answer YES - teleport to the crypt
MessageBox("/Maps/SingleMissions/ChoiseOTW1/EN1.txt")
sleep(1)
MessageBox("/Maps/SingleMissions/ChoiseOTW1/EN2.txt")
sleep(1)
MessageBox("/Maps/SingleMissions/ChoiseOTW1/EN21.txt")
sleep(1)
MessageBox("/Maps/SingleMissions/ChoiseOTW1/EN3.txt")
sleep(2)
ETP()
end

function AEY2() --teleport home
SetObjectPosition('Ohtarig', 100, 84, 0, 2)
SetObjectPosition('ensleg', 102, 89, 0)
B = 5
end

function ETP() --refusal to teleport
SetObjectPosition('Ohtarig', 80, 169, 0, 2)
SetObjectPosition('ensleg', 80, 167, 0)
B = 4
end


Added 2 minutes ago
There's an incorrect comment at the very bottom – ETP – teleport to the crypt.
Автор карт:
Долина расхитителей
Выбор мира

Statistics

Welcome our newest member: wayal