View Single Post
  #3  
Old 07-31-2010, 07:38 PM
cylynex2
Sarnak
 
Join Date: Jul 2010
Posts: 36
Default

Unless I'm missing something, this script doesnt actually seem to work. The problem seems to be that it returns the same ID as the active / last completed quest as the next one, which is completed and not repeatable, causing the NPC to not actuall pop the next quest. If i put an if statement in to manually tell it to pop task 213 (the next task in the taskset) that works.

Code:
# This example is based on a TaskSet (TaskSet 200), which consists of tasks 2000, 2001, 2002, 2003 and 2004
#
# The tasks are designed to be performed sequentially. Once one task is completed it cannot be selected again
# and the next task in the sequence is made available.
#
sub EVENT_TASKACCEPTED {
        quest::say("You accepted task $task_id");
}

sub EVENT_SAY {
        # If the player hasn't completed the last task in the TaskSet
        #$activecount = quest::activetasksinset(200);
        #$donecount = quest::completedtasksinset(200);
        #quest::say("You have $activecount active tasks and $donecount completed tasks in task set 200");
        if(!quest::istaskcompleted(quest::lasttaskinset(200))) {
                # If the player has no tasks enabled for this task set, enable the first one
                if(quest::enabledtaskcount(200) == 0) {
                        quest::say("You have not done any of my tasks before!");
                        quest::enabletask(quest::firsttaskinset(200));
                }
                else {
                        # The player is enabled for a task in this TaskSet. Is he at the point
                        # in the task where he needs to speak to this NPC ?
                        $task = quest::activespeaktask();
                        if($task != 0) {
                                # If task != 0, then the player needs to speak to me, find out which activity it is
                                $activity = quest::activespeakactivity($task);
                                # Mark the activity as complete
                                #quest::say("Updating task $task activity $activity");
                                quest::updatetaskactivity($task, $activity);
                                quest::say("Well done!");
                                # If the task is now complete, offer the next task, if there is one
                                if(!quest::istaskactive($task)) {
                                        quest::disabletask($task);
                                        if($task != quest::lasttaskinset(200)) {
                                                quest::say("Well done, I have another task if you are willing.");
                                                quest::enabletask(quest::nexttaskinset(200, $task));
                                               
                                        }
                                        else {
                                                quest::say("Thank you for cleansing Qeynos Hills!");
                                        }
                                }
                        }
                        else {
                        }
                }
                # Bring up the task selector, only if the player has no active tasks in this set.
                if(quest::activetasksinset(200) == 0) {
                        quest::tasksetselector(200);
                }
        }
        else {
                quest::say("Hail, Hero of Qeynos!");
        }
}
Tried adding this: $nexttask = quest::nexttaskinset(11); to get the next ID but it's breaking the script atm.
Reply With Quote