Jump to content

Help with putting perks on Mod?


Recommended Posts

EDIT#2: I give up.. can anyone please help me with the specified problems? ;;; I just want him to be able to have 4 papyrus as a starting item and Wickerbottom's ability to craft and use the books. It seemed to work at first when i had the mod on the mod's folder of Don't Starve. but when I use the mod from the subscription option I receive an error saying it doesn't work.  I'll send a zip file of the code and things, I'll gladly do a portrait of your character in a don't starve style im just really desperate to make this work

EDIT: I was able to add the starting items, but I don't know how to make the book crafting ability work. Any help please?

I recently made a character mod for Don't Starve, a Filipino nationalist and polymath named Jose Rizal.

So far It's doing okay but I have some problem's I'd like help with! First, I wanted him to have Wickerbottom's ability to craft and use her books and tweak the numbers of some of the things she spawns. Jose has written his advocacy through his novels so having the books as a perk really seals the deal. The problem is I don't know where to start nor add this perk ^^"

EDIT: I was able to add the starting items, but I don't know how to make the book crafting ability work. Any help please?

joserizal_none.png

 

any help is greatly appreciated! Thank you!

Link to comment
Share on other sites

@Meiima, do you still need help?

Take a look at Wickerbottom's prefab file (data/scripts/prefabs/wickerbottom.lua for vanilla, data/DLC0001/scripts/prefabs/wickerbottom.lua for RoG, data/DLC0002/scripts/prefabs/wickerbottom.lua for SW, they're all very similar), you'll find pretty much everything you need.

To give your character starting items, use the fifth parameter to MakePlayerCharacter, in your case the last line of your character file should look something like this:

return MakePlayerCharacter("joserizal", nil, assets, fn, {"papyrus", "papyrus", "papyrus", "papyrus"}) 

Add the reader component to allow your character to read books.

If you want your character to be able to craft books, just copy Wickerbottom's script:

	local booktab = {str = STRINGS.TABS.BOOKS, sort=999, icon = "tab_book.tex"}
	inst.components.builder:AddRecipeTab(booktab)
	
	Recipe("book_birds", {Ingredient("papyrus", 2), Ingredient("bird_egg", 2)}, booktab, {SCIENCE = 0, MAGIC = 0, ANCIENT = 0})
	Recipe("book_gardening", {Ingredient("papyrus", 2), Ingredient("seeds", 1), Ingredient("poop", 1)}, booktab, {SCIENCE = 1})
	Recipe("book_sleep", {Ingredient("papyrus", 2), Ingredient("nightmarefuel", 2)}, booktab, {MAGIC = 2})
	Recipe("book_brimstone", {Ingredient("papyrus", 2), Ingredient("redgem", 1)}, booktab, {MAGIC = 3})
	
	if SaveGameIndex:IsModeShipwrecked() then
		Recipe("book_meteor", {Ingredient("papyrus", 2), Ingredient("obsidian", 2)}, booktab, {SCIENCE = 3})
	else
		Recipe("book_tentacles", {Ingredient("papyrus", 2), Ingredient("tentaclespots", 1)}, booktab, {SCIENCE = 3})
	end

(Copied from SW.) The first two lines set up the books crafting tab. The next few lines add the crafting recipes for her books. Usually, crafting recipes are placed somewhere else, but Wickerbottom's books' recipes are here so that only she is able to craft them. Copy this style if you want your new books to only be available to your character, or place the recipes in your modmain.lua so everyone can craft them.

Link to comment
Share on other sites

45 minutes ago, alainmcd said:

@Meiima, do you still need help?

Take a look at Wickerbottom's prefab file (data/scripts/prefabs/wickerbottom.lua for vanilla, data/DLC0001/scripts/prefabs/wickerbottom.lua for RoG, data/DLC0002/scripts/prefabs/wickerbottom.lua for SW, they're all very similar), you'll find pretty much everything you need.

To give your character starting items, use the fifth parameter to MakePlayerCharacter, in your case the last line of your character file should look something like this:


return MakePlayerCharacter("joserizal", nil, assets, fn, {"papyrus", "papyrus", "papyrus", "papyrus"}) 

Add the reader component to allow your character to read books.

