Spawning materials

Discussion about Mods for Prison Architect

Moderator: NBJeff

JazzyP
level0
Posts: 3
Joined: Sat Oct 17, 2015 7:52 pm

Spawning materials

Postby JazzyP » Sat Oct 17, 2015 7:55 pm

Hello all,

I am having a little trouble spawning walls in my lua script, I am able to spawn normal objects but when trying to spawn a BrickWall nothing happens.
Is there a different function for spawning materials?

Code: Select all

Object.Spawn("Toilet", x, y); -- works
Object.Spawn("BrickWall", x, y); -- doesn't work


EDIT: As a side note, being able to queue a job to build a wall would be sufficient, is this possible also?

Thanks,
Jared
User avatar
aubergine18
level2
level2
Posts: 231
Joined: Sun Jul 05, 2015 3:24 pm

Re: Spawning materials

Postby aubergine18 » Sun Oct 18, 2015 2:42 am

Object.Spawn() can only spawn things that are defined in a "BEGIN Object ..." definition block within materials.txt :( Materials are almost completely unsupported by the object scripting API. There is some limited support for materials (but not spawning that I am aware of) in grants.lua and campaign scenario scripts, but neither of those will be much use to you I'm guessing (assuming you're doing stuff from an object script).

As for queueing jobs to build walls, that's also not possible as far as I know... However, if you queue some jobs via UI and then save game, check out the .prison file and see if there are any unusual objects on it; if there are any, they'll have an id that you might be able to do stuff with (eg. Object.Spawn() or this.GetNearbyObjects() etc).
JazzyP
level0
Posts: 3
Joined: Sat Oct 17, 2015 7:52 pm

Re: Spawning materials

Postby JazzyP » Sun Oct 18, 2015 9:05 am

aubergine18 wrote:Object.Spawn() can only spawn things that are defined in a "BEGIN Object ..." definition block within materials.txt :( Materials are almost completely unsupported by the object scripting API. There is some limited support for materials (but not spawning that I am aware of) in grants.lua and campaign scenario scripts, but neither of those will be much use to you I'm guessing (assuming you're doing stuff from an object script).

As for queueing jobs to build walls, that's also not possible as far as I know... However, if you queue some jobs via UI and then save game, check out the .prison file and see if there are any unusual objects on it; if there are any, they'll have an id that you might be able to do stuff with (eg. Object.Spawn() or this.GetNearbyObjects() etc).


Thanks for the reply. I was afraid that would be the case. I did notice that in the campaign riot.lua script there is the following code which looked promising but unfortunately didn't work either.

Code: Select all

Game.SetMaterial( 133, 155, "BurntFloor" )
Game.SetMaterial( 148, 155, "BurntFloor" )


Maybe it's just a case of waiting for Introversion to implement these APIs.

Thanks for your help.
User avatar
aubergine18
level2
level2
Posts: 231
Joined: Sun Jul 05, 2015 3:24 pm

Re: Spawning materials

Postby aubergine18 » Sun Oct 18, 2015 10:23 pm

Campaign scripting, and even grant scripting, has loads more features in some respects than object scripting. I'm not quite sure why they spread the API across different parts of the scripting systems in this way, but then again the entire game is coded in a most peculiar manner that's riddled with bugs.
User avatar
Brento666
level3
level3
Posts: 290
Joined: Wed Sep 02, 2015 9:23 pm

Re: Spawning materials

Postby Brento666 » Sun Oct 18, 2015 11:37 pm

JazzyP wrote:I am having a little trouble spawning walls in my lua scrip.


Heya, this is also definitely on my wishlist. I also found out the hard way; by trying everything I could imagine/find, before posting here in despair a while ago...
I get the idea, that this isn't made possible yet for either mayor stability reasons. Or perhaps the team is just snowed under with other things like critical bugs (and mantis tracking)...

