Sleeping Bags! (Need some help with implementation)
4 4

9 posts in this topic

Recommended Posts

EXEPpwj.jpg

 

From my post on reddit: I just couldn't wait any longer so I made a few in blender + photoshop and put together the tileset in TileZed.

I'm not a complete inept n00b when it comes to coding, I've got the basics down, but after 4 hours of attempting to get my mod working, I threw in the towel.

If anyone here is capable or interested in modding sleeping bags into PZ, here are my source files (Tileset / Icons / TileZed building / Blender Files):

http://joeflashedme.com/pz/JoeysLucky22_SleepingBags.zip

 

Feel free to use them however and wherever you wish. The two sleeping bags with spiffio on them have a drawing from the PZ artist so don't use those if you plan on using these in any other unrelated projects.

 

Anyways, here is what I was trying to do:

  • Build & pack a sleeping bag as you would a tent
  • Craft a sleeping bag with:

recipe Make Sleeping Bag Kit {
Pillow,

Sheet,

RippedSheets = 10,


Result:SleepingBagKit,

Time:50.0,

}

 

I was looking through the camping LUAs and tried to replicate tents but failed miserably. If anyone does manage to get these working properly in game, my hats off to you! Let me know too because I just want to have sleeping bags in PZ already!

Share this post


Link to post
Share on other sites
Gustav   

EXEPpwj.jpg

 

From my post on reddit: I just couldn't wait any longer so I made a few in blender + photoshop and put together the tileset in TileZed.

I'm not a complete inept n00b when it comes to coding, I've got the basics down, but after 4 hours of attempting to get my mod working, I threw in the towel.

If anyone here is capable or interested in modding sleeping bags into PZ, here are my source files (Tileset / Icons / TileZed building / Blender Files):

http://joeflashedme.com/pz/JoeysLucky22_SleepingBags.zip

 

Feel free to use them however and wherever you wish. The two sleeping bags with spiffio on them have a drawing from the PZ artist so don't use those if you plan on using these in any other unrelated projects.

 

Anyways, here is what I was trying to do:

  • Build & pack a sleeping bag as you would a tent
  • Craft a sleeping bag with:

 

recipe Make Sleeping Bag Kit {

Pillow,

Sheet,

RippedSheets = 10,

Result:SleepingBagKit,

Time:50.0,

}

I was looking through the camping LUAs and tried to replicate tents but failed miserably. If anyone does manage to get these working properly in game, my hats off to you! Let me know too because I just want to have sleeping bags in PZ already!

These should certainly be part of the base/vanilla Game! I'm especially impressed with the Spiffo sleeping bags! And whats up with that Table?

Share this post


Link to post
Share on other sites

The secret likely lies in how Romain implemented tents. Just do a search of the Lua folders in something like NotePad++; it should take you to the right place.

Take a look at RoboMat's old sleeping mod, too. ;)

Share this post


Link to post
Share on other sites

The secret likely lies in how Romain implemented tents. Just do a search of the Lua folders in something like NotePad++; it should take you to the right place.

Take a look at RoboMat's old sleeping mod, too. ;)

 

Oh yeah, I've been digging around in the LUAs the last couple days and am just trying to wrap my head around how tents work or how I would implement a custom script without butchering the original.

 

The files I found to contain tent behaviors were:

..\ProjectZomboid\media\scripts\camping.txt

..\ProjectZomboid\media\lua\server\Camping\camping.lua

..\ProjectZomboid\media\lua\server\Camping\BuildingObjects\campingTent.lua

..\ProjectZomboid\media\lua\client\Camping

 

in the campingTent.lua I see where it's referencing a sprite (o:setNorthSprite("TileIndieStoneTentFrontLeft")) but I haven't got a clue on how to call a custom sprite. I'm not even sure how any of these scripts are called to begin with. If I were to make a new "sleepingbags.lua" script, how would I call those scripts in-game?

 

Thanks for the tip on RoboMat's mod EnigmaGrey! Their LUAs seem to only be in the /shared folder. Would I need any scripts in there? I'm not sure this is what I was looking for to help get me started. I'm a real novice when it comes to scripting so it's difficult for me to figure out what's exactly needed or where to even start but any other help to point me in the right direction would be greatly appreciated!

Share this post


Link to post
Share on other sites

In this case you'd place the sprite in \mods\sleepingbags\media\textures\ for single objects in a png file. For tilesheets it's . . . well, haven't quite figured that out yet. You use Tiled to pack tilesheets into a texturepack then place it in \texturepacks\ rather than \textures.

To call them from the game, it's going to depend on what the base object is, I believe. For example,
 

ISBuildMenu.doBuildMenu = function(player, context, worldobjects, test)    local square = nil;    local buildOption = context:addOption(getText("ContextMenu_Build"), worldobjects, nil);    local subMenu = ISContextMenu:getNew(context);    context:addSubMenu(buildOption, subMenu);        ISBuildMenu.buildCompostBinMenu(subMenu, player)endISBuildMenu.buildCompostBinMenu = function(subMenu, player)    local sprite = {}    sprite.sprite = "media/textures/compostbin.png"    sprite.northSprite = "media/textures/compostbin.png"    sprite.eastSprite = "media/textures/compostbin.png"    local crateOption = subMenu:addOption("Compost Bin", worldobjects, ISBuildMenu.onCompostBin, square, sprite, player)    endISBuildMenu.onCompostBin = function(worldobjects, square, sprite, player)    local compostBin = ISWoodenContainer:new(sprite.sprite, sprite.northSprite);    compostBin.renderFloorHelper = true    compostBin.canBeAlwaysPlaced = true;    compostBin:setEastSprite(sprite.eastSprite);    compostBin.player = player    getCell():setDrag(compostBin, player);end

This is all new to me, so. :D

Shared should be fine. Both Shared and Client are loaded when the game boots up, or when a mod is selected in single player.

Share this post


Link to post
Share on other sites
Omegapl   

Like EnigmaGrey said tilesheets are used to make texture packs . I don't know how to import packed texture in lua.
I was bored this evening so I remade 
RoboMat's mod into sleeping bags but I got stuck and I couldnt load these textures :P
Edit: I managed to load packed textures but they dont have proper names anymore. Their names are just numbers with same prefix. Becouse textures in sprite sheet are placed irregularly its hard to find out position in which they should appear on the map 

Edited by Omegapl

Share this post


Link to post
Share on other sites

Like EnigmaGrey said tilesheets are used to make texture packs . I don't know how to import packed texture in lua.

I was bored this evening so I remade RoboMat's mod into sleeping bags but I got stuck and I couldnt load these textures :P

Edit: I managed to load packed textures but they dont have proper names anymore. Their names are just numbers with same prefix. Becouse textures in sprite sheet are placed irregularly its hard to find out position in which they should appear on the map 

Ahhh right. Now I remember something about custom tiles only working when added to newtilesdefinition.tiles

 

hehJQx2.jpg

 

When "_Joeyslucky22_SleepingBags" is added, it's given the GID of 161. So the first tile is "161000".

 

 

My guess is that since each tile has a unique GID, they need to be added to the current tileset as to not overwrite any existing tiles. *sigh*

 

So a new tileset mod will only work if no other mods with a custom tileset are installed? If that's the case, that kind of sucks :(

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
4 4