If you want your character to be able to craft books, just copy Wickerbottom's script:


	local booktab = {str = STRINGS.TABS.BOOKS, sort=999, icon = "tab_book.tex"}
	inst.components.builder:AddRecipeTab(booktab)
	
	Recipe("book_birds", {Ingredient("papyrus", 2), Ingredient("bird_egg", 2)}, booktab, {SCIENCE = 0, MAGIC = 0, ANCIENT = 0})
	Recipe("book_gardening", {Ingredient("papyrus", 2), Ingredient("seeds", 1), Ingredient("poop", 1)}, booktab, {SCIENCE = 1})
	Recipe("book_sleep", {Ingredient("papyrus", 2), Ingredient("nightmarefuel", 2)}, booktab, {MAGIC = 2})
	Recipe("book_brimstone", {Ingredient("papyrus", 2), Ingredient("redgem", 1)}, booktab, {MAGIC = 3})
	
	if SaveGameIndex:IsModeShipwrecked() then
		Recipe("book_meteor", {Ingredient("papyrus", 2), Ingredient("obsidian", 2)}, booktab, {SCIENCE = 3})
	else
		Recipe("book_tentacles", {Ingredient("papyrus", 2), Ingredient("tentaclespots", 1)}, booktab, {SCIENCE = 3})
	end

(Copied from SW.) The first two lines set up the books crafting tab. The next few lines add the crafting recipes for her books. Usually, crafting recipes are placed somewhere else, but Wickerbottom's books' recipes are here so that only she is able to craft them. Copy this style if you want your new books to only be available to your character, or place the recipes in your modmain.lua so everyone can craft them.

thank you! I do still need help, about the last line, should I just add the papyrus in the end? mine looks like

return MakePlayerCharacter("joserizal", prefabs, assets, common_postinit, master_postinit, start_inv)

and with the Wickerbottom script, where part do i paste it into? after the local function on load?

im sorry for the questions orz, this is what the joserizal.lua looks like


local MakePlayerCharacter = require "prefabs/player_common"


local assets = {
    Asset("SCRIPT", "scripts/prefabs/player_common.lua"),
}
local prefabs = {"book_birds",
    "book_tentacles",
    "book_gardening",
    "book_sleep",
    "book_brimstone",}

-- Custom starting items
local start_inv = {"papyrus","papyrus","papyrus","papyrus",}

-- When the character is revived from human
local function onbecamehuman(inst)
	-- Set speed when reviving from ghost (optional)
	inst.components.locomotor:SetExternalSpeedMultiplier(inst, "joserizal_speed_mod", 1)
end

local function onbecameghost(inst)
	-- Remove speed modifier when becoming a ghost
   inst.components.locomotor:RemoveExternalSpeedMultiplier(inst, "joserizal_speed_mod")
end

-- When loading or spawning the character
local function onload(inst)
    inst:ListenForEvent("ms_respawnedfromghost", onbecamehuman)
    inst:ListenForEvent("ms_becameghost", onbecameghost)

    if inst:HasTag("playerghost") then
        onbecameghost(inst)
    else
        onbecamehuman(inst)
    end
end


-- This initializes for both the server and client. Tags can be added here.
local common_postinit = function(inst) 
	-- Minimap icon
	inst.MiniMapEntity:SetIcon( "joserizal.tex" )
end

-- This initializes for the server only. Components are added here.
local master_postinit = function(inst)
	-- choose which sounds this character will play
	inst.soundsname = "wilson"
	
	-- Uncomment if "wathgrithr"(Wigfrid) or "webber" voice is used
    --inst.talker_path_override = "dontstarve_DLC001/characters/"
	
	-- Stats	
	inst.components.health:SetMaxHealth(150)
	inst.components.hunger:SetMax(100)
	inst.components.sanity:SetMax(230)
	
	-- Damage multiplier (optional)
    inst.components.combat.damagemultiplier = 1
	
	-- Hunger rate (optional)
	inst.components.hunger.hungerrate = 1 * TUNING.WILSON_HUNGER_RATE
	
	inst.OnLoad = onload
    inst.OnNewSpawn = onload
	
end

return MakePlayerCharacter("joserizal", prefabs, assets, common_postinit, master_postinit, start_inv)

 

Link to comment
Share on other sites

No need to add anything regarding papyrus since you're already using local start_inv = {"papyrus","papyrus","papyrus","papyrus",} and passing start_inv in your call to MakePlayerCharacter.

