Queuing vaccination action

9 views
Skip to first unread message

William Gatens

unread,
Feb 15, 2012, 5:05:34 PM2/15/12
to corsix...@googlegroups.com
Hello!

Hopefully I can find the words to explain my problem... here goes.

I am working on epidemics and have created an action called vaccinate, at the moment it just prints the distance between the nurse and any infected patient, 
however sometimes after the method is called especially if I enable the must_happen flag, the action queue ( on click ) says the nurse is doing the action but she is just walking on the spot or repeating and action like opening and closing the cupboard door in the pharmacy. 

My questions:

1) Any explanation of why is behavior is happening? I assume it's something to do with the queuing of actions, if a nurse does not have a "vaccinate" action in her queue I add it, this is on every tick (possible issue)
2) Is there a way to ensure I do not interrupt the nurses treating patients when setting an action.
3) Unrelated but is there a standard way to wait a few seconds before performing another action, specifically I want to set the mood icon to something *pause 2 seconds* set it to something else, my attempts have crashed the game so far.

My files:

Vaccinate action: http://pastebin.com/0BaMbkJP



Thanks,

William (sadger) Gatens

Edvin Linge

unread,
Feb 16, 2012, 7:30:54 AM2/16/12
to corsix...@googlegroups.com
Hi!
 
1) How do you add your action to the action queue? E.g. queueAction, setNextAction? One way could be to incorporate vaccinate calls in the calls dispatcher and possibly add priorities to calls. Do Nurses in TH prioritize vaccination even if there is a queue to the room they’re in.
2) setNextAction tries to abort all actions, queueAction adds actions to the end of the current queue. The function isIdle checks if a staff member is free for other duties.
3) One thing you can do, depending on which exact behaviour you want, is to add an idle action with a specified duration.
 
/Edvin

William Gatens

