Sign in to follow this  
UnionGaming

Allow mod character to craft books, and make all mobs instantly attack (it).

Recommended Posts

UnionGaming    210

This is for a Waverly mod I'm making. It needs to be able to craft Wickerbottom's books, and must make all neutral and hostile, or other, mobs to attack her on sight. Thanks in advance.

~Union

Share this post


Link to post
Share on other sites
Auth    9842

Now I'm imagining even rabbits, chester, and butterflies trying to beat you up

Share this post


Link to post
Share on other sites
Lumina    2149

In the Wickerbottom files, there is :

 

 

local function common_postinit(inst)
    inst:AddTag("insomniac")
    inst:AddTag("bookbuilder")
end
 

 

I suppose that the "bookbuilder" make her able to craft book. Since she has also a "reader" component i suppose that be able to craft book don't implie that you will be able to read it too.

 

But i don't know if you need also something special to have access to the book tab or if the tag is enough.

Share this post


Link to post
Share on other sites
rons0n    124

inst:AddTag("bookbuilder")

 

you put in your characters common_postinit

 

inst:AddComponent("reader")

 

is added in your master_postinit

 

example:

local MakePlayerCharacter = require "prefabs/player_common"local assets = {        Asset( "ANIM", "anim/player_basic.zip" ),        Asset( "ANIM", "anim/player_idles_shiver.zip" ),        Asset( "ANIM", "anim/player_actions.zip" ),        Asset( "ANIM", "anim/player_actions_axe.zip" ),        Asset( "ANIM", "anim/player_actions_pickaxe.zip" ),        Asset( "ANIM", "anim/player_actions_shovel.zip" ),        Asset( "ANIM", "anim/player_actions_blowdart.zip" ),        Asset( "ANIM", "anim/player_actions_eat.zip" ),        Asset( "ANIM", "anim/player_actions_item.zip" ),        Asset( "ANIM", "anim/player_actions_uniqueitem.zip" ),        Asset( "ANIM", "anim/player_actions_bugnet.zip" ),        Asset( "ANIM", "anim/player_actions_fishing.zip" ),        Asset( "ANIM", "anim/player_actions_boomerang.zip" ),        Asset( "ANIM", "anim/player_bush_hat.zip" ),        Asset( "ANIM", "anim/player_attacks.zip" ),        Asset( "ANIM", "anim/player_idles.zip" ),        Asset( "ANIM", "anim/player_rebirth.zip" ),        Asset( "ANIM", "anim/player_jump.zip" ),        Asset( "ANIM", "anim/player_amulet_resurrect.zip" ),        Asset( "ANIM", "anim/player_teleport.zip" ),        Asset( "ANIM", "anim/wilson_fx.zip" ),        Asset( "ANIM", "anim/player_one_man_band.zip" ),        Asset( "ANIM", "anim/shadow_hands.zip" ),        Asset( "SOUND", "sound/sfx.fsb" ),        Asset( "SOUND", "sound/wilson.fsb" ),        Asset( "ANIM", "anim/beard.zip" ),        Asset( "ANIM", "anim/rin.zip" ),        Asset( "ANIM", "anim/ghost_rin_build.zip" ),}local prefabs = {	"amulet",	"firestaff",	"redgem",	"bluegem",	"purplegem",	"orangegem",	"greengem",	"yellowgem",	"thulecite",}	local start_inv = {	-- Custom starting items	"amulet",	"gandr",	"papyrus",	"papyrus",}-- This initializes for both clients and the hostlocal common_postinit = function(inst) 	-- Minimap icon	inst.MiniMapEntity:SetIcon( "rin.tex" )		inst:AddTag("ancient_builder")	inst:AddTag("bookbuilder")	inst:AddTag("insomniac")endlocal function RespawnFromGhost(inst)        if inst.components.health then           if inst.components.health.numrevives >= 1 then                inst.components.health.numrevives = 1           end        endend-- This initializes for the host onlylocal master_postinit = function(inst)	-- choose which sounds this character will play	inst.soundsname = "willow"	-- Stats		inst:AddComponent("reader")	inst.components.health:SetMaxHealth(100)	inst.components.hunger:SetMax(125)	inst.components.sanity:SetMax(250)		inst.components.builder.ancient_bonus = 4		inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED)	inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED)			inst:ListenForEvent("respawnfromghost", RespawnFromGhost)endreturn MakePlayerCharacter("rin", prefabs, assets, common_postinit, master_postinit, start_inv)

Share this post


Link to post
Share on other sites
rons0n    124

