Jump to content

Add 2 categories for 1 item ?


Choubidou

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

Link to comment
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
Link to comment
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 ....

Link to comment
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.

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...