Jump to content

Modding Hydrocraft items using DarkSlayerEX Item Tweaker API


yuriy206

Recommended Posts

Edit:Topic reopened because more is known about the problem, here is the new info as I posted bellow:

On 1/19/2018 at 5:16 PM, yuriy206 said:

Hello. Looks like the problem was only partially resolved. It looks like instances of the carts that are spawned with the players or by command line after installing the mod are successfully changed, but those that are found in the world are not changed.

That is, in a world where the mod is shown to work (Ex. I can spawn a Hydrocraft.HCHanddolly by command line and it would give the appropriate amount of Weight Reduction (For hand cart I have changed that to be 80%, not 90% as above but that should not make a difference to my question,)) a handcart found in a warehouse which is also Hydrocraft.HCHanddolly (Checked using admin mode, edit item) will have only 50% weight reduction.

 

I am trying to change a few items in hydrocraft ( http://steamcommunity.com/sharedfiles/filedetails/?id=498441420&searchtext=hydrocraft ) using darkslayer's item teaker api ( http://steamcommunity.com/sharedfiles/filedetails/?id=566115016&searchtext=Item+Tweaker+API ).

 

I was under the impression that this code would do what I want:

 

if getActivatedMods():contains("ItemTweakerAPI") then 
    require("ItemTweaker_Core");
else return end

TweakItem("Hydrocraft.HCHanddolly", "WeightReduction", "90");
TweakItem("Hydrocraft.HCWheelbarrow", "WeightReduction", "90");
TweakItem("Hydrocraft.HCPallettruck", "WeightReduction", "90");
TweakItem("Hydrocraft.HCPushcart", "WeightReduction", "90");
TweakItem("Hydrocraft.HCShoppingcart", "WeightReduction", "90");

but it does not seem to work (Nothing changes in game) even after restarting the world.

 

I am attaching the full structure of the mod I created to do this with the code in it.


Thank you to anyone who can help.

BetterCarts.zip

Edited by yuriy206
Forgot to include link to hydrocraft in my original post.
Link to comment
Share on other sites

Now, I believe, and I could be wrong that with an API editing a mod, you can run into issues like this if the API is loaded by the server or game before the mod is. You don't need to worry about this with base game items though. 

 

Now... I assume that you also have the item tweaker selected to load as well as its mandatory for its function. 

 

Using another mod like yours as an example....

In the .lua.... after deleting a wall of ignore comment code...

 

if getActivatedMods():contains("ItemTweakerAPI") then 
    require("ItemTweaker_Core");
else return end
-- Adjust Disinfectant Ratios
TweakItem("Base.Disinfectant", "UseDelta", "0.02");

-- Items deplete into Clean Empty Bottles
TweakItem("Hydrocraft.HCCookingoil", "ReplaceOnDeplete", "Hydrocraft.HCWaterbottleclean");
TweakItem("Base.Disinfectant", "ReplaceOnDeplete", "Hydrocraft.HCWaterbottleclean");

 

vs yours....

 

 

if getActivatedMods():contains("ItemTweakerAPI") then 
    require("ItemTweaker_Core");
else return end

TweakItem("Hydrocraft.HCHanddolly", "WeightReduction", "90");
TweakItem("Hydrocraft.HCWheelbarrow", "WeightReduction", "90");
TweakItem("Hydrocraft.HCPallettruck", "WeightReduction", "90");
TweakItem("Hydrocraft.HCPushcart", "WeightReduction", "90");
TweakItem("Hydrocraft.HCShoppingcart", "WeightReduction", "90");

 

The code itself looks fine when compared to a working mod. 

the referencing of WeightReduction seems fine...

In theirs, the .lua was only in the client section while you have yours in client and server....

Removed server folder....

No immediate errors in console on load....

 

For testing.

1 Car battery in Shopping Cart - base reduction 50 - BC sets to 90

1 car battery in Toy Wagon - base reduction 50 - not in BC

 

 

Base character weight no carts, no battery -  4.3

Character carry weight battery no carts - 24.3

Weight shopping cart equipped - 7.9

Weight Wagon equipped - 7.9

Weight battery cart -  9.9 (in your mod)

Weight battery wagon -  17.3 (not in your mod)

Weight difference: 7.4

 

The bold is what really matters. since the car and wagon were effectively the same weight empty on the character and have the same base reduction, that means the Cart with the mod removing the server folder weighs 7.4 less. So thats a decent reduction and looks about right. 

 

So if the mod is not working for you, remove the server folder since character weight is only handled by the client anyway. The fact that its also there in the server folder may be why its not working for you. 

 

 

 

Edited by FinestHops
Link to comment
Share on other sites

Thank you for your reply FinestHops, I removed the server folder but was still unable to get it to work.

 

I have both Hydrocraft and ItemTweakerAPI on my server's mod list.

 

I have require=Hydrocraft,ItemTweakerAPI in my mod.info which I assumed would force the two mods to load before this one. Additionally I have tried reordering them on the in game list of mods for my server, and it made no difference (I'm not sure how load order is determined).

 

Is there anything else that could be causing the problem?

 

I am including an updated version of my mod with the server folder removed.

 

Thank you.

BetterCarts.zip

Link to comment
Share on other sites

It looks like I solved it (atleast it is working for me now) somehow?

 

My solution (Being posted because the rules say I should, even though I am not sure what actually fixed the problem or how any of this could even have solved the problem):

I uninstalled project zomboid, deleted everything related to project zomboid (Including the folder in the user directory) then reinstalled and rearranged the lines in the mod.info to:

 

description=Modifies the hydrocraft carts to have more reasonable weight reduction.
id=YURcarts
name=Better Carts 
require=Hydrocraft,ItemTweakerAPI
poster=generic.png

 

I am not sure how this solved the problem but it did... Hopefully it stays solved.

Edited by yuriy206
Link to comment
Share on other sites

Hello. Looks like the problem was only partially resolved. It looks like instances of the carts that are spawned with the players or by command line after installing the mod are successfully changed, but those that are found in the world are not changed.

That is, in a world where the mod is shown to work (Ex. I can spawn a Hydrocraft.HCHanddolly by command line and it would give the appropriate amount of Weight Reduction (For hand cart I have changed that to be 80%, not 90% as above but that should not make a difference to my question,)) a handcart found in a warehouse which is also Hydrocraft.HCHanddolly (Checked using admin mode, edit item) will have only 50% weight reduction.

Link to comment
Share on other sites

On 1/19/2018 at 5:16 PM, yuriy206 said:

Hello. Looks like the problem was only partially resolved. It looks like instances of the carts that are spawned with the players or by command line after installing the mod are successfully changed, but those that are found in the world are not changed.

That is, in a world where the mod is shown to work (Ex. I can spawn a Hydrocraft.HCHanddolly by command line and it would give the appropriate amount of Weight Reduction (For hand cart I have changed that to be 80%, not 90% as above but that should not make a difference to my question,)) a handcart found in a warehouse which is also Hydrocraft.HCHanddolly (Checked using admin mode, edit item) will have only 50% weight reduction.

Never mind, turns out i did need the server folder with the lua script after all, re-adding it fixed the problem.

Link to comment
Share on other sites

  • 2 weeks later...

 

On 1/21/2018 at 7:17 AM, yuriy206 said:

Never mind, turns out i did need the server folder with the lua script after all, re-adding it fixed the problem.

Bit of a delay on my part responding. Honestly didnt see a notification it was replied to. Glad to hear that its fully resolved once again 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...