EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Progressive Task? (https://www.eqemulator.org/forums/showthread.php?t=31759)

cylynex2 07-30-2010 07:35 PM

Progressive Task?
 
Have a new task I made, I'd like it to not unlock the 2nd task until the first one is completed.

How would I go about this? If there's a task in the peqdb already that does this, or if it's in a pl file, if someone could just name them I can go off that. I'm not familiar with the actual tasks as I dislike doing quests myself ;)

I did create task sets, but when I trigger the task event with the NPC, she just offers me a choice of any task in the set.

Edit: I created a task array in the npc's .pl file, all I need to know is how i can check if the PC has completed the prior quest. I see that info in the completed_tasks table, I'm just not sure how to get at it from the perl file.

thanks

cylynex2 07-30-2010 08:57 PM

NM, found it.

http://www.eqemulator.net/wiki/wikka...SystemTaskSets

cylynex2 07-31-2010 07:38 PM

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.

cylynex2 07-31-2010 08:51 PM

Tried adding this: $nexttask = quest::nexttaskinset(11,$taskid); to get the next ID but it's breaking the script atm. taskid is set manually to a task id in the taskset for now.

cylynex2 08-01-2010 12:30 AM

In case anyone else was having trouble with it, here's a copy of working code that does progressive quests. Change your taskids for the flavor text and the taskset IDs.

Code is pretty messy, there's a lot of comments and debug text, but you get the idea.

Code:

# This example is based on a TaskSet (TaskSet 12), which consists of tasks 120, 121, 122, 123 and 124
#
# 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(12);
        $donecount = quest::completedtasksinset(12);
                #$nexttaski = quest::nexttaskinset(12);
                $lasttask = quest::lasttaskinset(12);
                $activespeaktask = quest::activespeaktask();
                #$completed = quest::completedtasksinset(12);
        #quest::say("You have $activecount active tasks and $donecount completed tasks in task set 12");
                #quest::say("last task in set is $lasttask");
                #quest::say("Next task is $nexttaski");
                #quest::say("Completed: $completed");
                #quest::say("activespeak task is $activespeaktask");
        if(!quest::istaskcompleted(quest::lasttaskinset(12))) {
                # If the player has no tasks enabled for this task set, enable the first one
                if(quest::enabledtaskcount(12) == 0) {
                        quest::say("You have not done any of my tasks before!");
                        quest::enabletask(quest::firsttaskinset(12));
                }
                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();
                                                #quest::say("and the task nubmer thing is $task");
                        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(12)) {
                                                quest::say("Well done, I have another task if you are willing.");
                                                #quest::enabletask(quest::nexttaskinset(12, $task));
                                                                                                quest::say("Ok past quest 1, need to find next quest in set.");
                                                                                                #$firsttask = firsttaskinset(12);
                                                                                                #quest::say("First Task in this set is $firsttask");
                                             
                                        }
                                        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(12) == 0) {
                                        $first = quest::firsttaskinset(12);
                                        #quest::say("FIRST TASK IN SET WAS $first");
                                        $completed = quest::completedtasksinset(12);
                                        #quest::say("NUMBER COMPLETED IN SET IS $completed");
                                        $nexttask = $first + $completed;
                                        #quest::say("NEXT TASK ID WILL BE $nexttask");
                                        $lasttask = quest::lasttaskinset(12);
                                        #quest::say("Last task in this set has to be $lasttask");
                                        if ($nexttask <= $lasttask) {
                                                quest::say("pop task $nexttask");
                                                if ($nexttask == 218) {
                                                        quest::say("These damn kobolds killed me!  What? NO I DO NOT DIE TO EVERY MOB THAT COMES ALONG.  Now as I was saying....Let's get some revenge.");
                                                } if ($nexttask == 219) {
                                                        quest::say("Just don't bring me Kiri...I want one that heals....");
                                                } if ($nexttask == 220) {
                                                        quest::say("Have I told you about my love for tennis?  Man I could talk about that all day....OK OK...Let's try this next...");
                                                } if ($nexttask == 221) {
                                                        quest::say("The King! I bet my wife has a quest just like this one!");
                                                } if ($nexttask == 222) {
                                                        quest::say("I'm not talking about Elvis or Mal here.");
                                                } if ($nexttask == 223) {
                                                        quest::say("I really have to get back to the court, so I'm just gonna toss this out. This will take you a while.");
                                                }else {
                                                        quest::say("Let's do another one!");
                                                }
                                                quest::enabletask($nexttask);
                                                quest::taskselector($nexttask);
                                        } else {
                                                quest::say("done!");
                                        }
                    #quest::tasksetselector(12);
                }
        }
        else {
                quest::say("Hail, Slayer of Gobbies!");
        }
}



All times are GMT -4. The time now is 01:41 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.