Cleaned up the new scripting code. Added a helper function to do the yielding automatically. Modified all the scripts to use the new system and added a few new ones.

This commit is contained in:
Filip Maj 2016-06-19 18:52:34 -04:00
parent 51bbf4ae2e
commit 8743042950
28 changed files with 316 additions and 167 deletions

View file

@ -1,11 +1,10 @@
require ("global")
function init(npc)
return false, false, 0, 0;
end
function onEventStarted(player, npc, triggerName)
player:RunEventFunction("bookTalk");
player:callClientFunction(player, "bookTalk");
player:EndEvent();
end
function onEventUpdate(player, npc, step, menuOptionSelected)
player:EndEvent();
end

View file

@ -1,25 +1,21 @@
require ("global")
function init(npc)
return false, false, 0, 0;
end
function onEventStarted(player, npc, triggerName)
player:RunEventFunction("askLogout", player);
end
function onEventUpdate(player, npc, eventStep, menuOptionSelected)
choice = callClientFunction(player, "askLogout", player);
if (menuOptionSelected == 1) then
player:EndEvent();
return;
elseif (menuOptionSelected == 2) then
if (choice == 2) then
player:QuitGame();
elseif (menuOptionSelected == 3) then
elseif (choice == 3) then
player:Logout();
elseif (menuOptionSelected == 4) then
elseif (choice == 4) then
player:SendMessage(33, "", "Heck the bed");
end
end
player:EndEvent();
end

View file

@ -1,3 +1,4 @@
require ("global")
function init(npc)
return false, false, 0, 0;
@ -5,15 +6,11 @@ end
function onEventStarted(player, npc, triggerName)
defaultFst = GetStaticActor("DftFst");
player:RunEventFunction("delegateEvent", player, defaultFst, "defaultTalkWithInn_ExitDoor", nil, nil, nil);
end
function onEventUpdate(player, npc, resultId, isExitYes)
if (isExitYes ~= nil and isExitYes == 1) then
choice = callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithInn_ExitDoor", nil, nil, nil);
if (choice == 1) then
GetWorldManager():DoZoneChange(player, 1);
else
player:EndEvent();
end
player:EndEvent();
end

View file

@ -1,9 +1,3 @@
function init(npc)
return false, false, 0, 0;
end
function onEventStarted(player, npc, triggerName)
end
function onEventUpdate(player, npc)
end

View file

@ -16,23 +16,80 @@ eventTalkChangeOne(skipQuestion)
talkOfferMaxOver()
askRetryRegionalleve(guildLeveId, leveAllowances);
Menu Ids:
--]]
require ("global")
function init(npc)
return false, false, 0, 0;
end
function onEventStarted(player, npc)
player:RunEventFunction("eventTalkType", 0x30, true, 0x02CE, 0x356, 0x367, true, 0, nil, 0x29, 0,0,0);
::MENU_LOOP::
menuChoice = callClientFunction(player, "eventTalkType", 0x30, true, 0x02CE, 0x356, 0x367, true, 0, nil, 0x29, 0,0,0);
--Battlecraft
if (menuChoice == 1) then
resultGLPack = callClientFunction(player, "eventTalkPack", 201, 207);
if (resultGLPack == nil) then
goto MENU_LOOP;
else
::CARDS_LOOP::
cards = {0x30C3, 0x30C4, 0x30C1, 0x30C5, 0x30C6, 0x30C7, 0x30C8, 0x30C9};
chosenGLCard = callClientFunction(player, "eventTalkCard", cards[1], cards[2], cards[3], cards[4], cards[5], cards[6], cards[7], cards[8]);
if (chosenGLCard == -1) then
goto MENU_LOOP;
else
wasAccepted = callClientFunction(player, "eventTalkDetail", cards[chosenGLCard], 0, 0xF4242, 0xD, 0xF4242, 0, 0, true, 0);
if (wasAccepted == true) then
end
goto CARDS_LOOP;
end
end
--FieldCraft Miner
elseif (menuChoice == 0x15) then
--FieldCraft Botanist
elseif (menuChoice == 0x16) then
--FieldCraft Fisher
elseif (menuChoice == 0x17) then
--FieldCraft Quit
elseif (menuChoice == 0x18) then
--Faction Broken Blade
elseif (menuChoice == 0x29) then
--Faction Shields
elseif (menuChoice == 0x2A) then
--Faction Horn and Hand
elseif (menuChoice == 0x2B) then
--Leve Evaluation
elseif (menuChoice == 5) then
--Tutorial
elseif (menuChoice == 6) then
--End of Info
elseif (menuChoice == 7) then
--Quit
elseif (menuChoice == 8) then
end
--
--
--
player:EndEvent();
end
function onEventUpdate(player, npc, step, menuOptionSelected)
--player:RunEventFunction("eventTalkType", 0x32, true, 0x02CE, 0x356, 0x367, false, 2, nil, 0x29, 0,0,0);
player:RunEventFunction("eventTalkPack", 201, 207);
--player:RunEventFunction("eventTalkCard", 0x30C3, 0x30C4, 0x30C1, 0x30C5, 0x30C6, 0x30C7, 0x30C8, 0x30C9);
--player:RunEventFunction("eventTalkDetail", 0x30C4, 2, 0xF4242, 0xD, 0xF4242, 0, 0xFF, true, 11);
--
--player:RunEventFunction("eventGLChangeDetail", 0xDEAD, 0x30C4, 0xFF, 0xF4242, 0xD, 0xF4242, 0, 2, true);
player:EndEvent();
end

View file