Looks like you're using a DST template. Are you creating a DS or DST character?

Link to comment
Share on other sites

13 minutes ago, alainmcd said:

No need to add anything regarding papyrus since you're already using local start_inv = {"papyrus","papyrus","papyrus","papyrus",} and passing start_inv in your call to MakePlayerCharacter.

Looks like you're using a DST template. Are you creating a DS or DST character?

im creating a DST character :0 I used the esctemplate on the character mod tutorial. so I dont need to add the papyrus at the return MakePlayerCharacter?

Link to comment
Share on other sites

Character creation is different in DST. Most of what I said before doesn't apply to DST.

39 minutes ago, Meiima said:

so I dont need to add the papyrus at the return MakePlayerCharacter?

No, it's fine as it is.

If you want your character any book, add inst:AddComponent("reader") to your master_postinit function and inst:AddTag("reader") to your common_postinit function. Anywhere in the function will do. Example below.

If you want your character to be able to craft Wickerbottom's books, add inst:AddTag("bookbuilder") to your common_postinit.

If you want your character to have exclusive books, your character will need an exclusive tag, so add something like inst:AddTag("joserizal") to your common_postinit. The recipes for your books should be placed in your modmain.lua:

AddRecipe("joserizalbook", {Ingredient("papyrus", 1), Ingredient("featherpencil", 1)}, RECIPETABS.BOOKS, TECH.NONE, nil, nil, nil, nil, "joserizal", "images/inventoryimages/joserizalbook.xml")

If you want your character to have exclusive books but not be able to craft Wickerbottom's, change the tab for your custom book. The alternative is creating a new tab for your character, and that's a lot more work.

Example: you want your character to read any book, craft Wickerbottom's books and craft his own books. Your character file should look like this:

Spoiler

local MakePlayerCharacter = require "prefabs/player_common"


local assets = {
    Asset("SCRIPT", "scripts/prefabs/player_common.lua"),
}
local prefabs = {"book_birds",
    "book_tentacles",
    "book_gardening",
    "book_sleep",
    "book_brimstone",}

-- Custom starting items
local start_inv = {"papyrus","papyrus","papyrus","papyrus",}

-- When the character is revived from human
local function onbecamehuman(inst)
    -- Set speed when reviving from ghost (optional)
    inst.components.locomotor:SetExternalSpeedMultiplier(inst, "joserizal_speed_mod", 1)
end

local function onbecameghost(inst)
    -- Remove speed modifier when becoming a ghost
   inst.components.locomotor:RemoveExternalSpeedMultiplier(inst, "joserizal_speed_mod")
end

-- When loading or spawning the character
local function onload(inst)
    inst:ListenForEvent("ms_respawnedfromghost", onbecamehuman)
    inst:ListenForEvent("ms_becameghost", onbecameghost)

    if inst:HasTag("playerghost") then
        onbecameghost(inst)
    else
        onbecamehuman(inst)
    end
end


-- This initializes for both the server and client. Tags can be added here.
local common_postinit = function(inst) 
    inst:AddTag("reader")
    inst:AddTag("bookbuilder")
    inst:AddTag("joserizal")
    
    -- Minimap icon
    inst.MiniMapEntity:SetIcon( "joserizal.tex" )
end

-- This initializes for the server only. Components are added here.
local master_postinit = function(inst)
    inst:AddComponent("reader")
    
    -- choose which sounds this character will play
    inst.soundsname = "wilson"
    
    -- Uncomment if "wathgrithr"(Wigfrid) or "webber" voice is used
    --inst.talker_path_override = "dontstarve_DLC001/characters/"
    
    -- Stats    
    inst.components.health:SetMaxHealth(150)
    inst.components.hunger:SetMax(100)
    inst.components.sanity:SetMax(230)
    
    -- Damage multiplier (optional)
    inst.components.combat.damagemultiplier = 1
    
    -- Hunger rate (optional)
    inst.components.hunger.hungerrate = 1 * TUNING.WILSON_HUNGER_RATE
    
    inst.OnLoad = onload
    inst.OnNewSpawn = onload
    
end

return MakePlayerCharacter("joserizal", prefabs, assets, common_postinit, master_postinit, start_inv)

Code I've added to yours bolded. And, as noted above, the recipes for your books would go in your modmain.lua. I haven't tested it, though.

Link to comment
Share on other sites

8 hours ago, alainmcd said:

Character creation is different in DST. Most of what I said before doesn't apply to DST.

No, it's fine as it is.

If you want your character any book, add inst:AddComponent("reader") to your master_postinit function and inst:AddTag("reader") to your common_postinit function. Anywhere in the function will do. Example below.

If you want your character to be able to craft Wickerbottom's books, add inst:AddTag("bookbuilder") to your common_postinit.

If you want your character to have exclusive books, your character will need an exclusive tag, so add something like inst:AddTag("joserizal") to your common_postinit. The recipes for your books should be placed in your modmain.lua:


AddRecipe("joserizalbook", {Ingredient("papyrus", 1), Ingredient("featherpencil", 1)}, RECIPETABS.BOOKS, TECH.NONE, nil, nil, nil, nil, "joserizal", "images/inventoryimages/joserizalbook.xml")

If you want your character to have exclusive books but not be able to craft Wickerbottom's, change the tab for your custom book. The alternative is creating a new tab for your character, and that's a lot more work.

Example: you want your character to read any book, craft Wickerbottom's books and craft his own books. Your character file should look like this:

  Reveal hidden contents

local MakePlayerCharacter = require "prefabs/player_common"


local assets = {
    Asset("SCRIPT", "scripts/prefabs/player_common.lua"),
}
local prefabs = {"book_birds",
    "book_tentacles",
    "book_gardening",
    "book_sleep",
    "book_brimstone",}

-- Custom starting items
local start_inv = {"papyrus","papyrus","papyrus","papyrus",}

-- When the character is revived from human
local function onbecamehuman(inst)
    -- Set speed when reviving from ghost (optional)
    inst.components.locomotor:SetExternalSpeedMultiplier(inst, "joserizal_speed_mod", 1)
end

local function onbecameghost(inst)
    -- Remove speed modifier when becoming a ghost
   inst.components.locomotor:RemoveExternalSpeedMultiplier(inst, "joserizal_speed_mod")
end

-- When loading or spawning the character
local function onload(inst)
    inst:ListenForEvent("ms_respawnedfromghost", onbecamehuman)
    inst:ListenForEvent("ms_becameghost", onbecameghost)

    if inst:HasTag("playerghost") then
        onbecameghost(inst)
    else
        onbecamehuman(inst)
    end
end


-- This initializes for both the server and client. Tags can be added here.
local common_postinit = function(inst) 
    inst:AddTag("reader")
    inst:AddTag("bookbuilder")
    inst:AddTag("joserizal")
    
    -- Minimap icon
    inst.MiniMapEntity:SetIcon( "joserizal.tex" )
end

-- This initializes for the server only. Components are added here.
local master_postinit = function(inst)
    inst:AddComponent("reader")
    
    -- choose which sounds this character will play
    inst.soundsname = "wilson"
    
    -- Uncomment if "wathgrithr"(Wigfrid) or "webber" voice is used
    --inst.talker_path_override = "dontstarve_DLC001/characters/"
    
    -- Stats    
    inst.components.health:SetMaxHealth(150)
    inst.components.hunger:SetMax(100)
    inst.components.sanity:SetMax(230)
    
    -- Damage multiplier (optional)
    inst.components.combat.damagemultiplier = 1
    
    -- Hunger rate (optional)
    inst.components.hunger.hungerrate = 1 * TUNING.WILSON_HUNGER_RATE
    
    inst.OnLoad = onload
    inst.OnNewSpawn = onload
    
end

return MakePlayerCharacter("joserizal", prefabs, assets, common_postinit, master_postinit, start_inv)

Code I've added to yours bolded. And, as noted above, the recipes for your books would go in your modmain.lua. I haven't tested it, though.

ohh gotcha :0 I just wanted him to be able to craft and use Wickerbottom's book as is. 

and thank you!! this actually fixed everything even the second skin portrait on the second screen when selecting a character! What character would you like me to draw? ^^ I can't thank you enough

Link to comment
Share on other sites

11 hours ago, alainmcd said:

That's very nice of you, but I'm not working on any character (or mod) right now. Thank you!

I see ^^ but if ever you want any character done in a DS art style, I'll be glad to offer myself! May I know what your steam username is? I'd like to credit you in the mod description!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
×
  • Create New...