Quote:
Originally Posted by joligario
Next suggestion:
Alter the task table to have minlevel and maxlevel fields
Create a bool function for CheckTaskLevel()
Create perl quest function quest::istaskappropriate(taskid)
With those, we could let the system do the level checks for us. Not really a big deal, but just might be handy.
|
I've just committed this. There are new minlevel and maxlevel columns in the task table. If either is zero, it is ignored, so you can have no level restriction, only a minimum level, or only a maximum level, or both.
The level restrictions are enforced in the TaskSelector (a Task won't be sent if it doesn't meet the restrictions).
To augment this, I have slightly altered the way Task Sets work. Previously you had to enable/disable tasks in a set on a per player basis.
Now, if you put a TaskID of zero in a Task Set (which is an invalid TaskID), all the tasks in that set will automatically be available for a player, subject to a level restrictions.
This means you can create a task set for an NPC with a bunch of tasks with different level ranges and just call quest::tasksetselector(set number), and let the task system decide which tasks to offer the client based on the level restrictions.
I have also added quest::istaskappropriate(taskid) if you want to have an NPC tailor what it says to a player based on that.