[ad_1]
First a warning, then some recommendation.
The final time I wanted to implement a system like this, I used to be not utilizing an engine initially supposed for MMO-like functions. The quest system it shipped with was geared for single-player endeavours, and couldn’t be used.
I ended up having to stuff scripts on all of the objects concerned with the quests kind of by hand, like this (pseudocode):
Lever004_on_activate() {
if isOnQuest(participant, QUEST_0012) do_something();
if isOnQuest(participant, QUEST_0015) do_something_else();
}
This is a whole nightmare. There is not any approach to determine how the hunt works with out scavenging all via the sport. Do not do that.
I’d suggest making a system the place the complete quest (line) is represented as a finite state machine, with occasions to examine for transitions and scripts to react to mentioned transition. That makes it simple to maintain monitor of the place you might be in a given quest (line) and retains all quest state neatly encapsulated.
If you need, you may make a library of scripts/script templates in your world editor for frequent occurrences (participant talks to NPC, participant kills mob, and so forth.)
I’d not fear an excessive amount of about script efficiency, so long as you don’t hearth your occasion scripts too typically. As a rule of thumb, scripts ought to hearth not less than an order of magnitude lower than the “core” sport logic (animation, physics and so forth). They ought to react to occasions, as an alternative of firing periodically to examine if a situation has been met.
[ad_2]