OR perhaps, maybe giving us modders too much ability in script, just plain freaked Introversion out !!
-For instance, I don't get why we don't already have a simple api method to set prisoners to be naked and back (don't judge :D ). The only way to do it currently is to adopt a 'washing' activity for a new object. You get the added 'bonus' of shower sounds.
-Or why we can't query/effect prison funds... Both things should be very very easy to expose in an api. 8)

So I fear that maybe the creators are afraid their (game's) reputation may be tarnished by ill conceived/sick minded mods!... And I can get that; I personally wouldn't want my successful cash cow to be defaced or worse! (especially before it's even released, or only just released)

But if people could create 'draw a dick with walls mods', then users would firstly have to download said mods. So users would either knowingly install smut-ware or would have to be mislead by innocent looking sneaky mods. Steam would probably step in on mislabeled or malicious mods. So at this point, conscious fear-driven restrictions to the api, hopefully won't be made!

A mayor thing I don't get is why even maintaining proper documentation on their own (fragmented/bugged) API's, seems so hard for Introversion(?)

All the current limitations have been stumbled upon repeatedly by everyone seriously trying to get into modding PA... And having to research and fruitlessly test current impossibilities can be very off-putting at times.

Mad props to the users over on Steam for scrounging together an in-depth documentation!
(for readers that haven't been there yet: Head over and join in on updating them invaluable shared docs!!)


In any case, my hope is that now that PA is released, some apprehension will fade and/or more focus is put on expanding and properly documenting the api !! -> And I still do really really like (modding) the game! :mrgreen:
User avatar
aubergine18
level2
level2
Posts: 231
Joined: Sun Jul 05, 2015 3:24 pm

Re: Spawning materials

Postby aubergine18 » Sun Oct 18, 2015 11:54 pm

Since 1.0 release there is now a .Naked property on most entities, however setting it has no effect. In the script debugger, go in to Explore mode and look at what's lurking in WorldObject - there are at least 30 new properties in there since 1.0; but most of them either don't work or can't be set.

As for dubious mods, there's already a 'Sexy Time' mod that has needs such as FapFap. :)

I doubt IV are worried about strange things mods will do, after all lots of games have far more extensive modding apis. Cities: Skylines allows mods in C# which have the ability to replace entire classes with their own code - basically a C:S mod can do pretty much anything it wants to the game, including replacing the pathfinder, rendering engine, user interface, literally everything.

As for the documentation, I have started a complete new set of docs as I found making them on Steam was cumbersome and limiting in certain important ways :) Will post details of that when it's a bit nearer to completion.
User avatar
Brento666
level3
level3
Posts: 290
Joined: Wed Sep 02, 2015 9:23 pm

Re: Spawning materials

Postby Brento666 » Mon Oct 19, 2015 1:20 am

Heya Aubergne!
Yeah, .Naked, I've seen it, but since it doesn't do anything from script yet, it wasn't interesting to pass-on (I'm guessing from save file it does work, but that's beside the point of modding via scrips and texts)...

The fap-fap 'sexy time' is pretty innocent if you ask me, but I get your point!

Now image actual naked 'interacting' prisoners and remember introversion is a British corp... Not trying to offend my direct western neighbors, I do feel most Brits seem to care allot (/awful lot) about decency and morals. (Publicly) :P

An industry example I would give is EA's Sims series; blur body parts, rename normal human activities to 'woohoo'. Sure a mod can remove the blur, rename the following, literally covered up, bed action maybe even. (Not sure what they currently are up to.)
-But EA isn't amused by such mods, don't support them, surely don't host them!
(I stayed far away from the Sims 4 as 3 was and remained riddled with bugs. Not talking mods, base-game-breaking-bugs, for shame!)

-> EA's products must sell big volumes (darned shareholders)...
-> PA is coming to ipad...

I only see it as a possible factor...I am allot of times over-thinking stuff, so I may well be wrong on this! But fact is the focus is already shifting to mobile release and api-advances are few and far in between(!) Plus they released with an escape mode and campaign riddled with bugs...
-Ominous parallels could be drawn :shock:


I don't mean to be a negative-nancy, and don't let my fears bring you down in any way!
And should it all fizzle and fade.. I'm more then willing to co-explore City-skyline's modding caps... C# was my regular gig for a loooong time!

Personally the current state does tend to make me contemplate releasing a few 'kewl' mods, then letting go of ideas too impossible to mod in PA. Moving on to a better medium; perhaps the Unity engine or Unreal 4. And try to create a completely original thing!

Or go back to building on 1 of my android prototypes, with it's own engine... (making the engine made my brain boil back a ways, so I stopped, but maybe I should revisit)

->Anyway...Are the others continuing on the Steam docs or coming with ya on the move? Any which way I'll happily visit and try to contribute to that new haven, please keep us posted when it happens :D
User avatar
aubergine18
level2
level2
Posts: 231
Joined: Sun Jul 05, 2015 3:24 pm

Re: Spawning materials

Postby aubergine18 » Mon Oct 19, 2015 1:56 am

The new docs are going to be on github, using github wiki so anyone can contribute. Also it means everything can be downloaded for offline viewing :) The main reasons for the move to github wiki was better code blocks, and much easier to interlink things as each property, setting, entity, file, etc., has it's own page in the wiki. So far I've got about 20% done, but most of that done so far is the time consuming creation of .md files. Once all those exist it will be a case of filling them in, mostly with infos from the steam version of the guides. At the moment it's a horrible mess of broken links as I'm still creating all the files, but once that gets sorted I'll post links.
User avatar
Brento666
level3
level3
Posts: 290
Joined: Wed Sep 02, 2015 9:23 pm

Re: Spawning materials

Postby Brento666 » Mon Oct 19, 2015 2:31 pm

aubergine18 wrote:The new docs are going to be on github, using github wiki so anyone can contribute. Also it means everything can be downloaded for offline viewing :) The main reasons for the move to github wiki was better code blocks, and much easier to interlink things as each property, setting, entity, file, etc., has it's own page in the wiki.


Sounds good although I admittedly rather like all the info being on singular dense pages (like steam docs are). (Makes ctrl+F easy, so I can scan big documents for occurrences of terms.)

But offline reading, better code blocks and group maintenance all sound like a good improvements in return!


Also sorry to OP for maybe taking over the thread a bit, with my large (and hopefully slightly paranoid?) replies of yesterday :D

Return to “Modding”

Who is online

Users browsing this forum: No registered users and 7 guests