Jump to content

Self-made sprites(carpentry)disappear after loading


blackteapie

Recommended Posts

I have made some new sprites for pillar lamp.

The sprites showed normally at the first time,which is the time I build the lamp.

But the sprite disappear after the time I reload the save.

So,what could be the pissible reasons for this?

Link to comment
Share on other sites

You are playing on singleplayer?

 

Because if you are playing on a server, the server has to know that your character has build something, that the server should safe.

Otherwise it is only seen by the client which build it, and it will disappear when you load the map (after new start of the game or when your character ran around the block.)

Link to comment
Share on other sites

You are playing on singleplayer?

Because if you are playing on a server, the server has to know that your character has build something, that the server should safe.

Otherwise it is only seen by the client which build it, and it will disappear when you load the map (after new start of the game or when your character ran around the block.)

I haven't played PZ in multiplayer mode.
Link to comment
Share on other sites

local singleplayer is good, makes it easier than on multiplayer...

 

Do you have an example on which you based your code? Then you could have another look on the example.

 

I would use some print()-commands in order to get information about what is going wrong.

So you can see step by step where the first problems in the code appears.

 

Do you load your sprites at game-start? If not this would explin, why there is nothing there any more.

Otherwise you should test with some more print()-commands...

Link to comment
Share on other sites

local singleplayer is good, makes it easier than on multiplayer...

Do you have an example on which you based your code? Then you could have another look on the example.

I would use some print()-commands in order to get information about what is going wrong.

So you can see step by step where the first problems in the code appears.

Do you load your sprites at game-start? If not this would explin, why there is nothing there any more.

Otherwise you should test with some more print()-commands...

I just changed the sprites and the materials needed for pillar lamps.

Do the sprites for carpentry items need specific tile property?

Link to comment
Share on other sites

local singleplayer is good, makes it easier than on multiplayer...

 

Do you have an example on which you based your code? Then you could have another look on the example.

 

I would use some print()-commands in order to get information about what is going wrong.

So you can see step by step where the first problems in the code appears.

 

Do you load your sprites at game-start? If not this would explin, why there is nothing there any more.

Otherwise you should test with some more print()-commands...

My code is based on the original ISBuildMenu.lua file, which is looked like the following:

ISBuildMenu.buildLightMenu = function(subMenu, player)
    local sprite = ISBuildMenu.getPillarLampSprite(player);
    local lampOption = subMenu:addOption(getText("ContextMenu_Lamp_on_Pillar"), worldobjects, ISBuildMenu.onPillarLamp, square, sprite, player);
    local toolTip = ISBuildMenu.canBuild(2,4,0,0,0,4,lampOption, player);
    if not getSpecificPlayer(player):getInventory():contains("CandleLit") and not ISBuildMenu.cheat then
        toolTip.description = toolTip.description .. " <RGB:1,0,0>" .. getItemText("CandleLit") .. " 0/1 ";
        lampOption.onSelect = nil;
        lampOption.notAvailable = true;
    else
        toolTip.description = toolTip.description .. " <RGB:1,1,1>" .. getItemText("CandleLit") .. " 1 ";
    end
    if not getSpecificPlayer(player):getInventory():contains("Bowl") and not ISBuildMenu.cheat then
        toolTip.description = toolTip.description .. " <LINE> <RGB:1,0,0>" .. getItemText("Bowl") .." 0/1 ";
        lampOption.onSelect = nil;
        lampOption.notAvailable = true;
    else
        toolTip.description = toolTip.description .. " <LINE> <RGB:1,1,1>" .. getItemText("Bowl") .. "Bowl 1 ";
    end
    toolTip:setName(getText("ContextMenu_Lamp_on_Pillar"));
    toolTip.description = getText("ContextMenu_Lamp_on_Pillar") .. " " .. toolTip.description;
    toolTip:setTexture("constructedobjects_01_1");

 

ISBuildMenu.requireHammer(lampOption)
end
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ISBuildMenu.onPillarLamp = function(worldobjects, square, sprite, player)
-- sprite, northSprite
    local lamp = ISLightSource:new(sprite.sprite, sprite.northSprite, getSpecificPlayer(player));
    lamp.offsetX = 5;
    lamp.offsetY = 5;
    lamp.modData["need:Base.Plank"] = "2";
    lamp.modData["need:Base.Bowl"] = "1";
    lamp.modData["need:Base.Nails"] = "4";
--    lamp.modData["need:Base.Torch"] = "1";
    lamp:setEastSprite(sprite.eastSprite);
    lamp:setSouthSprite(sprite.southSprite);
    lamp.fuel = "Base.CandleLit";
    lamp.baseItem = "Base.CandleLit";
    lamp.radius = 10;
    lamp.player = player
    getCell():setDrag(lamp, player);
end
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

ISBuildMenu.getPillarLampSprite = function(player)

    local sprite = {};
    sprite.sprite = "constructedobjects_01_1";
    sprite.northSprite = "constructedobjects_01_1";
    sprite.southSprite = "constructedobjects_01_1";
    sprite.eastSprite = "constructedobjects_01_1";
    return sprite;
end

 

BTW, the sprites names in the codes above are PZ original sprites. These PZ original sprites don't meet the problem I met with my self-made sprites.

Link to comment
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
×
×
  • Create New...