unread,
Feb 16, 2012, 3:58:19 PM2/16/12
to corsix...@googlegroups.com
Well I had a look and the problem seems to be that if I set the vaccinate action to be the next one (setNextAction({name = "vaccinate"})  and the queue is empty then the nurses don't know what to do next, I can remedy this by doing something like humanoid:queueAction({name="meander", 0}) causing the nurse to wander around again, but if I then queue vaccination again she never seems to perform it again.

Which is the most straight forward way to do the following:

Do vaccination action
Do meander for 5 ticks (or a reasonable amount)
Attempt to do the vaccination action again

After I set the nurse to meander again I actively call setNextAction with vaccinate action again but the queue seems to look like:

Actions:
idle  must_happen  
meander    
vaccinate  must_happen  

But the vaccinate action doesn't seem to be called again, the nurse keeps meandering then idle and so on.

Any insight will be appreciated probably using something incorrectly or there is an easy way around it.

Thanks,

Sadger

William Gatens

unread,
Feb 16, 2012, 4:16:46 PM2/16/12
to corsix...@googlegroups.com
Made a little progress including the vaccination in the meander action, similar to how the handyman checks for garbage. Ideally i'd like to separate it into it's own action. Probably my understanding of the queuing system :P.

Edvin Linge

unread,
Feb 17, 2012, 3:23:22 AM2/17/12
to corsix...@googlegroups.com
I hope you  can make sense of my thoughts below, don’t hesitate to ask more questions. Smile I haven’t looked at your files yet, but if you ask specific questions about segments I can check it out and help you.
 
 
There are two ways currently employed when it comes to different types of actions. Short interruptions such as yawning, checking watch, buying a soda are inserted into the queue, leaving the “real” actions in it. Longer interruptions like going to the toilet or the staffroom, and the normal flow of actions is to just queue new ones. So that the queue contains a set of actions describing a specific task. For example “I’m going to a room” means just the walk action. As soon as the humanoid enters the room, said room decides which actions to do next. “I’m queueing for a room” on the other hand means some different sets of actions, for example use_object, queue, walk.
 
Since vaccination is a long interruption I agree and suggest that you make it its own action, and that the queue contains only the “vaccination” type of actions, eg walk, vaccinate.
 
The flow could be something like:
Epidemic errupts.
All patients needing vaccine call for a nurse via the calls dispatcher.
Nurses who are free answer calls, preferably in order of proximity.
 
A single nurse’s flow of actions could be:
walk towards the patient
vaccinate
check if there are more calls, otherwise meander.
 
It isn’t imperative that you use the calls dispatcher, but I actually think it’s easier in the long run. Especially when it comes to keeping track of affected patients.
Proximity isn’t that important in the first implementation either.
 
There are two things that need some thought:
1. Patients walk around, how do we make a good walk action that changes its destination as time expires?
2. What do we do if the patient is in a room?
 
/Edvin
Sent: Thursday, February 16, 2012 10:16 PM
Subject: Re: Queuing vaccination action
 
wlEmoticon-smile[1].png

MarkL

unread,
Feb 27, 2012, 3:32:55 PM2/27/12
to CorsixTH Development
In TH patients that enter a diag room are vaccinated by the doctor.
Nurses will always leave the rooms they are in and wander the
corridors until all patients have been vaccinated, which I always
found annoying if the treatment that was then required, needed the
nurse in the pharmacy
I don't recall an actual animation for the vaccination, it was more of
as she went past the patient that the icon changed for that patient

If you want anything checking in TH just let me know


On Feb 16, 9:16 pm, William Gatens <westfor...@gmail.com> wrote:
> Made a little progress including the vaccination in the meander action,
> similar to how the handyman checks for garbage. Ideally i'd like
> to separate it into it's own action. Probably my understanding of the
> queuing system :P.
>
> On Thu, Feb 16, 2012 at 8:58 PM, William Gatens <westfor...@gmail.com>wrote:
>
>
>
> > Well I had a look and the problem seems to be that if I set the vaccinate
> > action to be the next one (setNextAction({name = "vaccinate"})  and the
> > queue is empty then the nurses don't know what to do next, I can remedy
> > this by doing something like humanoid:queueAction({name="meander", 0})
> > causing the nurse to wander around again, but if I then queue vaccination
> > again she never seems to perform it again.
>
> > Which is the most straight forward way to do the following:
>
> > Do vaccination action
> > Do meander for 5 ticks (or a reasonable amount)
> > Attempt to do the vaccination action again
>
> > After I set the nurse to meander again I actively call setNextAction with
> > vaccinate action again but the queue seems to look like:
>
> > Actions:
> > idle  must_happen
> > meander
> > vaccinate  must_happen
>
> > But the vaccinate action doesn't seem to be called again, the nurse keeps
> > meandering then idle and so on.
>
> > Any insight will be appreciated probably using something incorrectly or
> > there is an easy way around it.
>
> > Thanks,
>
> > Sadger
>
> > On Thu, Feb 16, 2012 at 12:30 PM, Edvin Linge <edvin.li...@gmail.com>wrote:
>
> >>   Hi!
>
> >> 1) How do you add your action to the action queue? E.g. queueAction,
> >> setNextAction? One way could be to incorporate vaccinate calls in the calls
> >> dispatcher and possibly add priorities to calls. Do Nurses in TH prioritize
> >> vaccination even if there is a queue to the room they’re in.
> >> 2) setNextAction tries to abort all actions, queueAction adds actions to
> >> the end of the current queue. The function isIdle checks if a staff member
> >> is free for other duties.
> >> 3) One thing you can do, depending on which exact behaviour you want, is
> >> to add an idle action with a specified duration.
>
> >> /Edvin
>
> >>  *From:* William Gatens <westfor...@gmail.com>
> >> *Sent:* Wednesday, February 15, 2012 11:05 PM
> >> *To:* corsix...@googlegroups.com
> >> *Subject:* Queuing vaccination action
>
> >> Hello!
>
> >> Hopefully I can find the words to explain my problem... here goes.
>
> >> I am working on epidemics and have created an action called vaccinate, at
> >> the moment it just prints the distance between the nurse and any infected
> >> patient,
> >> however sometimes after the method is called especially if I enable the
> >> must_happen flag, the action queue ( on click ) says the nurse is doing the
> >> action but she is just walking on the spot or repeating and action like
> >> opening and closing the cupboard door in the pharmacy.
>
> >> My questions:
>
> >> 1) Any explanation of why is behavior is happening? I assume it's
> >> something to do with the queuing of actions, if a nurse does not have a
> >> "vaccinate" action in her queue I add it, this is on every tick (possible
> >> issue)
> >> 2) Is there a way to ensure I do not interrupt the nurses treating
> >> patients when setting an action.
> >> 3) Unrelated but is there a standard way to wait a few seconds before
> >> performing another action, specifically I want to set the mood icon to
> >> something *pause 2 seconds* set it to something else, my attempts have
> >> crashed the game so far.
>
> >> My files:
>
> >> Vaccinate action:http://pastebin.com/0BaMbkJP
> >> Epidemic class:http://pastebin.com/Lgr21sPg
>
> >> Thanks,
>
> >> William (sadger) Gatens- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages