Jump to content

[HELP]Why I can't add a widget button for a new container?


Recommended Posts

Unfortunately, the button show up in other other chests, such as treasure chests. How can I make the buttons only show up in the magical chest?

 
@DarkXero
 
After the hard exploration of the day, I think I found where the problem lay.
In magical_chest.lua, there is a line : self:WidgetSetup("treasurechest") . I think this is the problem. I replaced it with these lines:
 
    local magical_chest =
    {
        widget =
        {
            slotpos = {},
            animbank = "ui_chest_3x3",
            animbuild = "ui_chest_3x3",
            pos = Vector3(0, 200, 0),
            side_align_tip = 160,
        },
        type = "chest",
    }
 
    for y = 2, 0, -1 do
        for x = 0, 2 do
            table.insert(magical_chest.widget.slotpos, Vector3(80 * x - 80 * 2 + 80, 80 * y - 80 * 2 + 80, 0))
        end
    end
 
    self:WidgetSetup("magical_chest", magical_chest)
 
The problem was solved. Am I right? Is the line in red right? If so, please help me with this: 
 

Hello @DarkXero

 

Your another post gave an inspiration. ( http://forums.kleientertainment.com/topic/57411-help-clickable-buttons/ )

Since the content of this mod is too complicated(trade for many things) and client don't know how the mod functions, I want add button for the container that will display the information after clicking and hide it after another clicking. I know how to add a button for a container now but I don't how to display the information.

 

I think this is one way to show clients how the mod functions. How about another way, when the mouse move upon the button ( Let's assume the button's funtion is buy 10 flint for 1 gold nugget. ), a line of words ( the content is " 10 flint for 1 gold nugget ")  will show at the top of the mouse. Does this way work?

 

I am not sure that these two way which is better because I don't know how to do them. Could you please help me out?

 

Thank you!

 

 

Without you, I can't even make a mod! :wickerbottomthanks:

Link to comment
Share on other sites

Hi, @DarkXero

Help plz........

 

This mod "Magical Chest" is finished, but it conflicts with other mods with storage modifications like DST Storm Cellar, Musha, Kotori, Annie(League of Legends).

 

Here is the log:

 

[00:01:48]: [string "../mods/workshop-507858702/scripts/prefabs/..."]:591: attempt to index field 'widget' (a nil value)
LUA ERROR stack traceback:
    ../mods/workshop-507858702/scripts/prefabs/magical_chest.lua:591 in (upvalue) EditContainer (Lua) <56-592>
    ../mods/workshop-507858702/scripts/prefabs/magical_chest.lua:646 in (field) fn (Lua) <610-667>
    scripts/mainfunctions.lua:148 in () ? (Lua) <137-168>
    =[C]:-1 in (method) SpawnPrefab © <-1--1>
    scripts/mainfunctions.lua:182 in (global) SpawnPrefab (Lua) <179-184>
    scripts/components/builder.lua:330 in (method) DoBuild (Lua) <315-398>
    scripts/actions.lua:860 in (field) fn (Lua) <858-864>
    scripts/bufferedaction.lua:23 in (method) Do (Lua) <19-33>
    scripts/entityscript.lua:1199 in (method) PerformBufferedAction (Lua) <1191-1209>
    scripts/stategraphs/SGwilson.lua:2162 in (field) ontimeout (Lua) <2159-2163>
    scripts/stategraph.lua:544 in (method) UpdateState (Lua) <530-574>
    scripts/stategraph.lua:601 in (method) Update (Lua) <593-621>
    scripts/stategraph.lua:123 in (method) Update (Lua) <107-146>
    scripts/update.lua:205 in () ? (Lua) <146-219>

Magical Chest.zip

DST Storm Cellar.zip

Link to comment
Share on other sites

@Jupiters, those idiots decided to overwrite the container.widgetsetup and broke the function.

I used the data argument to pass widget parameters and they deleted the argument.

 

The correct thing to do would be to call them morons.

I will setup the parameters differently so its compatible with their sloppy override.

Link to comment
Share on other sites

@Jupiters, those idiots decided to overwrite the container.widgetsetup and broke the function.

I used the data argument to pass widget parameters and they deleted the argument.

 

The correct thing to do would be to call them morons.

I will setup the parameters differently so its compatible with their sloppy override.

 

lol

Thank you! You are so humorous. :)

Link to comment
Share on other sites

@DarkXero

Is there any possible that make a new chest that have each slots. When player open the chest, it shows their own slots. Every player only see their slots. And they can see their stuffs in the different chest, which means these chest have common contents.

Link to comment
Share on other sites

@Jupiters, it's practically impossible.

You have container, container_replica, and container classified to go through.

 

Try using this, it spawns and swaps chests when people open the void chest.

Spawn a "voidchest" and test it.

It's buggy.

 

Well, thanks, you are my authority. :)

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
 Share

×
  • Create New...