AkaiNight

  • Content Count

    319
  • Joined

  • Last visited

Community Reputation

31 Excellent

1 Follower

About AkaiNight

  • Rank
    Senior Member
...

Recent Profile Visitors

2535 profile views
  1. local function ChangeOnLowSanity(inst) if inst:HasTag("playerghost") then return if inst.components.sanity.current > 100 then inst.AnimState:SetBuild("character_preferance")--change that with your character look thing inst.components.hunger:DoDelta(-1000)--im sure there is better way to set your hunger 0 but this will work too end end ChangeOnLowSanity(inst) and put it under master_postinits and if you already have the code and you just want to add sanity and hunger thing local function yourcode if inst.components.sanity.current > 100 then -- this will check if your character has more than 100 sanity if not then the code bellow will not being executed --your code if yourcode then --this part is when your character changes his preference when you press a key yourcode inst.components.hunger:DoDelta(-1000)--im sure there is better way to set your hunger 0 but this will work too end end lemme know if there is any problem
  2. can you send the server_log or your character file im not expert but i can try to fix or find the problem
  3. can you send me your mod file so i can try it local characterlook1 = false local characterlook2 = false local function character_normal(inst) inst.AdmiNState:SetBuild("character")--replace character with your character name characterlook1 = false characterlook2 = false end local function characterlook1(inst) inst.AdmiNState:SetBuild("characterlook1") -- replace characterlook1 with build file u want to use characterlook1 = true characterlook2 = false end local function characterlook2(inst) inst.AdmiNState:SetBuild("characterlook2") -- replace characterlook2 with build file u want to use characterlook1 = false characterlook2 = true end local function AllMightiness(inst)-- change numbers as you like if inst.HasTag("playerghost") then return end if inst.components.sanity.current <= 50 then inst.components.locomotor.walkspeed = TUNING.WILSON.WALK_SPEED * 1.25 inst.components.combat.damagemultipler = 0.75 characterlook1(inst) inst.components.talker:Say("I am using characterlook1") inst.SoundEmitter:PlaySound("dontstarve/characters/wendy/talk") end if inst.components.sanity.current <= 75 then inst.components.locomotor.walkspeed = TUNING.WILSON.WALK_SPEED * 1.33 inst.components.combat.damagemultipler = 1 characterlook2(inst) inst.components.talker:Say("I am using characterlook2") inst.SoundEmitter:PlaySound("dontstarve/characters/wendy/talk") end if inst.components.sanity.current >= 75 then inst.components.locomotor.walkspeed = TUNING.WILSON.WALK_SPEED * 1.5 inst.components.combat.damagemultipler = 1.5 character_normal(inst) inst.components.talker:Say("I am using character_normal") inst.SoundEmitter:PlaySound("dontstarve/characters/wendy/talk") end end inst:ListenForEven("AllMightiness", AllMightiness) the first and long one in character.lua and second one is under master_postinit
  4. Im not sure if about that but you can try to add OnSanityDrop function under onbecamehuman function like that local function onbecamehuman(inst) -- Set speed when not a ghost (optional) inst.components.locomotor:SetExternalSpeedMultiplier(inst, "thobeo_speed_mod", 1) OnSanityDrop(inst, data) end im not sure if its the proper way to do it but i think this will trigger the code when u become human
  5. The problem is i don't know how to make a basic eater its not a character and I think its not about eating because as i mentioned it should be a crafter on its own but this feature doesn't work. Its first time im making a companion and i don't know coding (just tying to understand while making and im trying to find similar modes i want and i try to edit them)
  6. I am trying to make a companion who is a crafting station and im trying to make her upgradeable with an item and i think the easiest way to do it is adding eater component but the problem is she is not eating anythign not just the custom item i made( i tried it with my character its eatable food) but not even normal foods. I don't know what im missing(i checked critters and woby files for it). I think problem is about interactions beacue even im near her the items should be able to craftable with certain tech is not craftable too (but i can craft them with c_freecrafting() code so i think item is fine and problem is about companion). So any help would be great. I am leaving companion's code let me know if there is anything else u need and it would be helpful if u know any tutorial or similar code like it. local assets = { Asset("ANIM", "anim/liira.zip"), --Asset("SOUND", "sound/liira.fsb"), } local prefabs = { "fairybait", "globalmapiconunderfog", } local brain = require("brains/liirabrain") local function OnStartFollowing(inst) inst:AddTag("companion") end local function FairyLevel(inst) local max_fairyexp = 10 local min_fairyexp = 0 local max_fairylevel = 4 local min_fairylevel = 0 local fairyexp = math.min (inst.fairyexp, max_fairyexp, min_fairyexp) if inst.fairylevel == 1 then inst.components.prototyper.trees = TUNING.PROTOTYPER_TREES.FAIRY_TECH_ONE end if inst.fairylevel == 2 then inst.components.prototyper.trees = TUNING.PROTOTYPER_TREES.FAIRY_TECH_TWO end if inst.fairylevel == 3 then inst.components.prototyper.trees = TUNING.PROTOTYPER_TREES.FAIRY_TECH_THREE end if inst.fairylevel == 4 then inst.components.prototyper.trees = TUNING.PROTOTYPER_TREES.FAIRY_TECH_FOUR end if inst.fairyexp == 10 then inst.fairylevel = inst.fairylevel + 1 inst.fairyexp = 0 end end local function OnEat(inst, food) if food and food.components.edible and food.prefab == "fairy_cream" then inst.fairyexp = inst.fairyexp + 1 FairyLevel(inst) end end local function onpreload(inst, data) if data.fairyexp and data.fairylevel then inst.fairyexp = data.fairyexp inst.fairylevel = data.fairylevel fairylevel(inst) end end local function onsave(inst,data) data.fairyexp = inst.fairyexp data.fairylevel = inst.fairylevel end local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddSoundEmitter() inst.entity:AddDynamicShadow() inst.entity:AddNetwork() inst.entity:AddLightWatcher() inst.DynamicShadow:SetSize(2, .75) --same as glommer change if its needed inst.Transform:SetFourFaced() --inst.Transform:SetScale(0.7, 0.7, 1) MakeGhostPhysics(inst, 1, 5) -- i don't know what the heck is this but same with glommer inst.AnimState:SetBank("liira") inst.AnimState:SetBuild("liira") inst.AnimState:PlayAnimation("idle_loop") inst:AddTag("liira") inst:AddTag("flying") inst:AddTag("ignorewalkableplatformdrowning") inst:AddTag("cattoyairborne") --probably this is for cats to play with it inst:AddTag("notraptrigger") inst:AddTag("noauradamage") inst:AddTag("prototyper") inst:AddTag("NOBLOCK") inst.fairylevel = 1 inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end inst:AddComponent("inspectable") inst:AddComponent("follower") inst:ListenForEvent("startfollowing", OnStartFollowing) inst:AddComponent("eater") inst.components.eater:SetDiet({FOODTYPE.MEAT}, {FOODTYPE.MEAT}) inst:AddComponent("knownlocations") inst:AddComponent("locomotor") inst.components.locomotor.walkspeed = 8 inst.components.locomotor.pathcaps = {allowocean = true} inst:SetStateGraph("SGliira") inst:SetBrain(brain) inst:ListenForEvent("levelfairy", FairyLevel) inst.components.eater:SetOnEatFn(OnEat) inst.OnLoad = onpreload inst.OnNewSpawn = onpreload inst.OnSave = onsave inst.OnPreLoad = onpreload return inst end return Prefab("liira", fn, assets, prefabs) liira.lua
  7. somewhere in your character.lua be sure that its not under master_postinit or something like it. and put this inst:WatchWorldState("isday", FullmoonBoost) inst:WatchWorldState("isnight", FullmoonBoost) inst:WatchWorldState("moonphase", FullmoonBoost) under master_postinit. If you couldn't figure it send me your mod file
  8. well im using this code for extra damage from hounds but im not sure how to change it as you like but im leaving it if u can local function ExtraHoundDamage(inst) local _GetAttacked = inst.components.combat.GetAttacked inst.components.combat.GetAttacked = function(self, attacker, damage, ...) if attacker and attacker:HasTag("hound") and damage then damage = damage * 1.5 end return _GetAttacked(self, attacker, damage, ...) end end ExtraHoundDamage(inst) master_postinit
  9. oh i see thanks. And i assume i can add "inst.components.eater.caneat" as much as i like.
  10. FOODTYPE = { GENERIC = "GENERIC", MEAT = "MEAT", VEGGIE = "VEGGIE", ELEMENTAL = "ELEMENTAL", GEARS = "GEARS", HORRIBLE = "HORRIBLE", INSECT = "INSECT", SEEDS = "SEEDS", BERRY = "BERRY", --hack for smallbird; berries are actually part of veggie RAW = "RAW", -- things which some animals can eat off the ground, but players need to cook BURNT = "BURNT", --For lavae. ROUGHAGE = "ROUGHAGE", WOOD = "WOOD", GOODIES = "GOODIES", MONSTER = "MONSTER", -- Added in for woby, uses the secondary foodype originally added for the berries } so you mean its ok if i just add local FOODTYPE = { CUSTOM_FOODTYPE = "CUSTOM_FOODTYPE"} in modmain and in food.lua inst.components.edible.foodtype = "CUSTOM_FOODTYPE" and same for diet?
  11. I know how to make a food item (only craftable) but i don't know how to make a custom food type(diet) and i don't know how to make it only diet for custom character. I checked food tutorial but there was nothign about food type(or i miss it). It would be great if anyone have an example or tutorial for it.
  12. If im correct you just want a little boost for your character at fullmoon. Here what i use for my char. this one is for character appereance change you can pass this if you don't want to change your characters look. local ischaractername_normal = true local ischaractername_fullmoon = false local function character_normal(inst) inst.AnimState:SetBuild("charactername") local ischaractername_normal = true local ischaractername_fullmoon = false end local function character_fullmoon(inst) inst.AnimState:SetBuild("charactername_fullmoon") -- the file you want to use for look change. local ischaractername_normal = false local ischaractername_fullmoon = true end local function FullmoonBoost(inst) if TheWorld.state.isnight then if TheWorld.state.moonphase == "full" then inst.components.locomotor.walkspeed = 3 inst.components.locomotor.runspeed = 3 -- you can change numbers as you like character_fulmoon(inst) end end end local function TurnToNormal(inst) if TheWorld.state.isnight or TheWorld.state.isday or TheWorld.state.isdusk then --- im not sure about dusk if not TheWorld.state.moonphase == "full" then inst.components.locomotor.walkspeed = 3 inst.components.locomotor.runspeed = 3 -- normal vaules character_normal(inst) end end end im not sure about "if not" part would work or not if it does not. use it like the night/day one. lemme know if there is any problem