Page 1 of 1

Free the prisoner slot when something happen

Posted: Mon Oct 10, 2016 10:18 am
by neoxes
Hello :)

I'd like to free the slot of a provider if some condition is met, someone can help me? This is my try:

Code: Select all

   if this.Slot0.i > -1 then
      thePrisoner = getObject("Prisoner",this.Slot0.i)
      if <...somecondition ...> then
                <...do something ... >
      else
         thePrisoner.Loaded = false
         thePrisoner.ClearRouting()
         this.Slot0.i = -1
         this.Slot0.u = -1
      end
   end


This way the prisoner effectively free the slot, but because his need is high, he suddenly find the free slot again and occupies it again. Any idea?

Re: Free the prisoner slot when something happen

Posted: Mon Oct 10, 2016 9:44 pm
by murgh
So <somecondition> should check if his needs are completely settled before releasing, no?

Re: Free the prisoner slot when something happen

Posted: Mon Oct 10, 2016 11:26 pm
by neoxes
murgh wrote:So <somecondition> should check if his needs are completely settled before releasing, no?


In theory, yes, in practise Needs.SomeNeed doesn't work... I can only use Needs.SomeNeed = 0...

Anyway, I think i find a solution... I spawn an object (out of service sign, lol) and put it on the slot. When the prisoner is near and the provider ready, i delete it. I can share the code if someone wants to see it and help me :D