Leonardo Cox

  • Content Count

    432
  • Joined

  • Last visited

 Content Type 

Profiles

Forums

Downloads

Klei Bug Tracker

Game Updates

Hot Lava Bug Reporter

Everything posted by Leonardo Cox

  1. Edit the line: picker.components.sanity:DoDelta(10, false) and change the number to whatever you want.
  2. Take this: local sanity = inst.components.sanity.current if inst.AnimState:GetCurrentFacing() == 2 and sanity > 40 then inst.AnimState:SetBuild("mychar") -- left normal elseif inst.AnimState:GetCurrentFacing() == 0 and sanity > 40 then inst.AnimState:SetBuild("mychar_right") -- right normal elseif inst.AnimState:GetCurrentFacing() == 2 and sanity > 5 then inst.AnimState:SetBuild("insane_drecalen") -- left insane, remove "inst.AnimState:GetCurrentFacing() == 2" if he doesn't have a insane right_build elseif inst.AnimState:GetCurrentFacing() == 0 and sanity > 5 then inst.AnimState:SetBuild("insane_drecalen_right") -- right insane, remove this elseif if he doesn't have insane right_build elseif inst.AnimState:GetCurrentFacing() == 2 and sanity < 5 then inst.AnimState:SetBuild("psycho_drecalen") -- left psycho, remove "inst.AnimState:GetCurrentFacing() == 2" if he doesn't have a psycho right_build elseif inst.AnimState:GetCurrentFacing() == 0 and sanity < 5 then inst.AnimState:SetBuild("psycho_drecalen_right") -- right psycho, remove this elseif if he doesn't have psycho right_build end end) And make it into a function above masterpostinit, like this: local function OnLocomote(inst) --paste that stuff here. end --then in masterpostinit, make the ListenForEvent use this function inst:ListenForEvent("locomote", OnLocomote)
  3. Hmm. We need to check to see if equip == nil to prevent that crash. Did you make equip = v.components.inventory:GetEquippedItem(EQUIPSLOTS.HEAD) or nil ? Also you can do this: for _, v in pairs(very_close_players) do local equip = v.components.inventory:GetEquippedItem(EQUIPSLOTS.HEAD) or nil if not v:HasTag("perfect") and not v.components.health:IsDead() and not v:HasTag("playerghost") and inst.sg:HasStateTag("roaring") then if equip == nil or equip.prefab ~= "earmuffshat" then v:DoTaskInTime(0.7, function(v) if inst.sg:HasStateTag("roaring") and not v.components.health:IsDead() and not v:HasTag("playerghost") then v.sg:GoToState("hit") v.components.health:DoDelta(-8.33333333333) end end end) There is a way to check to see if "equip == nil or equip.prefab ~= "rabbitsmuff" " on the line you mentioned but I honestly never found out how to do it (I still have much to learn about lua/coding). But this should still do the trick. Also you don't want to use "not something == this" because it doesn't work as intended, so you use "something ~= this" instead. ~= is "not equal" just incase you didn't know.
  4. inst:ListenForEvent("locomote", function(inst) your-function-here end) needs to be inside of masterpostinit.
  5. Oops I didn't even notice that it wasn't the inventory component. make it equip = v.components.inventory:GetEquippedItem(EQUIPSLOTS.HEAD) or nil Edit: Darn, Serpens already beat me to it. Edit: I'm dumb
  6. DST has a more updated API and code that is used for DS is altered drastically or completely absent in DST. I'm sure someone else will be able to tell you more accurately whats all different, but you usually want to build mods for one or the other.
  7. --you always want to make sure that equip can show up as nil, also when checking for something that require a ==, don't use "not something == this", use "something ~= this". --So I changed it to where, it SHOULDN't crash if equip == nil for _, v in pairs(very_close_players) do local equip = v.components.equip:GetEquippedItem(EQUIPSLOTS.HEAD) or nil if not v:HasTag("perfect") and not v.components.health:IsDead() and not v:HasTag("playerghost") and inst.sg:HasStateTag("roaring") and equip.prefab ~= "earmuffshat" then v:DoTaskInTime(0.7, function(v) if inst.sg:HasStateTag("roaring") and not v.components.health:IsDead() and not v:HasTag("playerghost") then v.sg:GoToState("hit") v.components.health:DoDelta(-8.33333333333) end end)
  8. All the sounds in the game are packed into .fsb, I don't know of a tool that can unpack these BUT there is a dontstarve.fev file that holds the name of sounds/music in text. However, when I open it up with Notepad++ I get a bunch of odd characters with sound names inbetween, which is weird because last time I opened up a .fev file I got completely readable characters. Anyways... Here are some sounds I found that may or maynot be what you're looking for: sfx/ambience/Ruins_AMB_1 --(goes to up to 11 from what I saw) If these aren't it you should go take a peek into that .fev file yourself, its in: Don'tStarveTogether/data/sounds.
  9. The anim.bin is what contains the animations for axe and swap axe. Also I noticed that this is a DS mod, not a DST mod. This is the DST modding forum. I don't see anything that could prevent it from showing, but I don't do a lot of DS modding. I'll keep looking for a little while longer, but you should probably move this over to the DS modding forums.
  10. Did you put them in assets of the custom axe prefab file? The game won't load custom textures unless they are put in an asset table. --taken from Axe.lua as a example local assets = { Asset("ANIM", "anim/axe.zip"), Asset("ANIM", "anim/goldenaxe.zip"), Asset("ANIM", "anim/swap_axe.zip"), Asset("ANIM", "anim/swap_goldenaxe.zip"), } You also might want to share your mod here, so we can help find the issue.
  11. I've never done alot of clientside code, so I wouldn't be able to tell you how to make it client only. Your second idea might be the 2nd easiest, as you could just edit either the rabbithole with a prefabpostinit and make it have a 50% chance of spawning either crabbit or rabbit. (you'd probably need to make your own crabbit prefab, not sure how to go about editing existing prefab files to have multiple different prefabs in one). For the last idea, making the fish morsels and recipes would be the easiest part, but iirc messing with worldgen might be tricky. -------------------- I say maybe start making a crabbit prefab for the mod (don't copy the prefab from Shipwrecked as it uses a lot of invalid code for DST) mostly copying the rabbit. Once you have Crabbit working then trying adding fish morsels, recipes, etc. Then go from there. --------------------- As long as you know the basics of lua/coding (like what functions, strings, if and then end, etc. are) then you shouldn't have too much difficulty understanding what works after awhile. Edit: But I doubt I'm the best person to answer this, as I don't know a whole lot of DST's innerworkings compared to a lot of other modders here.
  12. So I tried several different events that involved picking up items and couldn't get the prefab name. So instead of that method, use this one: --Put this into your modmain.lua AddPrefabPostInit("flower", function(inst) local function OnPickedfn(inst, picker) if picker and picker.components.sanity and picker.prefab ~= "\yourcharacternamehere" then picker.components.sanity:DoDelta(TUNING.SANITY_MED) elseif picker and picker.components.sanity and picker.prefab == "yourcharacternamehere" then picker.components.sanity:DoDelta(10, false) end if inst.animname == ROSE_NAME and picker.components.combat ~= nil then picker.components.combat:GetAttacked(inst, TUNING.ROSE_DAMAGE) picker:PushEvent("thorns") end GLOBAL.TheWorld:PushEvent("beginregrowth", inst) inst:Remove() end inst.components.pickable.onpickedfn = OnPickedfn end ) If anyone wants to jumpin and tell me which event that will identify the prefab being picked or just have a better method, I would also appreciate it.
  13. For editing existing textures I recommend looking into a custom character/item tutorial where custom textures are explained. For recipes that can only be used by your character, you will need to give him a custom tag: --in masterpostinit of yourcharacter.lua inst:AddTag("myawesomecharacter") --you can name this whatever you want, but if it uses the same name as other existing tags it can cause issues. Then you will need to add a custom recipe into your modmain.lua local Ingredient = GLOBAL.Ingredient local customrecipe = AddRecipe("itemprefabhere", {Ingredient("cutgrass", 3),Ingredient("carrot", 2), Ingredient("berries", 6)}, GLOBAL.RECIPETABS.TOWN, GLOBAL.TECH.SCIENCE_ONE, "yourtagnamehere", nil, nil, 1, nil, "images/inventoryimages/yourprefabicon.xml", "youprefabicon.tex") You can see existing recipes if you want to know stuff like tab names : Don't Starve Together/data/scripts/recipes.lua
  14. You don't want the commas at the end: GLOBAL.STRINGS.NAMES.POTION_SANITY = "Flask of Reality" GLOBAL.STRINGS.NAMES.POTION_RESTORATION = "Elixir of Health" GLOBAL.STRINGS.NAMES.POTION_INSANITY = "Draught of Lunacy" GLOBAL.STRINGS.NAMES.POTION_HEALTH = "Tonic of Health" This should stop the crash.
  15. You might want to ask the creator of the minimap mod or look through his/her mod's code. Also theres a bit of code that allows you to check if the mod is enabled but I'm not sure what it is.
  16. You can try messing around with the EventHandler for death in the stategraph: --taken from Wilson's SG. EventHandler("death", function(inst) if inst.sleepingbag ~= nil and (inst.sg:HasStateTag("bedroll") or inst.sg:HasStateTag("tent")) then -- wakeup on death to "consume" sleeping bag first inst.sleepingbag.components.sleepingbag:DoWakeUp() inst.sleepingbag = nil end inst.sg:GoToState("death") end), You could use a Stategraphevent in your modmain to edit Wilson's SG (assuming you are using his for your character.) --put this somewhere in your modmain.lua, it should overwrite the Eventhandler for death. local EventHandler = GLOBAL.EventHandler local newdeath = EventHandler("death", function(inst) if inst.sleepingbag ~= nil and (inst.sg:HasStateTag("bedroll") or inst.sg:HasStateTag("tent")) then -- wakeup on death to "consume" sleeping bag first inst.sleepingbag.components.sleepingbag:DoWakeUp() inst.sleepingbag = nil end if inst.prefab ~= "your characterprefab name here" then inst.sg:GoToState("death") else --whatever antics you want here end end ), AddStategraphEvent("wilson", newdeath) --if not wilson, then its probably SGwilson.
  17. Where is this located in your modcharacter.lua? in or outside of masterpostinit?
  18. -- Perk: Sanity Perk for Magic inst.components.sanity.magic_drain_mult = 0 -- Perk(disavantage): Sanity Drain from Shadows inst.components.sanity.shadowcreature_drain_mult = 3 These need to be inside of masterpostinit. That function needs to be above at least the common_postinit, but you'll need to replace it anyways, since that function will crash since its a function that requires the prefab to be pickable, which will never be the case for players and this isn't want you want. --I haven't tested this out yet. Remember that this goes above the common_postinit local function onpickup (inst, data) if data.prefab == "flower" then inst.components.sanity:DoDelta(10, false) end end --put this in your masterpostinit inst:ListenForEvent("onpickup", onpickup) Pretty tired so I just made it on the fly, if it crashes let me know so I can correct it.
  19. You mentioned that these are posted at the end of your character.lua. Where is that? inside of masterpostinit or outside of masterpostinit? Maybe show us where this stuff is located in relation to everything else. Also are all of these not working?
  20. Found in Don't Starve Together/data/scripts/constants.lua CHARACTER_GENDERS = { FEMALE = { "willow", "wendy", "wickerbottom", "wathgrithr", }, MALE = { "wilson", "woodie", "waxwell", "wolfgang", "wes", "webber", }, ROBOT = { "wx78", "pyro", }, NEUTRAL = {}, --empty, for modders to add to PLURAL = {}, --empty, for modders to add to }
  21. No unfortunately, inst.components.combat.onhitotherfn Is what made the difference. Its usually more reliable in terms of reading/affecting the target which inst:ListenForEvent("onattackother", onhitother) Doesn't seem to do it at all. I don't know the exact reason why though. Edit: Also call me Leonardo Coxington, DarkKingBoo is my slave name.
  22. Ok so lets do it the same way I tested it. Lets try hitotherfn. I was able to get Wilson's gender through this. --place this somewhere above master_postinit local function onhitother(inst, data) local gender = GetGenderStrings(data.prefab) print(gender) --Lets see if it comes up as "DEFAULT". If it did, that means it didn't work! if gender == "MALE" then data.components.health:DoDelta(-9999) end end --place this somewhere inside master_postinit. inst.components.combat.onhitotherfn = onhitother