Auto-translated
Hello. Mapmakers, can you tell me how to create a quest with questions, similar to a "yes" or "no" format, but where the question is only displayed if the hero's army has a specific number of creatures?
New here? I'm Roha — want a quick tour?
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
endfunction 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
endprogress = GetObjectiveProgress("obj_alh", 1);
function func_alh_complite ()
if (progress == 1)
then MessageBox ("/Maps/SingleMissions/Vayshan0_1/mess_alh_complite.txt");
SetObjectiveProgress("obj_alh", OBJECTIVE_COMPLETED);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "reg_alh_complite", nil);
end;
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "reg_alh_complite", "func_alh_complite");
zog = GetHeroCreature("Ohtarig", 129)
function func_log ()
if (zog == 1)
then MessageBox("/Maps/SingleMissions/Vayshan0_1/mess_log1.txt");
SetObjectiveState("obj_log", OBJECTIVE_ACTIVE);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "reg_log", "func_log");
else MessageBox("/Maps/SingleMissions/Vayshan0_1/mess_log.txt");
sleep(1);
StartCombat("Ohtarig", nil, 1, 129, 1, nil,"func_remove_log",nil, not nil);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "reg_log", nil);
end;
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "reg_log", "func_log");
function BindTriggerToObject(object, handler)
Trigger(OBJECT_TOUCH_TRIGGER, object, handler)
end
RPGEngine.Init = function()
for i, player in players do
for j, object in player.RPG.BUILDINGS do
local handler = 'EnterBuilding('..player.key..", "..'"'..object.key..'")'
BindTriggerToObject(object.name, handler)
end
end
endplayer is a table that needs to be passed as a parameter to the handler. The handler for the object_touch trigger is currently passed as a string (as in the example).