Jump to content

Recommended Posts

Posted Image

Posted Image

I got some screenshots.

Was this ever resolved? I've got the same issue:

(only thing I did was tint the .tex file and reconvert (from swap Krampus anim file).

Ah, (Don't forget to check premultiply and generate mips!) seems to be the key!

Edited by tehMugwump
  • Developer

I have questions about anim.bin found in the animation zip files.

Do they require build rennamer?

I tried to create a new equipable item and it doesn't show up on the ground.

Edit: It also doesn't show up in hand. Only inventory image.

anim.bin shouldn't require the build renamer, only build.bin.

Here's all the steps I can think of, see if any of these got missed maybe?

    [*]Get an item .zip from the base game, such as data/anim/axe.zip, copy it to your mod folder.

    [*]Extract the files from it.

    [*]Convert atlas-0.tex to a PNG, fill it with your artwork, and convert it back to a .tex.

    [*]Use buildrenamer to give the build.bin a new ID, e.g. 'myitem'. (Note: it still needs to be called build.bin, the renamer just edits a name stored inside the file)

    [*]Pack the anim.bin, build.bin, and atlas-0.tex into a zip, and give it the same name that you gave to buildrenamer, e.g. 'myitem.zip'

    [*]Add a line to your assets list in either the prefab definition or modmain, i.e. Asset("ANIM", "anim/myitem.zip")

    [*]In the prefab, do anim:SetBank("myitem") and anim:SetBuild("myitem")

If that all seems to be correct, check My Documents\Klei\DoNotStarve\log.txt for any errors or warnings.

anim.bin shouldn't require the build renamer, only build.bin.

Here's all the steps I can think of, see if any of these got missed maybe?

[*]Get an item .zip from the base game, such as data/anim/axe.zip, copy it to your mod folder.

[*]Extract the files from it.

[*]Convert atlas-0.tex to a PNG, fill it with your artwork, and convert it back to a .tex.

[*]Use buildrenamer to give the build.bin a new ID, e.g. 'myitem'. (Note: it still needs to be called build.bin, the renamer just edits a name stored inside the file)

[*]Pack the anim.bin, build.bin, and atlas-0.tex into a zip, and give it the same name that you gave to buildrenamer, e.g. 'myitem.zip'

[*]Add a line to your assets list in either the prefab definition or modmain, i.e. Asset("ANIM", "anim/myitem.zip")

[*]In the prefab, do anim:SetBank("myitem") and anim:SetBuild("myitem")

If that all seems to be correct, check My Documents\Klei\DoNotStarve\log.txt for any errors or warnings.

Isn't SetBank the sound? I had to leave it as it was before making it work.
  • Developer

I just ran through all this myself and it seems I've let you astray...

So bank and build are both animation terms in this case. "build" is the name of the art assets you are loading (e.g. "myitem") which you created art for and buildrenamed. "bank" is the collection of animations you are loading the build onto (that is, bank = movement, build = images).

It turns out that when you modify an existing anim as I suggested, the collection name doesn't change. So if you took axe.zip and created your anim from that, then the bank it uses is still "axe". So you would have:

anim:SetBank("axe") -- because this was originally axe.zipanim:SetBuild("myitem") -- because our new art is in myitem.zip, buildrenamed to myitem.
But wait! There's more! Because of on of our optimization steps, there will also be chunks missing from the image. So here's a template item for you to build off of which won't have this issue.

(Template and instructions in next post)

  • Developer

Alright, [MENTION=17097]infernalthing[/MENTION], instructions are here: http://forums.kleientertainment.com/showthread.php?21896-Creating-an-anim-for-items-on-the-ground&p=210101#post210101 [MENTION=44092]simplex[/MENTION] Aah, cool, I'll jump over there. :)

IPsquiggle,Would you do a quick tutorial on a simple fx animation file as well, example: fire/freeze? I've implemented mine, but I believe something is completely wonkers because they are not showing up correctly. Could the .tex format be incorrectly pushed for the animation?

  • Developer

Would you do a quick tutorial on a simple fx animation file as well, example: fire/freeze? I've implemented mine, but I believe something is completely wonkers because they are not showing up correctly. Could the .tex format be incorrectly pushed for the animation?

What kind of problems are you having? Do you have a thread going where we could hash this out? There's lots of little things that can go wrong for sure and I'd like to get lots of tutorials up eventually, but I actually prefer to just help you with your problem directly, so that I know what kinds of things future tutorials need to be about!

[MENTION=55]Ipsquiggle[/MENTION] , or any mod experts, please help meI just want to apply area damage to my weapon, I can apply it to character unarmed (using combat components)but it wont working to weapon (because it use weapon components obviously)already try to copy code from combat to weapon, but it doesn't work.it involve vector, target, and i just meet deadend, can you give a code/function for weapon area damage?

[MENTION=55]Ipsquiggle[/MENTION] , or any mod experts, please help meI just want to apply area damage to my weapon, I can apply it to character unarmed (using combat components)but it wont working to weapon (because it use weapon components obviously)already try to copy code from combat to weapon, but it doesn't work.it involve vector, target, and i just meet deadend, can you give a code/function for weapon area damage?

Check out the aura.lua file to learn how to do area of attack damage, which you will need to override the onattack function of your weapon to be able to use it.

[MENTION=55]Ipsquiggle[/MENTION] , or any mod experts, please help meI just want to apply area damage to my weapon, I can apply it to character unarmed (using combat components)but it wont working to weapon (because it use weapon components obviously)already try to copy code from combat to weapon, but it doesn't work.it involve vector, target, and i just meet deadend, can you give a code/function for weapon area damage?

When you set combat.areahitrangeit will make unarmed and weapons hit an area

Check out the aura.lua file to learn how to do area of attack damage, which you will need to override the onattack function of your weapon to be able to use it.

A thousand thanks to you! IT WORKS! Hahahaha :joyous:but now , after testing the "Leek Baton" I just think, it's too powerful (I test fight with 10 spiders, all dead perma-stunned)

When you set combat.areahitrangeit will make unarmed and weapons hit an area

I will try it, how to set it? OnAttack, or just insert to function fn(Sim)?

A thousand thanks to you! IT WORKS! Hahahaha :joyous:but now , after testing the "Leek Baton" I just think, it's too powerful (I test fight with 10 spiders, all dead perma-stunned)I will try it, how to set it? OnAttack, or just insert to function fn(Sim)?

If you think the item is too powerful, reduce the amount of damage it does on each hit. Classify it as an area of effect weapon and let people whine and complain that its not powerful against a single creature. Compromise has to be made when looking at Area of Effect skills vs Single Target skills. An area of effect weapon/skill should always do less damage to a single target, because it has the ability to hit mulitple targets increasing it's damage ten fold.
function Weapon:SetDamage(dmg)    self.damage = dmgendfunction Weapon:SetRange(attack, hit)    self.attackrange = attack    self.hitrange = hit or self.attackrangeend
This code is from the weapon.lua it should help you.

If you think the item is too powerful, reduce the amount of damage it does on each hit. Classify it as an area of effect weapon and let people whine and complain that its not powerful against a single creature. Compromise has to be made when looking at Area of Effect skills vs Single Target skills. An area of effect weapon/skill should always do less damage to a single target, because it has the ability to hit mulitple targets increasing it's damage ten fold.

function Weapon:SetDamage(dmg)    self.damage = dmgendfunction Weapon:SetRange(attack, hit)    self.attackrange = attack    self.hitrange = hit or self.attackrangeend
This code is from the weapon.lua it should help you.
The weapon itself only over power against small creature (especially spiders in group) and the area damage is using Abigail_area_damage which is 20 , The Leek Baton itself has 30 damage, and if I change the area damage, the game just crashedI want to change it to 2~5 area damage, but the game wont allow it :(So the option Is I change Baton damage to 10 --> 10+20 = 30 Damage single target, 20 area damage~EDIT~Solved, I manage to change it to 5 area damage Edited by Lexicroft

The weapon itself only over power against small creature (especially spiders in group) and the area damage is using Abigail_area_damage which is 20 , The Leek Baton itself has 30 damage, and if I change the area damage, the game just crashedI want to change it to 2~5 area damage, but the game wont allow it :(So the option Is I change Baton damage to 10 --> 10+20 = 30 Damage single target, 20 area damage

I would have to see the actual code to see what is happening. Show me how you are changing the damage and I will help you.
  • Developer

[MENTION=23254]Lexicroft[/MENTION] It depends on exactly what you're looking for, but I think [MENTION=53767]gamer.toukotsu[/MENTION] is on the right path.

You can look at the auras, or Combat:DoAreaAttack() for how to apply damage over an area.

You can then hook into Weapon:SetOnAttack(fn) to apply your area attack.

So I'd handle it something like this:

In your weapon prefab, define:

local function special_area_damage(inst, attacker, target) .... do stuff .... end

Then on the weapon in fn(Sim),

inst.components.weapon:SetOnAttack(special_area_damage)

Then every time the weapon hits an enemy, it should AOE as well.

[MENTION=55]Ipsquiggle[/MENTION] Here is a brain-teaser for you, how do you set an animation to play in the background rather than on the foreground?Example, most programming languages allow you to use a function like SendToBack to send a graphical item to the back of the field. Is this possible?

Here is the code, it works perfectlyThe weapon itself give whack a lot experience, you know, spamming your spacebar like crazy :D

local function onattack(inst, owner, target)	inst.components.aura:OnTick()	end
inst:AddComponent("weapon")    inst.components.weapon:SetDamage(20)	inst.components.weapon:SetOnAttack(onattack)	    	inst:AddComponent("combat")    inst.components.combat.defaultdamage = 5    inst.components.combat.playerdamagepercent = 0,	    inst:AddComponent("aura")    inst.components.aura.tickperiod = TUNING.ABIGAIL_DMG_PERIOD	inst.components.aura.radius = 3

When you set combat.areahitrangeit will make unarmed and weapons hit an area

I will try it, how to set it? OnAttack, or just insert to function fn(Sim)?
add this to the onequip function

local com = owner.components.combatinst.ownerAreaHitRange = com.areahitrangeinst.ownerAreaHitDamagePercent = com.areahitdamagepercentcom.areahitrange = 3 -- area of effectcom.areahitdamagepercent = 1 -- area damage percent

then add this too the onunequip function

local com = owner.components.combatcom.areahitrange = inst.ownerAreaHitRangecom.areahitdamagepercent = inst.ownerAreaHitDamagePercent

Edited by no_signal
  • Like 1

add this to the onequip function

local com = owner.components.combatinst.ownerAreaHitRange = com.areahitrangeinst.ownerAreaHitDamagePercent = com.areahitdamagepercentcom.areahitrange = 3 -- area of effectcom.areahitdamagepercent = 1 -- area damage percent

then add this too the onunequip function

local com = owner.components.combatcom.areahitrange = inst.ownerAreaHitRangecom.areahitdamagepercent = inst.ownerAreaHitDamagePercent

It works! I'm gonna use this, somehow easier to edit and understandThanks a lot ^_^I'm gonna credit you and gamer.toukotsu in my modNow the handgun...

It works! I'm gonna use this, somehow easier to edit and understandThanks a lot ^_^

You can also change
com.areahitdamagepercent = 1
to
com.areahitdamagepercent = 0.5
and it will do normal damage to the enemy you hitand half the damage to the surrounding enemies. Edited by no_signal

I'm having a bit of a problem...After playing some Lights out, I'm trying to make the player auto-equip another torch in the inventory instead of accumulating torches with 1-4% durability in the inventory.I can easily make the player equip another torch automagically by adding owner:PushEvent("toolbroke", {tool = inst}) to the torch script, which makes it act like an axe when out of durability. The problem is that the player stagger, like when a tool breaks, which makes it dark for a little while, letting some sanity slip away.I've tried searching for what happen when the event "toolbroke" is pushed by searching for 'ListenForEvent("toolbroke' through all components, all prefabs, etc, by adding them all into my Notepad++ and using the "search through all opened files" method. I can't find it anywhere. Thus, I can't see how the game makes tool automagically equip new tools, and I can't modify that script to prevent the player from staggering when a torch is depleted....Anyone knows where I can find where the "toolbroke" event is listened for, or any other method of making this work?Also, if there's already a mod as this one I'm planning to make, let me know.Thanks in advance.

I'm having a bit of a problem...After playing some Lights out, I'm trying to make the player auto-equip another torch in the inventory instead of accumulating torches with 1-4% durability in the inventory.I can easily make the player equip another torch automagically by adding owner:PushEvent("toolbroke", {tool = inst}) to the torch script, which makes it act like an axe when out of durability. The problem is that the player stagger, like when a tool breaks, which makes it dark for a little while, letting some sanity slip away.I've tried searching for what happen when the event "toolbroke" is pushed by searching for 'ListenForEvent("toolbroke' through all components, all prefabs, etc, by adding them all into my Notepad++ and using the "search through all opened files" method. I can't find it anywhere. Thus, I can't see how the game makes tool automagically equip new tools, and I can't modify that script to prevent the player from staggering when a torch is depleted....Anyone knows where I can find where the "toolbroke" event is listened for, or any other method of making this work?Also, if there's already a mod as this one I'm planning to make, let me know.Thanks in advance.

SGwilson.lua
EventHandler("toolbroke",		function(inst, data)			inst.sg:GoToState("toolbroke", data.tool)		end),
tool.lua
local function PercentChanged(inst, data)    if inst.components.tool       and data.percent and data.percent <= 0       and inst.components.inventoryitem and inst.components.inventoryitem.owner then        inst.components.inventoryitem.owner:PushEvent("toolbroke", {tool = inst})    endend
Apparently I over looked one in my searches, see below post for an additional section of it. Edited by gamer.toukotsu

I'm having a bit of a problem...After playing some Lights out, I'm trying to make the player auto-equip another torch in the inventory instead of accumulating torches with 1-4% durability in the inventory.I can easily make the player equip another torch automagically by adding owner:PushEvent("toolbroke", {tool = inst}) to the torch script, which makes it act like an axe when out of durability. The problem is that the player stagger, like when a tool breaks, which makes it dark for a little while, letting some sanity slip away.I've tried searching for what happen when the event "toolbroke" is pushed by searching for 'ListenForEvent("toolbroke' through all components, all prefabs, etc, by adding them all into my Notepad++ and using the "search through all opened files" method. I can't find it anywhere. Thus, I can't see how the game makes tool automagically equip new tools, and I can't modify that script to prevent the player from staggering when a torch is depleted....Anyone knows where I can find where the "toolbroke" event is listened for, or any other method of making this work?Also, if there's already a mod as this one I'm planning to make, let me know.Thanks in advance.

SGwilson.lua

State{        name = "toolbroke",        tags = {"busy"},        onenter = function(inst, tool)            inst.AnimState:PlayAnimation("hit")            inst.SoundEmitter:PlaySound("dontstarve/wilson/use_break")            inst.AnimState:Hide("ARM_carry")             inst.AnimState:Show("ARM_normal")             local brokentool = SpawnPrefab("brokentool")            brokentool.Transform:SetPosition(inst.Transform:GetWorldPosition() )            inst.sg.statemem.tool = tool        end,                onexit = function(inst)		    local sameTool = inst.components.inventory:FindItem(function(item)		        return item.prefab == inst.sg.statemem.tool.prefab		    end)		    if sameTool then		        inst.components.inventory:Equip(sameTool)		    end            if inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS) then                inst.AnimState:Show("ARM_carry")                 inst.AnimState:Hide("ARM_normal")            end        end,                events=        {            EventHandler("animover", function(inst)                inst.sg:GoToState("idle")            end ),        },    },

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
×
  • Create New...