Free the prisoner slot when something happen

Discussion about Mods for Prison Architect

Moderator: NBJeff

neoxes
level1
level1
Posts: 29
Joined: Mon Aug 26, 2013 10:49 am

Free the prisoner slot when something happen

Postby neoxes » Mon Oct 10, 2016 10:18 am

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?
murgh
level2
level2
Posts: 229
Joined: Sat Jan 30, 2016 11:52 am

Re: Free the prisoner slot when something happen

Postby murgh » Mon Oct 10, 2016 9:44 pm

So <somecondition> should check if his needs are completely settled before releasing, no?
neoxes
level1
level1
Posts: 29
Joined: Mon Aug 26, 2013 10:49 am

Re: Free the prisoner slot when something happen

Postby neoxes » Mon Oct 10, 2016 11:26 pm

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

Return to “Modding”

Who is online

Users browsing this forum: No registered users and 1 guest