Jump to content

Recommended Posts

So here I am, reading the wiki, when I see that Magiluminescence can be refueled by nightmare fuel?! I immediately go and craft one and try it...but it doesn't work. Confused, I ask Dr. Google why it won't work. Turns out, this is a new feature in Shipwrecked, not DST.

So I can't refuel my brand new Magiluminescence. This will not do.

So my questions are twofold: What's the best way to mod an item already existing in the base game, and how do you add new fuels to them?

How DS:SW did it:

item to use as fuel:

inst:AddComponent("fuel")
    inst.components.fuel.fueltype = "NIGHTMARE"
    inst.components.fuel.fuelvalue = TUNING.LARGE_FUEL

item to be fueled:

inst:AddComponent("fueled")
    inst.components.fueled.accepting = true
    inst.components.fueled.fueltype = "NIGHTMARE"
    inst.components.fueled:InitializeFuelLevel(TUNING.YELLOWAMULET_FUEL)

 

so unless they changed how fuel works in DS:SW, you can just give a fueltype to an item, then use it elsewhere

Thank you! That worked just fine. Turns out DST already has made nightmare fuel a fuel type, so I only had to change the magiluminescence. That said, this is my first time actually creating a mod, instead of just editing another. In-game, the mod is stable, but if I try to relaunch a server that has already been running it, I get this message:

[string "scripts/modindex.lua"]:626: bad argument #1 to 'pairs' (table expected, got string)

And then the full lua error stack traceback after that. Not sure what to do here.

24 minutes ago, KirbyJParasol said:

Thank you! That worked just fine. Turns out DST already has made nightmare fuel a fuel type, so I only had to change the magiluminescence. That said, this is my first time actually creating a mod, instead of just editing another. In-game, the mod is stable, but if I try to relaunch a server that has already been running it, I get this message:


[string "scripts/modindex.lua"]:626: bad argument #1 to 'pairs' (table expected, got string)

And then the full lua error stack traceback after that. Not sure what to do here.

should probably post the full error.

btw you should probably add this if u dont have it on it:

inst.components.fueled:SetDepletedFn(inst.Remove)

Edited by Aquaterion
3 hours ago, KirbyJParasol said:

That said, this is my first time actually creating a mod, instead of just editing another. In-game, the mod is stable, but if I try to relaunch a server that has already been running it, I get this message:


[string "scripts/modindex.lua"]:626: bad argument #1 to 'pairs' (table expected, got string)

And then the full lua error stack traceback after that. Not sure what to do here.

It seems to point to incorrect value of configuration_options in modinfo. In addition to full error please post whole modinfo.lua.

http://prntscr.com/aeiim4

And then here's the modinfo.lua

-- This information tells other players more about the mod
name = "Refuel Magiluminescence"
description = "Now you can fuel the Magiluminescence with Nightmare Fuel, just like in Shipwrecked!"
author = "KirbyJParasol"
version = "1"

-- This is the URL name of the mod's thread on the forum; the part after the index.php? and before the first & in the URL
-- Example:
-- http://forums.kleientertainment.com/index.php?/files/file/202-sample-mods/
-- becomes
-- /files/file/202-sample-mods/
forumthread = ""

-- This lets other players know if your mod is out of date, update it to match the current version in the game
api_version = 1

---- Can specify a custom icon for this mod!
icon_atlas = ""
icon = ""

--This lets the clients know that they need to download the mod before they can join a server that is using it.
--all_clients_require_mod = false

--This let's the game know that this mod doesn't need to be listed in the server's mod listing
client_only_mod = false

--Let the mod system know that this mod is functional with Don't Starve Together
dst_compatible = true

--These tags allow the server running this mod to be found with filters from the server listing screen
server_filter_tags = {"Refuel Magiluminescence"}


configuration_options = ""

 

Well, it's still stable, but it has an unintended function. It's now impossible to craft any amulet BESIDES the magiluminescence.

 

EDIT: I hotfixed it myself. So I learned that when you mod a base game file, you need to make sure to include EVERYTHING the old file had, and then put in your modifications. Instead of just including the lines relevant to your modded item.

Which is what I did at first. Only included the Magiluminescence code. Cut out the code for alllll the other amulets. Yeah...

Edited by KirbyJParasol
hotfix

Yeah, replacing whole base game files is generally bad practice, it increases the chances of your mod being incompatible with other mods or future game updates.

I think your idea could be implemented by adding

AddPrefabPostInit("yellowamulet", function(inst)
    inst.components.fueled.accepting = true
    inst.components.fueled.fueltype = GLOBAL.FUELTYPE.NIGHTMARE
end)

into modmain.lua (and not touching prefabs/amulet.lua at all).

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