Modding Help

Discussion about Mods for Prison Architect

Moderator: NBJeff

oxygencraft
level1
level1
Posts: 24
Joined: Wed Feb 18, 2015 6:53 am

Re: Modding Help

Postby oxygencraft » Tue Nov 10, 2015 8:06 am

Anyone?
User avatar
Brento666
level3
level3
Posts: 290
Joined: Wed Sep 02, 2015 9:23 pm

Re: Modding Help

Postby Brento666 » Tue Nov 10, 2015 6:16 pm

I am monitoring your doors current behavior in my facilities.

In the meantime, please take a look at the mod "Blast Doors"; It has a scripted door that's pretty complex. (You might learn something from it's innards, though it does also have some issues.)
oxygencraft
level1
level1
Posts: 24
Joined: Wed Feb 18, 2015 6:53 am

Re: Modding Help

Postby oxygencraft » Tue Nov 10, 2015 10:21 pm

Brento666 wrote:I am monitoring your doors current behavior in my facilities.

In the meantime, please take a look at the mod "Blast Doors"; It has a scripted door that's pretty complex. (You might learn something from it's innards, though it does also have some issues.)


I know that mod but i made a stronger door then that door.
User avatar
Brento666
level3
level3
Posts: 290
Joined: Wed Sep 02, 2015 9:23 pm

Re: Modding Help

Postby Brento666 » Wed Nov 11, 2015 3:24 am

So currently the door has quite some issues indeed.
-Placement was off by ~0.1 block in the opendirection :S
-Workmen would wait at a closed door

What I would suggest is, especially if your making a very strong door, to leave it without script and accept the limitation to guard access.
-> Such an unscripted door is very compatible with servos, so all staff can access it!
Place the door on the border to staff only zones and you have everything you'd want and need no?

I don't see this door script as very viable atm. If you wish to try further, then follow the earlier advise I gave. (increase the range slightly and/or force modes)
oxygencraft
level1
level1
Posts: 24
Joined: Wed Feb 18, 2015 6:53 am

Re: Modding Help

Postby oxygencraft » Wed Nov 11, 2015 6:26 am

Brento666 wrote:So currently the door has quite some issues indeed.
-Placement was off by ~0.1 block in the opendirection :S
-Workmen would wait at a closed door

What I would suggest is, especially if your making a very strong door, to leave it without script and accept the limitation to guard access.
-> Such an unscripted door is very compatible with servos, so all staff can access it!
Place the door on the border to staff only zones and you have everything you'd want and need no?

I don't see this door script as very viable atm. If you wish to try further, then follow the earlier advise I gave. (increase the range slightly and/or force modes)


Ok i decided i am fine with the guard only access but can i equip staff with jail keys so staff can open any door. And i also think i am going to make a rioting scenario but much more intense then the story one. I want different security prisoners to have different contraband. But its still fine if you cant help me make scenario mods. And also what does this.GetNearbyObjects even return if it is a value that i can handle in an if statement then i might be able to fix the door.
User avatar
Brento666
level3
level3
Posts: 290
Joined: Wed Sep 02, 2015 9:23 pm

Re: Modding Help

Postby Brento666 » Thu Nov 12, 2015 6:23 pm

Hiya,

this.GetNearbyObjects returns an empty or filled table, so checking it with next is the correct way..

Do you want the riot to spawn items in hand like what's that mod does? That is very possible!
-I'll be out and about the next few days; after the weekend I'll happily look into what you've put together, ideas or script wise.
oxygencraft
level1
level1
Posts: 24
Joined: Wed Feb 18, 2015 6:53 am

Re: Modding Help

Postby oxygencraft » Fri Nov 13, 2015 7:27 am

Brento666 wrote:Hiya,

this.GetNearbyObjects returns an empty or filled table, so checking it with next is the correct way..

Do you want the riot to spawn items in hand like what's that mod does? That is very possible!
-I'll be out and about the next few days; after the weekend I'll happily look into what you've put together, ideas or script wise.


Does next comes with the Prison Architect api or Lua.
oxygencraft
level1
level1
Posts: 24
Joined: Wed Feb 18, 2015 6:53 am

Re: Modding Help

Postby oxygencraft » Fri Nov 13, 2015 7:36 am

And also how can i use maths operations with this.GetNearbyObjects on an if statement
User avatar
Brento666
level3
level3
Posts: 290
Joined: Wed Sep 02, 2015 9:23 pm

Re: Modding Help

Postby Brento666 » Mon Nov 16, 2015 9:59 pm

oxygencraft wrote:And also how can i use maths operations with this.GetNearbyObjects on an if statement

Hey, back in town...
-You don't usually have to do math operations in the if statements, but you can for instance do;

Code: Select all

local Things =  this.GetNearbyObjects("thingsyouwannatrack",100)
...
Thing = ...
...

(further along in another method)
if math.abs(Thing.Pos.x - this.Pos.x) > 10 or math.abs(Thing.Pos.y - this.Pos.y) > 10 then
      Thing.Pos.x = this.Pos.x + math.random(-20,20)
end

->To test if the thing you've retrieved earlier is in range and randomly teleport it... (just a simple example case)

That being said; I think you need to learn a bit more about writing script in general; as using the math library should be explored and known by YOU.
-Equally you should know how to handle/manipulate "strings" with the string-library... And I am too limited in time to give general scripting lessons :)
User avatar
aubergine18
level2
level2
Posts: 231
Joined: Sun Jul 05, 2015 3:24 pm

Re: Modding Help

Postby aubergine18 » Tue Nov 24, 2015 5:36 am

GetNearbyObjects() returns name value pairs, where the name is actually a map object and the value is the numeric range from search origin to that map object.

Code: Select all

local searchFor, maxRange = 'Prisoner', 20

local results = this.GetNearbyObjects( searchFor, maxRange )

for obj, range in pairs(results) do
  if range > 4 and range < 12 then
   -- do whatever
  end
end
User avatar
Brento666
level3
level3
Posts: 290
Joined: Wed Sep 02, 2015 9:23 pm

Re: Modding Help

Postby Brento666 » Thu Nov 26, 2015 4:24 am

aubergine18 wrote:GetNearbyObjects() returns name value pairs, where the name is actually a map object and the value is the numeric range from search origin to that map object.

Code: Select all

local searchFor, maxRange = 'Prisoner', 20

local results = this.GetNearbyObjects( searchFor, maxRange )

for obj, range in pairs(results) do
  if range > 4 and range < 12 then
   -- do whatever
  end
end


True dat ! I left out the for-in parts... Because "what you're getting" and "what you decide to store" (locally) is mostly custom or incapsulated in a helper function!
(I skimmed on the detail, to get the point of storing values and testing them later across)

But yes at --do whatever one could say Thing = obj and if you don't overwrite, reload or otherwise loose the object;
you can later use "Thing" to test where it is or update whatever ;)

(edit:) Anyway I'm not sure where to start explaining the ways to do things in lua. I'm new to the language but have been programming most of my life...
-So I wouldn't know where is a good place to start exploring, but to suggest again to look at all mods that do interesting things and try to work out what they do, how they work.

Return to “Modding”

Who is online

Users browsing this forum: No registered users and 6 guests