View Single Post
  #23  
Old 08-10-2008, 02:38 PM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

I've been beavering away at this since Friday and thought I would provide an update on what I have functional so far:

Database Load routine for global task data
Database Load/Save for character task data

The database save is synchronous, but it only writes out anything that has been changed. I'll have to see if this can be done asynchronously like the saving of the other character data is.

Active task information is sent to the client when it enters a zone and so is retained across logins and zoning.

Initial Perl interface to bring up the Task Chooser with a list of up to 10 tasks:

The way I have it working right now, is the NPC has a list of all the tasks he can offer ($tasklist). It then checks whether the player already has each task in the list already assigned, (quest::istaskactive) and thus builds up a list of tasks it will offer ($tasksoffered), not including any tasks already active. quest::taskchooser then brings up the task selector window.

Code:
@tasklist =(1,2);
$tasksoffered = "";
foreach $task(@tasklist) {
	if(!quest::istaskactive($task)) {
		if($tasksoffered eq "") {
			$tasksoffered = $task;
        	}
                else {
                	$tasksoffered = $tasksoffered . "," . $task;
	        }
	}
}
if($tasksoffered ne "") {
	quest::taskchooser(eval($tasksoffered));
}
I have also added a new sub EVENT_TASKACCEPTED. This tells the NPC what task you accepted, so it can respond appropriately, summon an item etc. (When you accept the Children of the Fay task, you are given an Elven Bottle of Wine that you have to deliver).

Code:
sub EVENT_TASKACCEPTED {
        quest::say("You accepted task $task_id");
        if($task_id eq "1") {
                quest::summonitem(36078);
        }
}
You can remove a task by clicking the Remove button in the Task Journal window.

Two more Perl quest functions, quest::istaskactivityactive(taskid, activityid) and quest::flagtaskactivitycomplete(taskid, activityid).

This code checks when you hand in the Elven Bottle of Wine to see if you are on activity 0 of the Children of the Fay task (task 1), and if so, accepts the item, and flags that activity complete, sending the 'Task Stage completed' message, and unlocking the next activity:

Code:
sub EVENT_ITEM {
        if (plugin::check_handin(\%itemcount, 36078 => 1)) {
                if(quest::istaskactivityactive(1,0)) {
                        quest::say("Thank You!");
                        quest::flagtaskactivitycomplete(1,0);
                }
I'm still undecided about how to implement the predecessor activity requirements. E.g. say a task has 10 activities and when you completed activity 1, activities 2 and 3 open up. Task 4 then won't open up until tasks 2 and 3 are complete.

As I see it, I can either put a limit on how many predecessors an activity can have (let's say 4), and then have four columns in the table, predecessor1, predecessor2, etc.

Or, have a text field which could contain a comma separated list of predecessors, e.g. "2,3". I dislike this because it means I have to parse the string to get at the predecessor info.

I'm leaning toward option 1 (a fixed, small number of predecessors and having a column for each).

Still lots left to do!
Reply With Quote