Jump to content
Choubidou

Add 2 categories for 1 item ?

Recommended Posts

Hi guys ,  im trying to use the function "write note" ( for journal , notebook etc ) to a drainable item .

 

 

item Exempleitem{LightDistance = 20,Weight = 0.50,DisappearOnUse = FALSE,Type = Drainable,TorchCone = TRUE,UseDelta = 0.0005,LightStrength = 0.8,DisplayName = Exemple item,CanBeWrite  =   true,PageToWrite =   20,Icon = Exempleitem,

 

The problem is , if  i set

 Type =  Drainable,
the

 CanBeWrite  =   true,PageToWrite =   20, 
not work , it work only with type = Literature , so i need to have type Literature + drainable bur i dont know how to do this.

I tried to modifie the ISInventoryPaneContextMenu.lua there :

if testItem:getCategory() ~= "Literature" or testItem:canBeWrite() then            isAllLiterature = false;        end        if testItem:getCategory() == "Literature" and testItem:canBeWrite() then            canBeWrite = testItem;        end 
like this

if testItem:getCategory() ~= "Literature" or testItem:getCategory() ~= "Drainable" or testItem:canBeWrite() then            isAllLiterature = false;        end        if testItem:getCategory() == "Literature" or testItem:getCategory() == "Drainable"  and testItem:canBeWrite() then            canBeWrite = testItem;        end
But it not work.

 

If someone can help me would be very nice . Sorry for my english .

 

Thanks

Share this post


Link to post
Share on other sites
if testItem:getCategory() ~= "Literature" or testItem:getCategory() ~= "Drainable" or testItem:canBeWrite() then    isAllLiterature = false;end

^ this is your problem.

this means: if the item is not literature or not drainable then.

if the item is a drainable, it's not a literature, so doesn't get through. same vica versa.

 

also, try doing:

        if ( testItem:getCategory() == "Literature" or testItem:getCategory() == "Drainable" ) and testItem:canBeWrite() then            canBeWrite = testItem;        end

instead of

        if testItem:getCategory() == "Literature" or testItem:getCategory() == "Drainable"  and testItem:canBeWrite() then            canBeWrite = testItem;        end

Share this post


Link to post
Share on other sites

I tried 

        if ( testItem:getCategory() == "Literature" or testItem:getCategory() == "Drainable" ) and testItem:canBeWrite() then            canBeWrite = testItem;        end

But nothing change in game , like i have to modifie something else but i have no idea what to do ...

 

i had search all " canBeWrite " files  but only ISInventoryPaneContextMenu.lua contains this ....

Share this post


Link to post
Share on other sites

You can only have one category per item (in this case, it's a literal object defined in Java, such as Literature). The way you get around it is working with an item's mod data (t = someObj:getModData(), t["canBeWrite"] = true) but you'll then have to build your own functionality.

 

Might be a good idea to search the game files for carpentry/fishing books and see how they're done first, though.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...