Jump to content
  • Create an account or sign in to use the shoutbox

    You need to be a member in order to be able to chat with other users.

Sign in to follow this  
twostars

Our quest script generator

Recommended Posts

Knight Online has a lot of quests. Like, a lot. Hundreds, if not thousands.
In part, this is due to the fact most are doubled up per-nation, but still -- for a game that's praised for its PvP, it has a lot of quests.

Since their Reign of the Fire Drake expansion, their quest system was changed up considerably. All of their quests are now referenced in the client and a lot of the boilerplate logic has been wrapped up (it's still a horrible system though, but it's an improvement over the original).

When we got to the point with the server's development where we seriously started considering releasing a server, one of the first things that came to mind was how many quests there were, and how much of a daunting task that would be to implement them. Honestly, at this point I was desperate to find some way of not having to deal with writing these up manually -- because it was a colossal task, which would be prone to introducing bugs.

We realised that with the information provided, we could use this to automatically generate ~95% of quests automatically. There are outliers (for example, chain quests), but 95% of the hundreds of quests that exist is still huge.

So Aesteris mocked up the initial implementation of our quest script generator, to give us an idea of how we were approaching it. We ended up rewriting it after that, but now it generates every quest it can (and we fill in the rest), e.g. this simple quest (this one doesn't have class-specific logic; the generated output can get more complex than this):
 

------------------------
-- Quest: Hasten potion
-- Speed potion vial is awarded for 2 Apples of Moradon.
------------------------
function Event314_NotStarted()
	pUser:SelectMsg(4, 82, 315, 22, 315, 23, -1)
end

function Event315_Start()
	pUser:SaveEvent(82, 1)
end

function Event319_PendingReward()
	if pUser:CanRunQuestExchange(29) then
		pUser:SelectMsg(5, 82, 315, 10, 317, 27, -1)
	else
		pUser:SelectMsg(2, 82, 315, 10, -1)
	end
end

function Event317_Complete()
	if byEventStatus == 1 then
		pUser:SaveEvent(82, 3)
	elseif byEventStatus == 3 then
		if pUser:CheckExistEvent(82, 2) then
			return
		end

		if pUser:RunQuestExchange(29, bySelectedReward) then
			pUser:SaveEvent(82, 2)
		else
			pUser:SelectMsg(3, -1, 11, 10, -1)
		end
	end
end

Officially there are occasionally some quests which have extra filler text which this can't support (because it knows nothing about these extra steps), but they're often fluff and don't offer anything of importance. Most players probably even skip these, so they're never really a huge priority to support.

And that's our script generator. The thing that makes our quests possible (because I was never going to write those manually; you can't make me do it. Nope.).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×