@ -1,28 +1,56 @@
--[[
PopulaceLinkshellManager Script
Functions:
eventTalkStep1(noLinkshellActive) - Says intro. If noLinkshellActive = true, say newbie stuff.
eventTalkStep2(noLinkshellActive) - Shows menu, if noLinkshellActive = true, only give ability to make linkshell.
eventTalkStepMakeupDone() - Confirm when creating LS
eventTalkStepModifyDone() - Confirm when modding LS
eventTalkStepBreakDone() - Confirm when deleting LS
--]]
require ("global")
function init(npc)
return false, false, 0, 0;
end
function onEventStarted(player, npc)
isNew = false;
player:RunEventFunction("eventTalkStep1", isNew);
function createLinkshell(name, crest)
end
function onEventUpdate(player, npc, step, menuOptionSelected, lsName, lsCrest)
if (menuOptionSelected == nil) then
player:EndEvent();
return;
end
isNew = false;
if (menuOptionSelected == 1) then
player:RunEventFunction("eventTalkStep2", isNew);
elseif (menuOptionSelected == 10) then
player:EndEvent();
return;
elseif (menuOptionSelected == 3) then
--createLinkshell
player:RunEventFunction("eventTalkStepMakeupDone", isNew);
end
function modifyLinkshell(name, crest)
end
function disbandLinkshell(name, crest)
end
function onEventStarted(player, npc, triggerName)
hasNoActiveLS = false;
callClientFunction(player, "eventTalkStep1", hasNoActiveLS);
command, lsName, crestId = callClientFunction(player, "eventTalkStep2", hasNoActiveLS);
--Create
if (result == 3) then
createLinkshell(lsName, crestId);
callClientFunction(player, "eventTalkStepMakeupDone");
--Modify
elseif (result == 1) then
modifyLinkshell(lsName, crestId);
callClientFunction(player, "eventTalkStepModifyDone");
--Disband
elseif (result == 5) then
disbandLinkshell(lsName, crestId);
callClientFunction(player, "eventTalkStepBreakDone");
end
player:endEvent();
end

View file

@ -0,0 +1,77 @@
--[[
PopulaceRetainerManager Script
Functions:
eventTalkStep1(true) - Intro tutorial if no retainer
newEventTalkStep1(sayIntro) - Seems to be a post-Tanaka version of the intro????
eventTalkStep2() - Choose retainer yourself (go to race select) or let npc do it
eventTaklSelectCutSeane(cutsceneName, actorClassId1, actorClassId2, actorClassId3, actorClassId4, actorClassId5) - Starts the advance cutscene to choose a retainer. 5 retainer actorClassId's are given.
eventTalkStep4(actorClassId) - Opens up the retainer naming dialog
eventTalkStepFinalAnswer(actorClassId) - Confirm Dialog
eventTalkStepError(errorCode) - Error dialog, 1: No Extra Retainers, 2: Server Busy.
eventTalkStepFinish()
--]]
require ("global")
function init(npc)
return false, false, 0, 0;
end
function onEventStarted(player, npc, triggerName)
introChoice = callClientFunction(player, "newEventTalkStep1", false);
if (introChoice == 1) then
raceChoice = callClientFunction(player, "eventTalkStep2");
while (true) do
if (retainerChoice == 0) then
raceChoice = callClientFunction(player, "eventTalkStep22");
end
if (raceChoice == 0) then
--Choose random actorId
elseif (raceChoice > 0) then
--Choose 5 random but correct actor ids
retainerChoice = callClientFunction(player, "eventTaklSelectCutSeane", "rtn0g010", 0x2DCB1A, 0x2DCB1A, 0x2DCB1A, 0x2DCB1A, 0x2DCB1A);
if (retainerChoice == -1) then
player:EndEvent();
return;
elseif (retainerChoice > 0) then
--Retainer chosen, choose name
retainerName = callClientFunction(player, "eventTalkStep4", 0x2DCB1A);
if (retainerName ~= "") then
confirmChoice = callClientFunction(player, "eventTalkStepFinalAnswer", 0x2DCB1A);
if (confirmChoice == 1) then
callClientFunction(player, "eventTalkStepFinish");
player:EndEvent();
return;
elseif (confirmChoice == 3) then
raceChoice = 0;
else
player:EndEvent();
return;
end
end
end
else
break;
end
end
end
player:EndEvent();
end

View file

@ -1,3 +1,5 @@
require ("global")
function init(npc)
return false, false, 0, 0;
end
@ -44,12 +46,10 @@ function onEventStarted(player, npc)
saySheetId = 19;
end
player:RunEventFunction("welcomeTalk", nil, saySheetId, player);
coroutine.yield();
callClientFunction(player, "welcomeTalk", nil, saySheetId, player);
while (true) do
player:RunEventFunction("selectMode", nil, npc:GetActorClassId(), false, 1000001); --Step 2, state your business
choice = coroutine.yield();
choice = callClientFunction(player, "selectMode", nil, npc:GetActorClassId(), false, 1000001); --Step 2, state your business
if (choice == 3) then
@ -60,17 +60,4 @@ function onEventStarted(player, npc)
end
end
function onEventUpdate(player, npc, step, menuOptionSelected)
--player:RunEventFunction("cashbackTalkCommand", 22004, 22004, 22004, 22004, 22004, 22004, 22004, 22004, 22004, 22004, 22004); --Refund Abilities???
--player:RunEventFunction("cashbackTalk", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); --Refund items???
if (menuOptionSelected == 4) then
player:EndEvent();
else
player:RunEventFunction("selectMode", nil, npc:GetActorClassId(), false, 1000001); --Step 2, state your business
end
end

View file

@ -29,11 +29,7 @@ finishTalkTurn() - Done at the end.
--]]
function callClientFunction(player, functionName, ...)
player:RunEventFunction(functionName, ...);
result = coroutine.yield();
return result;
end
require ("global")
function init(npc)
return false, false, 0, 0;