I don't seem to understand what you're doing.

 

I added both the tag and component to your character in the workshop and it worked perfectly. How are you applying this?

 

Yours is the waverly character in the workshop yes? The one that starts out with an ice staff, 4 papyrus, 1 eyebone, and 9 nightmarefuel?

 

If it is, this is how I added it to your character and it worked just as intended.

local MakePlayerCharacter = require "prefabs/player_common"local assets = {        Asset( "ANIM", "anim/player_basic.zip" ),        Asset( "ANIM", "anim/player_idles_shiver.zip" ),        Asset( "ANIM", "anim/player_actions.zip" ),        Asset( "ANIM", "anim/player_actions_axe.zip" ),        Asset( "ANIM", "anim/player_actions_pickaxe.zip" ),        Asset( "ANIM", "anim/player_actions_shovel.zip" ),        Asset( "ANIM", "anim/player_actions_blowdart.zip" ),        Asset( "ANIM", "anim/player_actions_eat.zip" ),        Asset( "ANIM", "anim/player_actions_item.zip" ),        Asset( "ANIM", "anim/player_actions_uniqueitem.zip" ),        Asset( "ANIM", "anim/player_actions_bugnet.zip" ),        Asset( "ANIM", "anim/player_actions_fishing.zip" ),        Asset( "ANIM", "anim/player_actions_boomerang.zip" ),        Asset( "ANIM", "anim/player_bush_hat.zip" ),        Asset( "ANIM", "anim/player_attacks.zip" ),        Asset( "ANIM", "anim/player_idles.zip" ),        Asset( "ANIM", "anim/player_rebirth.zip" ),        Asset( "ANIM", "anim/player_jump.zip" ),        Asset( "ANIM", "anim/player_amulet_resurrect.zip" ),        Asset( "ANIM", "anim/player_teleport.zip" ),        Asset( "ANIM", "anim/wilson_fx.zip" ),        Asset( "ANIM", "anim/player_one_man_band.zip" ),        Asset( "ANIM", "anim/shadow_hands.zip" ),        Asset( "SOUND", "sound/sfx.fsb" ),        Asset( "SOUND", "sound/wilson.fsb" ),        Asset( "ANIM", "anim/beard.zip" ),        Asset( "ANIM", "anim/waverly.zip" ),        Asset( "ANIM", "anim/ghost_waverly_build.zip" ),}local prefabs = {}-- Custom starting itemslocal start_inv = {    "icestaff",    "papyrus",    "papyrus",    "papyrus",    "papyrus",    "chester_eyebone",    "nightmarefuel",    "nightmarefuel",    "nightmarefuel",    "nightmarefuel",    "nightmarefuel",    "nightmarefuel",    "nightmarefuel",    "nightmarefuel",    "nightmarefuel",}-- When the character is revived from humanlocal function onbecamehuman(inst)    -- Set speed when loading or reviving from ghost (optional)    inst.components.locomotor.walkspeed = 3    inst.components.locomotor.runspeed = 4end-- When loading or spawning the characterlocal function onload(inst)    inst:ListenForEvent("ms_respawnedfromghost", onbecamehuman)    if not inst:HasTag("playerghost") then        onbecamehuman(inst)    endend-- This initializes for both the server and client. Tags can be added here.local common_postinit = function(inst)    -- Minimap icon    inst.MiniMapEntity:SetIcon( "waverly.tex" )    inst:AddTag("bookbuilder")    inst:AddTag("insomniac")    inst:AddTag("witch")    inst:AddTag("waverly")    inst:AddTag("monster")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 = "waverly"        -- Uncomment if "wathgrithr"(Wigfrid) or "webber" voice is used    --inst.talker_path_override = "dontstarve_DLC001/characters/"        -- Stats    inst:AddComponent("reader")    inst.components.health:SetMaxHealth(115)    inst.components.hunger:SetMax(150)    inst.components.sanity:SetMax(75)    inst.components.builder.magic_bonus = 2        -- Damage multiplier (optional)    inst.components.combat.damagemultiplier = 0.8        -- Hunger rate (optional)    inst.components.hunger.hungerrate = 0.8 * TUNING.WILSON_HUNGER_RATE        inst.OnLoad = onload    inst.OnNewSpawn = onloadendreturn MakePlayerCharacter("waverly", prefabs, assets, common_postinit, master_postinit, start_inv)

 

EDIT: Oh your problem was obvious. You had two local common_postinit in your character prefabs. Did a quick fix, it should work now.

Edited by rons0n

Share this post


Link to post
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
Sign in to follow this