Individual quest timers help needed

03/29/2013 12:48 hacksaw#1
Can someone give me just a basic example of how you would do an individual timer for a quest pls, Say when the person accepts the quest they have 10 minutes to complete or they fail, Using trinity source.

Also is it possible to show a timer on screen say in the bottom corner like when you use a transformation skill counting down the 10minutes?

Thanks
03/29/2013 15:01 shadowman123#2
There is Thread checker for that inside Entity.cs ( as i remember ) called Timercallback ..code smthing like

if (Now >= client.JoinedQuestTime.AddMinutes(10)) { // ur cases }
Note : JoinedQuestTime is Time32 Instance and dont forget to set it to Time32.Now when player join
03/29/2013 23:33 pro4never#3
The most scalable method would be a single thread which handles client timeouts.

The thread code would look a little something like


while(ServerRunning)
{
Foreach(Player p in Players)
Foreach(Timout e in p.TimedEvents)
if(Now > e.ExpiresAt)
p.TimedEvents.Remove(e);
}


Something like that would be scalable (obviously requiring thread safe dictionaries so you can iterate on a copy of the collection while modifying the original copy) and work just fine. Creating a timer for every event for every client quickly starts to eat up memory for not much added benefit IMO.
03/30/2013 15:49 hacksaw#4
Cool thanks guys, Any ideas on if its possible to show a countdown timer on screen also so they can see how long they have left?
03/30/2013 16:26 pro4never#5
You can display specific numbers as an effect for sure but I also seem to remember a countdown packet that I used at one point.


I honestly cannot remember what the packet type was though so maybe someone else can be of more use :S

That being said... none of the countdown effects I've come across will be close to what you want. It would look clunky and bad (huge numbers in the center of the screen ticking down each and every second)

Timed quests + conquer = clunky IMO