• Content Count

  • Joined

  • Last visited

Community Reputation

14 Good

About HarryPPP

  • Rank
    Junior Member

Recent Profile Visitors

252 profile views
  1. Moving images in Spriter doesn't change how they are loaded in-game, as the player animations override their positions. The Spriter file you have is only to have a preview of your character, and not change any image positions. It is recommended to move the image in the .png file rather than in Spriter. If you ran out of space to move the image in the .png file, then I'm not really sure what you should do.
  2. Oh! Sorry for the somewhat late response, @Schulliya. You can find all scripts inside a .zip file named "scripts" under "C:\Program Files (x86)\Steam\steamapps\common\Don't Starve Together\data\databundles". All you need to do is open it and go the folder called "stategraphs". You should find a file called "SGWilson", that's where the player stategraphs are. I suppose you can by putting "act.doer.sg:GoToState("statename")" in the "DASH.fn" function... If it executes too early, you can always call "act.doer:DoTaskInTime(time, function)".
  3. You need to asign a stategraph to your custom action... Like this: AddStategraphActionHandler("wilson", GLOBAL.ActionHandler(DASH_ACTION, "dolongaction")) After the character finishes the animation, the text will be printed.
  4. It's actually quite simple! Put this code below the "master_postinit" function in your character's file: if inst.components.eater ~= nil then table.insert(inst.components.eater.preferseating, FOODTYPE.ELEMENTAL) -- FOODTYPE.ELEMENTAL are pretty much all rocks in the game, including gems. table.insert(inst.components.eater.caneat, FOODTYPE.ELEMENTAL) inst:AddTag(FOODTYPE.ELEMENTAL.."_eater") -- Add a tag in case you want to check if a character can eat rocks. end I'm not sure if this is the best way of doing this, but I did what the "eater" component did for WX-78 eating gears.
  5. Hm, I couldn't quite understand, but I think I know what you mean... As I can see, this code seems very similar to how they did on Don't Starve, which is pretty deprecated. I've updated the code to how it's written in Don't Starve Together, and also fixed your problem. For an item to work on servers, you need to add "inst.entity:AddNetwork()" to your file. I've already done it below, you can just copy the code and it should work... local assets= { Asset("ANIM", "anim/wedge_breeze.zip"), Asset("ANIM", "anim/swap_wedge_breeze.zip"), Asset("ATLAS", "images/inventoryimages/wedge_breeze.xml"), Asset("IMAGE", "images/inventoryimages/wedge_breeze.tex"), } local prefabs = { } local function OnEquip(inst, owner) --owner.AnimState:OverrideSymbol("swap_object", "swap_wedge_breezes", "purplestaff") owner.AnimState:OverrideSymbol("swap_object", "swap_wedge_breeze", "wedge_breeze") owner.AnimState:Show("ARM_carry") owner.AnimState:Hide("ARM_normal") end local function OnUnequip(inst, owner) owner.AnimState:Hide("ARM_carry") owner.AnimState:Show("ARM_normal") end local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.AnimState:SetBank("wedge_breeze") inst.AnimState:SetBuild("wedge_breeze") inst.AnimState:PlayAnimation("idle") inst:AddTag("sharp") inst:AddTag("pointy") --weapon (from weapon component) added to pristine state for optimization inst:AddTag("weapon") MakeInventoryFloatable(inst, "med", 0.05, {1.1, 0.5, 1.1}, true, -9) inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end inst:AddComponent("weapon") inst.components.weapon:SetDamage(TUNING.SPIKE_DAMAGE) ------- inst:AddComponent("finiteuses") inst.components.finiteuses:SetMaxUses(TUNING.GLASSCUTTER.USES) inst.components.finiteuses:SetUses(TUNING.GLASSCUTTER.USES) inst.components.finiteuses:SetOnFinished(inst.Remove) inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem.imagename = "wedge_breeze" inst.components.inventoryitem.atlasname = "images/inventoryimages/wedge_breeze.xml" inst:AddComponent("equippable") inst.components.equippable:SetOnEquip( OnEquip ) inst.components.equippable:SetOnUnequip( OnUnequip ) inst.components.equippable.dapperness = TUNING.CRAZINESS_MED inst.components.equippable.is_magic_dapperness = true return inst end return Prefab("wedge_breeze", fn, assets, prefabs) If you have any more questions, don't mind asking!
  6. First of all, that code is not very good. It is unecessary processing taken, checking every 0.1 seconds. Also, the "inst.components.combat.damagemultiplier = inst.components.combat.damagemultiplier / 2" would make so every time the game checks, your damage would get 50% lower. Meaning that it would be 1, 0.5, 0.25 and going lower... A more efficient and optimized way to do that would be: -- Place this under master_postinit. inst:ListenForEvent("moisturedelta", function() local m = inst.components.moisture:GetMoisture() -- Get your current moisture. if m > 0 then -- If moisture is higher than that number, do: inst.components.combat.damagemultiplier = .75 -- This makes your damage 25% weaker. Value can be whatever. else inst.components.combat.damagemultiplier = 1 -- Your normal damage. end end) The code above happens only when your moisture changes, instead of constantly repeating itself. And also, when you are not wet, it'll change your character's damage back to normal (1 in this example). Hope I helped! If you have any more questions, don't mind asking!
  7. I'm not quite sure... I never tried, but I would guess it's a no.
  8. It's quite simple. An example taken out of my mod: AddRecipe("potions_station_item", {Ingredient("boards", 4), Ingredient("transistor", 2), Ingredient("cutstone", 2)}, RECIPETABS.SCIENCE, TECH.SCIENCE_ONE, nil, nil, nil, nil, "scientist","images/inventoryimages/potions_station_item.xml") Here's a little breakdown of each component: AddRecipe( "youritem", -- Prefab to be crafted. {Ingredient("item1", 1), Ingredient("item2", 1), Ingredient("item3", 1)}, -- Ingredients. RECIPETABS.WAR, -- Tab. TECH.NONE, -- Tech. nil, -- Extra data. Not needed. nil, -- Minimal spacing. Not needed. nil, -- Wether or not you can Prototype the recipe. Prototyped recipes can be crafted anytime after crafted. (true or false) nil, -- The amount of the item that is given upon crafting. "customtag", -- THIS is what we are looking for: the tag your character needs to have in order to see the recipe. ) See the "customtag" written there? You need to replace it with a Tag your character has.
  9. About the Tumbleweed, I'm not quite sure, but I can help with the wake up mobs feature. This function should wake up everything in the selected range. local CANT_TAGS = { "test_tag", -- Having said tags will cause the function to fail. } local RANGE = 8 -- The range. local function WakeUp(source, range, cant_tags) local x, y, z = source.Transform:GetWorldPosition() local ents = TheSim:FindEntities(x, y, z, range, nil, cant_tags) -- Find all entities in said range, ignoring the ones with the CANT_TAGS. for i, v in ipairs(ents) do -- For each entity found, do: if v.components.sleeper ~= nil and v.components.sleeper:IsAsleep() then -- Sleeper is used for creatures such as Hounds, Pigs... v.components.sleeper:WakeUp() elseif v.components.grogginess ~= nil and v.components.grogginess:IsKnockedOut() then -- Grogginess is used mainly for players. v.components.grogginess:ComeTo() end end end You can call this function from inside the Lua file using: WakeUp(inst, RANGE, CANT_TAGS) (This example implies that you are trying to make a prefab with it. If it's not, then you would need to get an entity other than "inst" to serve as the focus point. You could also modify the function a bit to get world coordinates, rather than using another entity as the reference point.)
  10. Usually, instead of shrinking the hair_hat, you erase the upper most areas in sort of an arch shape. Like Wilson's hair, for example: This makes so you can't see the hair_hat layer over the normal hair layer, as there is no difference except that you erased the top part.
  11. Oh, that's right. Pig Skin actually already heals 10 health naturally, that's why you are healing 20 health points.
  12. Huh. Couldn't you just test if the food prefab is not "pigskin"? Like this: local _Eat = inst.components.eater.Eat --backup original function inst.components.eater.Eat = function(self, food, feeder, ...) --override original function if food ~= nil and not (food.prefab == "pigskin" or (food.components.edible ~= nil and food.components.edible.foodtype == FOODTYPE.MEAT)) then -- This tests if the food prefab is not Pig Skin, or if the food is not meat. inst.components.health:DoDelta(-5) self.healthabsorption = 0 --lower our healthabsorption to 0 so we get no health from nonmeats end local result = _Eat(self, food, feeder, ...) --call backuped function copy of original self.healthabsorption = 1 --return it to default return result --return the results from _Eat end It took me a surprisingly long time to get to this.
  13. I'd suggest changing this part: To: elseif food.components ~= nil and food.components.edible ~= nil and food.components.edible.foodtype == FOODTYPE.MEAT then As it makes it more compatible if Klei ever changes the "MEAT" food type name (for some unknown reason). Also, don't use ListenForEvent to test what he's eating. You should use: inst.components.eater:SetOnEatFn(oneat) I tested it, and using SetOnEatFn actually makes the character detect the right food.
  14. Did you remind to put: if not TheWorld.ismastersim then return inst end Before adding your item's components? Example from a item in my mod, with comments to help understand: local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.AnimState:SetBank("flowersalve") inst.AnimState:SetBuild("flowersalve") inst.AnimState:PlayAnimation("idle") MakeInventoryFloatable(inst, "small", 0.05, 0.95) inst.entity:SetPristine() if not TheWorld.ismastersim then -- This tests if the player is not the host. return inst -- If the player IS NOT the host, then stop the function. end -- If the player IS the host, then load the remaining code. -- Components info is server sided, meaning that it's not meant for clients, or players that aren't the host. inst:AddComponent("stackable") inst.components.stackable.maxsize = TUNING.STACK_SIZE_SMALLITEM inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname = "images/inventoryimages/flowersalve.xml" inst:AddComponent("healer") inst.components.healer:SetHealthAmount(TUNING.DSTE.FLOWERSALVE_HEALING) MakeHauntableLaunch(inst) return inst end