[MOD] BarberMod - Question before New Update v1.7

Discussion about Mods for Prison Architect

Moderator: NBJeff

keep_on
level1
level1
Posts: 45
Joined: Mon Jun 23, 2014 2:00 pm

[MOD] BarberMod - Question before New Update v1.7

Postby keep_on » Wed Oct 08, 2014 1:23 pm

Hi,

I have just upload my Barber Mod on the workshop (http://steamcommunity.com/sharedfiles/filedetails/?id=323863497)

Hope you will enjoy it, and your feedbacks are welcome!

I have talk with Sir Noolas, who has also made a BarberShop mod last month. Take time to also look at his own, maybe we can work together for merging those two mods later...

I will come back soon, because I have some ideas but I can't figure how to do them... hope you will be able to help me

Let's shave!
Last edited by keep_on on Tue Nov 25, 2014 4:31 pm, edited 7 times in total.
Kataan
level1
level1
Posts: 10
Joined: Tue Sep 23, 2014 6:27 am
Location: Brisbane, Australia

Re: [MOD] BarberMod

Postby Kataan » Thu Oct 09, 2014 4:03 am

I've not tried it, but I like the look of the sprites.
iRoleToPlay
level0
Posts: 1
Joined: Mon Oct 13, 2014 1:55 am

Re: [MOD] BarberMod

Postby iRoleToPlay » Mon Oct 13, 2014 2:02 am

What is this mode supposed to do? I'm sorry, I just got Prison Architect, and I'm very new to how the game works.
keep_on
level1
level1
Posts: 45
Joined: Mon Jun 23, 2014 2:00 pm

Re: [MOD] BarberMod

Postby keep_on » Mon Oct 13, 2014 1:59 pm

If you are totally new at PA, maybe you should just play the game a couple of days, without any mod.

This mod add new need for your prisoners, and new ways to satisfy it. But I recommend you to play without mode, to get familiar with the gamelplay before download mods and addition.

The game is fully playable by itself, and mods add news things for players that wants to go further, but you don't need them right now.

That said, this mod doesn't add a lot of dificulty to the game, so if you dream to have a barbershop at the beginning of your prison you're welcome!
keep_on
level1
level1
Posts: 45
Joined: Mon Jun 23, 2014 2:00 pm

Re: [MOD] BarberMod

Postby keep_on » Thu Oct 23, 2014 3:16 pm

Hi all,

I am working at the new version of my mod, and I am stuck...

I have create a new object, and now I want to assign to it a new stack sprite.

For now, my new object is using brick sprite, (for no reason...) and I want to create a new type of stack for it. Let's say I want to have 4 differents stacks like the uniforms one (from small to big stack)...

How do I get that?

When I look for this in the original game files, I can't find what I am looking for. All the stacks sprite refer to a single location in the sprite.png and RotateType 4 is used... so I don't understand....

Garry's vegetables use a script that change the sprite "in time", what I don't want... I want to have it changing depending on size...

Hope I am clear enough, tell me if you need more informations...
User avatar
knoest26
level5
level5
Posts: 1380
Joined: Thu Jul 11, 2013 6:55 pm
Location: The Netherlands
Contact:

Re: [MOD] BarberMod

Postby knoest26 » Thu Oct 23, 2014 7:20 pm

All materials that are stacked are no longer those materials but stacks of those materials. It therefor becomes a new object with a different sprite. The standard sprite for this is a stack of bricks and as far as I know there is no way of changing that yet...

I've already tried a lot of things but was unsuccessful, it's probably best to just accept it and deal with it for now, otherwise, good luck with your quest and enlighten us if you have a solution
keep_on
level1
level1
Posts: 45
Joined: Mon Jun 23, 2014 2:00 pm

Re: [MOD] BarberMod

Postby keep_on » Fri Oct 24, 2014 12:24 pm

Yay!! I got it!!
It is very strange...

Here is what I have done...

I had my single object in material.txt :

Code: Select all

BEGIN Object     
    Name                 HairStrand
    Width                1 
    Height               1
    Toughness            1.0000 
    MaxStackSize         20
    RenderDepth          1 
    Properties           Material
    BEGIN Sprite
   x 0
   y 12 
   w 2
   h 2
   RotateType 0
   BEGIN Marker
           x             0.9
           y             1.0
           Index         0
   END
END
END


Then I added the StackSprite location inside :

Code: Select all

BEGIN Object     
    Name                 HairStrand
    Width                1 
    Height               1
    Toughness            1.0000 
    MaxStackSize         20
    RenderDepth          1 
    Properties           Material
    BEGIN Sprite
   x 0
   y 12 
   w 2
   h 2
   RotateType 0
   BEGIN Marker
           x             0.9
           y             1.0
           Index         0
   END
END
   BEGIN StackSprite
   x 0
   y 16
   w 2
   h 2
   RotateType 0
   END
END


The location of the StackSprite (x0-y16) is the top left corner of my smallest stack of hairstrand. (medium is at x2-y16 and biggest at x4-y16).

Now comes the confusing thing. I hope I will be clear enough...

I launch the game...
The stacksprite that was loaded was not mine.
It was a sprite in people.png [which I don't modify in my mod, so its calling the in-game sprite].

And the odd thing was that it wasn't the sprite under x0-y16 in people.png! It called the sprite under x56-y16 [which is the white nude body of a prisoner, when you look at people.png, its the body on the right of the first janitor's sprite]

Ok, for those who understand me until here, it is not finish!

I wanted to try something with the stacksprite location, just to see what happen. I then changed the x0-y16 of my StackSprite into x2-y16.

I launch the game again, and SURPRISE!!

Some stack actually use My StackSprite, which is in My Sprite.png. The odd thing is that some of them still use the nude body, from another png file!

SO! I change the location of StackSprite to x6-y16 AND I AM DONE!

All the stacks (from small to big) use MY STACKSPRITE!

Screenshot :
Image

Here is the code that worked :

Code: Select all

BEGIN Object     
    Name                 HairStrand
    Width                1 
    Height               1
    Toughness            1.0000 
    MaxStackSize         20
    RenderDepth          1 
    Properties           Material
    BEGIN Sprite
   x 0
   y 12 
   w 2
   h 2
   RotateType 0
   BEGIN Marker
           x             0.9
           y             1.0
           Index         0
   END
END
   BEGIN StackSprite
   x 6
   y 16
   w 2
   h 2
   RotateType 0
   END
END


For all I can say, you have to add a BEGIN StackSprite inside your object. ANd its location had to be set to the TOP RIGHT corner of the biggest stack.
This workes for a stack with 3 differents size.

Hope I was clear enough!

I will soon update the mod with the new code and sprite, so you will be able to look ate the sprite.png and code!!

YAY!
User avatar
knoest26
level5
level5
Posts: 1380
Joined: Thu Jul 11, 2013 6:55 pm
Location: The Netherlands
Contact:

Re: [MOD] BarberMod

Postby knoest26 » Fri Oct 24, 2014 1:11 pm

Good find, not sure why IV didn't release this but okay
keep_on
level1
level1
Posts: 45
Joined: Mon Jun 23, 2014 2:00 pm

Re: [MOD] BarberMod

Postby keep_on » Fri Oct 24, 2014 1:17 pm

I have tested few changes. The value of the MaxStackSize in your object decides which stacksprite will be used (small, med, big).

I come to the point where putting 30 in the MaxStackSize is quite perfect. The small stack is for minus than 10, the med one for minus than 20, and every stack above 20 will use the big one.

When I had 20 for value, the smallest stack were never used,only med and big one... I don't know why...

here is the code now :

Code: Select all

BEGIN Object     
    Name                 HairStrand
    Width                1 
    Height               1
    Toughness            1.0000 
    MaxStackSize         30
    RenderDepth          1 
    Properties           Material
    BEGIN Sprite
   x 0
   y 12 
   w 2
   h 2
   RotateType 0
   BEGIN Marker
           x             0.9
           y             1.0
           Index         0
   END
END
   BEGIN StackSprite
   x 6 
   y 16
   w 2
   h 2
   RotateType 0
   END
END


And here is the sprite.png

Image

This work fine for me.


I have one more question. I have created a new object for the processed hair strand. But when its done, worker move it to storage unless to move it to export. I add the Properties Sellable and give it a price but can't find nothing more to say "move to export" instead of storage... [EDIT : ok I got it, ProductionRules! ]
keep_on
level1
level1
Posts: 45
Joined: Mon Jun 23, 2014 2:00 pm

Re: [MOD] BarberMod

Postby keep_on » Fri Oct 24, 2014 2:23 pm

Its odd.

I have created a ProductionRule for the new object to be moved to exports. But it is only working at loading. I have an object on my workshop press. Nothing happens, nobody comes to move it. I save and load the file, and then teh new object has a new To Do list : Move to Export...

Its strange... someone can help me?
User avatar
knoest26
level5
level5
Posts: 1380
Joined: Thu Jul 11, 2013 6:55 pm
Location: The Netherlands
Contact:

Re: [MOD] BarberMod

Postby knoest26 » Fri Oct 24, 2014 2:26 pm

post the relevant parts of the code so we can take a look
keep_on
level1
level1
Posts: 45
Joined: Mon Jun 23, 2014 2:00 pm

Re: [MOD] BarberMod

Postby keep_on » Fri Oct 24, 2014 3:04 pm

here is the Production.txt

Code: Select all

BEGIN ProductionRule
   Rule            Storage
   Material         WigBox
   Room            Exports
   Distribution      Random
END


And here is the Material.txt

Code: Select all

BEGIN Object
   Name            WigBox
   Width            1
   Height            1
   Toughness         1.0000
   MaxStackSize       3
   Price            -500
   RenderDepth         1
   Properties         Material
   Properties         Sellable
   BEGIN Sprite
   x 0
   y 14
   w 2
   h 2
   RotateType 0
   END
      BEGIN StackSprite
   x 6   
   y 14
   w 2
   h 2
   RotateType 0
   END
END


If a WigBox is on a WorkshopPress when loading the game, it will be move to export. Every new WigBox won't be moved and will stay on the WorkshopPress after being created...

Note also that the price in material.txt is 500$, while the sell price displayed in game is half of it (250$)...
keep_on
level1
level1
Posts: 45
Joined: Mon Jun 23, 2014 2:00 pm

Re: [MOD] BarberMod

Postby keep_on » Sun Oct 26, 2014 8:44 pm

Since the last update (the one 2 days ago), as soon as my script is called, I have a crash!

Does something change in the way lua scripts are loaded?

I am definitly not a dev and I can't understand by myslef whats going wrong now... :(

I can give you a link with the modifed mod in .zip if someone want to take a look...
keep_on
level1
level1
Posts: 45
Joined: Mon Jun 23, 2014 2:00 pm

Re: [MOD] BarberMod - job broken since update - help please

Postby keep_on » Mon Oct 27, 2014 1:17 pm

Ok, after a few try, I understand what cause the crash...

The job I have created can only be perform by Workman.

As soon as I let a prisoner doing it, I crash.

Here is the jobs.txt

Code: Select all

BEGIN Job
   Name      CollectHairStrand
   JobTime      15
   Worker      Workman
   Worker      Prisoner
END


And here the BarberMirror.lua script (which is called in Jobs.txt)

Code: Select all


function Create()

    -- property doesn't exist on the object by default, so it must be created now
    Object.SetProperty( "Age", 0.0); 
   
   
   
end


function Update( timePassed )

     
    local maxAge = 100.0;
   
 
       
    -- increase our age and save it back to the object
    local age = Object.GetProperty("Age");   
    age = age + timePassed;   
    Object.SetProperty( "Age", age );
   
 
    if age > maxAge then
       
        Object.CreateJob("CollectHairStrand");
        Object.SetProperty( "Age", 0 );
     
    end

end


-- this function is called when the job created by the Object.CreateJob("TendVegetables") call is completed by the appropriate worker
-- the name of the function called follows the format "JobComplete_" plus the name of the job (as created in jobs.txt, and called in the CreateJob function)
function JobComplete_CollectHairStrand()
    Object.Spawn( "HairStrand", Object.GetProperty("Pos.x"), Object.GetProperty("Pos.y") )
       
end


To be more precise, it crash as soon as I assign a prisoner to the room in the Job View, meaning as soon as the script ask a prisoner to do the job.

Everything was going fine before the update...
I have no debug windows, just a crash!
keep_on
level1
level1
Posts: 45
Joined: Mon Jun 23, 2014 2:00 pm

Re: [MOD] BarberMod

Postby keep_on » Tue Oct 28, 2014 1:58 pm

OK,

Seems that prisoners must have a qualification to perform jobs. If you delete the Qualification, game crash.

Qualification is also needed in the processor...

Update is out now! Job works!

V1.3

Take a look at it on the workshop!

Return to “Modding”

Who is online

Users browsing this forum: No registered users and 4 guests