Jump to content

How Would I Temporarily Change the Sprites for an Already Existing Sprite?


Recommended Posts

8 minutes ago, Hornete said:

inst.AnimState:OverrideSymbol("pan_flute01", "rain_shell", "shell") --We are overriding the "pan_flute01" symbol with the "shell" symbol from our "rain_shell" file

What if I wanted to make the image that replaces the Beefalo Horn a different version of the sprite? Just a different image. Thanks btw.

Edited by thegreatJash
  • Like 1
Link to comment
Share on other sites

2 minutes ago, thegreatJash said:

What if I wanted to make the image that replaces the Beefalo Horn a different version of the sprite? Just a different image. Thanks btw.

Then you'll need to make a new animation file, do the exact same instructions I gave you on the first page on how to create a sprite and what not, and give your file a different name, say "swap_rain_shell", be sure to load it in, and then change the "rain_shell" in AnimState:OverrideSymbol to "swap_rain_shell" and it'll use the shell symbol from swap_rain_shell

  • Thanks 1
Link to comment
Share on other sites

20 minutes ago, Hornete said:

Then you'll need to make a new animation file, do the exact same instructions I gave you on the first page on how to create a sprite and what not, and give your file a different name, say "swap_rain_shell", be sure to load it in, and then change the "rain_shell" in AnimState:OverrideSymbol to "swap_rain_shell" and it'll use the shell symbol from swap_rain_shell

What if I wanted to make it reskin the Beefalo Horn animation instead? Would I change the "flute" in this something else?

inst.AnimState:PushAnimation("flute", false) --PushAnimation queues the next animation

Edited by thegreatJash
Link to comment
Share on other sites

49 minutes ago, thegreatJash said:

What if I wanted to make it reskin the Beefalo Horn animation instead? Would I change the "flute" in this something else?

inst.AnimState:PushAnimation("flute", false) --PushAnimation queues the next animation

Yes! You'd change it to "horn" instead.

You'll also need to change the "pan_flute01" in AnimState:OverrideSymbol to "horn01" since you're replacing that sprite now.
 

  • Like 1
Link to comment
Share on other sites

15 hours ago, Hornete said:

Yes! You'd change it to "horn" instead.

You'll also need to change the "pan_flute01" in AnimState:OverrideSymbol to "horn01" since you're replacing that sprite now.
 

The game just crashed when I tried to open up a world with the mod enabled.

AddStategraphState("wilson", GLOBAL.State{
        name = "play_shell", --The name of your state(Maybe you want to make the name more unique? If another mod adds the same name, it'll override, and "play_shell" is a pretty basic name, your noice!)
        tags = { "doing", "playing" }, --Tags to add during the state

        onenter = function(inst)
            inst.components.locomotor:Stop() --Tell our character to stop moving
            inst.AnimState:PlayAnimation("action_uniqueitem_pre") --play the necessary animations
            inst.AnimState:PushAnimation("horn", false) --PushAnimation queues the next animation

            inst.AnimState:OverrideSymbol("horn01", "rain_shell", "shell") --We are overriding the "pan_flute01" symbol with the "shell" symbol from our "rain_shell" file

            inst.AnimState:Hide("ARM_carry")
            inst.AnimState:Show("ARM_normal")
            inst.components.inventory:ReturnActiveActionItem(inv_obj)
        end,

        timeline =
        {
            TimeEvent(30 * FRAMES, function(inst)
                if inst:PerformBufferedAction() then
                    inst.SoundEmitter:PlaySound("dontstarve/wilson/flute_LP", "flute") --Play the flute sound, (Maybe make a unique sound? would be cool :P)
                else
                    inst.AnimState:SetTime(94 * FRAMES)
                end
            end),
            TimeEvent(85 * FRAMES, function(inst)
                inst.SoundEmitter:KillSound("flute")
            end),
        },

        events =
        {
            EventHandler("animqueueover", function(inst)
                if inst.AnimState:AnimDone() then
                    inst.sg:GoToState("idle") --When the animation is done, return to the idle state
                end
            end),
        },

        onexit = function(inst)
            inst.SoundEmitter:KillSound("flute") --kill the flute sound
            if inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS) then
                inst.AnimState:Show("ARM_carry")
                inst.AnimState:Hide("ARM_normal")
            end
        end,
    })

    AddStategraphPostInit("wilson", function(sg)
    local _PLAY = inst.actionhandlers[ACTIONS.PLAY].deststate --Save the original function determining the state for the PLAY action
    inst.actionhandlers[ACTIONS.PLAY].deststate = function(inst, act, ...)
        return act.invobject ~= nil --Make sure the object responsible for the action exists, unlikely to happen, but if it does happen, the game would crash! So this check is important
            and    (act.invobject:HasTag("rain_shell") and "play_shell") --If the object has the "rain_shell" tag, then the play_shell state will play
            or _PLAY(inst, act, ...) --If all checks fail, go back to the original vanilla function
    end
end)

I also added the rain_shell tag to the prefab and removed the "flute" tag from the rainshell prefab, to avoid double animation.

Edit: I know it isn't anything about the quotes or minisign, because with those enabled it didn't crash.

Edited by thegreatJash
  • Like 1
Link to comment
Share on other sites

2 hours ago, thegreatJash said:

snip

For future reference, you can grab a "client_log" or "server_log" from the "Documents\Klei\DoNotStarveTogether" directory to see the error. Client log if you're hosting a surface only world, server log if you're hosting a world with caves

Anywho, if I had to guess the problem, it's because I forgot to put "GLOBAL." before some variables like EventHandler, TimeEvent and ACTIONS. You can easily fix it like this
 

TimeEvent to GLOBAL.TimeEvent
EventHandler to GLOBAL.EventHandler

and etc, if you wanna shorten it, you can just plop something like
 

local EventHandler = GLOBAL.EventHandler

at the beginning of the file to make all calls for EventHandler go straight to GLOBAL.EventHandler. Hope that helps.

  • Like 1
Link to comment
Share on other sites

35 minutes ago, Hornete said:

For future reference, you can grab a "client_log" or "server_log" from the "Documents\Klei\DoNotStarveTogether" directory to see the error. Client log if you're hosting a surface only world, server log if you're hosting a world with caves

Anywho, if I had to guess the problem, it's because I forgot to put "GLOBAL." before some variables like EventHandler, TimeEvent and ACTIONS. You can easily fix it like this
 


TimeEvent to GLOBAL.TimeEvent
EventHandler to GLOBAL.EventHandler

and etc, if you wanna shorten it, you can just plop something like
 


local EventHandler = GLOBAL.EventHandler

at the beginning of the file to make all calls for EventHandler go straight to GLOBAL.EventHandler. Hope that helps.

Alright, I'll have to try this tommorow. If that fixes the problem, then great, if not, I'll put one of those crash logs from the folders down. Thanks.

Edited by thegreatJash
  • Like 1
Link to comment
Share on other sites

6 hours ago, Hornete said:

For future reference, you can grab a "client_log" or "server_log" from the "Documents\Klei\DoNotStarveTogether" directory to see the error. Client log if you're hosting a surface only world, server log if you're hosting a world with caves

Anywho, if I had to guess the problem, it's because I forgot to put "GLOBAL." before some variables like EventHandler, TimeEvent and ACTIONS. You can easily fix it like this
 


TimeEvent to GLOBAL.TimeEvent
EventHandler to GLOBAL.EventHandler

and etc, if you wanna shorten it, you can just plop something like
 


local EventHandler = GLOBAL.EventHandler

at the beginning of the file to make all calls for EventHandler go straight to GLOBAL.EventHandler. Hope that helps.

I'm back. I tested and added the GLOBAL thing at the top of the code and it still crashed. Hop this log helps.

Also your minisign code still doesn't work. You have met your modding match.

Also can you link the file for the sound of those weird shell things on Pearl's island? The plugs. I would like to use those as the sound for the unique animation.

Thanks in advance.

client_log.txt

Edited by thegreatJash
  • Like 1
Link to comment
Share on other sites

15 minutes ago, thegreatJash said:

I'm back. I tested and added the GLOBAL thing at the top of the code and it still crashed. Hop this log helps.

[00:01:31]: [string "../mods/Rainy Shell Bell (Crab King)/modmai..."]:58: attempt to perform arithmetic on global 'FRAMES' (a nil value)

I found this error looking for instances of "[string" in the file. Looks like you need to do the GLOBAL thing for the FRAMES variable too :)
 

16 minutes ago, thegreatJash said:

Also your minisign code still doesn't work. You have met your modding match.

 

Spoiler

Gone Completely GIF - Gone Completely Mental GIFs


Just to be sure, is "images/rain_shell.xml" the correct directory for the shells xml file? I put that as a guess but perhaps it was wrong and you didn't change it. Be sure to let me know.

 

 

18 minutes ago, thegreatJash said:

Also can you link the file for the sound of those weird shell things on Pearl's island? The plugs. I would like to use those as the sound for the unique animation.

hookline_2 [323].wavhookline_2 [321].wavhookline_2 [322].wav

You can do this to play the sound in-game

inst.SoundEmitter:PlaySound("hookline_2/characters/hermit/plugged_fissure/1")
 --you can change the 1 to a 2 or 3 for a dif sound, you can randomize it by doing..

inst.SoundEmitter:PlaySound("hookline_2/characters/hermit/plugged_fissure/"..math.random(1,3)) --(choses a random number between 1 and 3)

 

  • Like 1
Link to comment
Share on other sites

6 minutes ago, Hornete said:

variable

But I put that global code in front of all the code. That doesn't do the trick? So every time the word Frames comes up I put Global. In front?

Also was I supposed to put local TimeEvent = GLOBAL.TimeEvent. Because I didn't.

Edited by thegreatJash
  • Like 1
Link to comment
Share on other sites

3 minutes ago, thegreatJash said:

But I put that global code in front of all the code

Do you mean the "local EventHandler = GLOBAL.EventHandler" ? That should work for frames too, just switch EventHandler with Frames. Did you make sure to put it at the beginning of the file?

  • Like 1
Link to comment
Share on other sites

Just now, Hornete said:

Do you mean the "local EventHandler = GLOBAL.EventHandler" ? That should work for frames too, just switch EventHandler with Frames. Did you make sure to put it at the beginning of the file?

OK let me get this straight. I need to have EventHandler = GLOBAL.EventHandler. but I also need separate code for the TimeEvent and Frames as well? Woah.

  • Big Ups 1
Link to comment
Share on other sites

3 minutes ago, Hornete said:

Yeah.

I have been enlightened. I'll have to try this tommororw. Also, I can't seem to find the singing shell code. I want to make this item hammerable and have an animation when walking nearby similar to the other shell bells.

Edited by thegreatJash
  • Like 1
Link to comment
Share on other sites

2 minutes ago, thegreatJash said:

I have been enlightened. I'll have to try this tommororw. Also, I can't seem to find the singing shell code. I want to make this item hammerable and have an animation when walking nearby similar to the other shell bells.

The singing shell file is in scripts/prefabs/singingshell.lua

  • GL Happy 1
Link to comment
Share on other sites

Just now, Hornete said:

The singing shell file is in scripts/prefabs/singingshell.lua

Wierd. Didn't seem to see it at all earlier today. Or any other rot content. Ok, final question. When you blow to shell, the lighting of the sky changes rapidly, and it looks artificial. Is there a way to gradually increase this value that determines the rain. Assuming that rain variable is directly tied to the lighting of the world of course. Something like, when blown, wait 3 seconds, and then increase the rain variable gradually until it reaches max and then it stops. Thanks in advance.

  • Like 1
Link to comment
Share on other sites

8 minutes ago, thegreatJash said:

Wierd. Didn't seem to see it at all earlier today. Or any other rot content. Ok, final question. When you blow to shell, the lighting of the sky changes rapidly, and it looks artificial. Is there a way to gradually increase this value that determines the rain. Assuming that rain variable is directly tied to the lighting of the world of course. Something like, when blown, wait 3 seconds, and then increase the rain variable gradually until it reaches max and then it stops. Thanks in advance.

yeah! I think something like this can work by putting it in the DoTaskInTime you have.

inst.startrain_task = inst:DoPeriodicTask(1/30, function(inst) --Run this function every 1/30th of a second
	TheWorld:PushEvent("ms_deltamoisture", 500) --Add 500 moisture to the world
	if TheWorld.state.israining then --If its raining, pass this check
		TheWorld:PushEvent("ms_forceprecipitation", true) --make sure the moisture is the highest value it can be now
		if inst.startrain_task ~= nil then
			inst.startrain_task:Cancel() --Cancel the periodic task, it's raining now so we don't need to run this anymore
			inst.startrain_task = nil
		end
	end
end)

You can change it however you'd like but I think the base here should work properly in gradully increasing the value so that the lighting change isn't as sudden.

  • Like 1
Link to comment
Share on other sites

1 minute ago, Hornete said:

yeah! I think something like this can work by putting it in the DoTaskInTime you have.


inst.startrain_task = inst:DoPeriodicTask(1/30, function(inst) --Run this function every 1/30th of a second
	TheWorld:PushEvent("ms_deltamoisture", 500) --Add 500 moisture to the world
	if TheWorld.state.israining then --If its raining, pass this check
		TheWorld:PushEvent("ms_forceprecipitation", true) --make sure the moisture is the highest value it can be now
		if inst.startrain_task ~= nil then
			inst.startrain_task:Cancel() --Cancel the periodic task, it's raining now so we don't need to run this anymore
			inst.startrain_task = nil
		end
	end
end)

You can change it however you'd like but I think the base here should work properly in gradully increasing the value so that the lighting change isn't as sudden.

So I just replace the Force Precipitation function with this? Sorry I am so helpless.

Link to comment
Share on other sites

1 minute ago, thegreatJash said:

So I just replace the Force Precipitation function with this? Sorry I am so helpless.

Yeah! So I believe you have something like this right now,
 

local function OnPlayed(inst, musician)
	inst:DoTaskInTime(3, function()  --Wait 3 seconds to run the function we passed
		TheWorld:PushEvent("ms_forceprecipitation", true)
	end)
end

now you'd make it..
 

local function OnPlayed(inst, musician)
	inst:DoTaskInTime(3, function()  --Wait 3 seconds to run the function we passed
		inst.startrain_task = inst:DoPeriodicTask(1/30, function(inst) --Run this function every 1/30th of a second
			TheWorld:PushEvent("ms_deltamoisture", 500) --Add 500 moisture to the world
			if TheWorld.state.israining then --If its raining, pass this check
				TheWorld:PushEvent("ms_forceprecipitation", true) --make sure the moisture is the highest value it can be now
				if inst.startrain_task ~= nil then
					inst.startrain_task:Cancel() --Cancel the periodic task, it's raining now so we don't need to run this anymore
					inst.startrain_task = nil
				end
			end
		end)
	end)
end

and that should hopefully work 

  • Thanks 1
Link to comment
Share on other sites

2 minutes ago, Hornete said:

Yeah! So I believe you have something like this right now,
 


local function OnPlayed(inst, musician)
	inst:DoTaskInTime(3, function()  --Wait 3 seconds to run the function we passed
		TheWorld:PushEvent("ms_forceprecipitation", true)
	end)
end

now you'd make it..
 


local function OnPlayed(inst, musician)
	inst:DoTaskInTime(3, function()  --Wait 3 seconds to run the function we passed
		inst.startrain_task = inst:DoPeriodicTask(1/30, function(inst) --Run this function every 1/30th of a second
			TheWorld:PushEvent("ms_deltamoisture", 500) --Add 500 moisture to the world
			if TheWorld.state.israining then --If its raining, pass this check
				TheWorld:PushEvent("ms_forceprecipitation", true) --make sure the moisture is the highest value it can be now
				if inst.startrain_task ~= nil then
					inst.startrain_task:Cancel() --Cancel the periodic task, it's raining now so we don't need to run this anymore
					inst.startrain_task = nil
				end
			end
		end)
	end)
end

and that should hopefully work 

Alright I'll try all of this tommorow. Thanks.

Edited by thegreatJash
  • Like 1
Link to comment
Share on other sites

It crashed again. Here is the code I have, and here is the client log again.

14 hours ago, Hornete said:

[00:01:31]: [string "../mods/Rainy Shell Bell (Crab King)/modmai..."]:58: attempt to perform arithmetic on global 'FRAMES' (a nil value)

 

local EventHandler = GLOBAL.EventHandler
local TimeEvent = GLOBAL.TimeEvent
local FRAMES = GLOBAL.FRAMES

AddStategraphState("wilson", GLOBAL.State{
        name = "play_shell", --The name of your state(Maybe you want to make the name more unique? If another mod adds the same name, it'll override, and "play_shell" is a pretty basic name, your noice!)
        tags = { "doing", "playing" }, --Tags to add during the state

        onenter = function(inst)
            inst.components.locomotor:Stop() --Tell our character to stop moving
            inst.AnimState:PlayAnimation("action_uniqueitem_pre") --play the necessary animations
            inst.AnimState:PushAnimation("horn", false) --PushAnimation queues the next animation

            inst.AnimState:OverrideSymbol("horn01", "rain_shell", "shell") --We are overriding the "pan_flute01" symbol with the "shell" symbol from our "rain_shell" file

            inst.AnimState:Hide("ARM_carry")
            inst.AnimState:Show("ARM_normal")
            inst.components.inventory:ReturnActiveActionItem(inv_obj)
        end,

        timeline =
        {
            TimeEvent(30 * FRAMES, function(inst)
                if inst:PerformBufferedAction() then
                    inst.SoundEmitter:PlaySound("dontstarve/wilson/flute_LP", "flute") --Play the flute sound, (Maybe make a unique sound? would be cool :P)
                else
                    inst.AnimState:SetTime(94 * FRAMES)
                end
            end),
            TimeEvent(85 * FRAMES, function(inst)
                inst.SoundEmitter:KillSound("flute")
            end),
        },

        events =
        {
            EventHandler("animqueueover", function(inst)
                if inst.AnimState:AnimDone() then
                    inst.sg:GoToState("idle") --When the animation is done, return to the idle state
                end
            end),
        },

        onexit = function(inst)
            inst.SoundEmitter:KillSound("flute") --kill the flute sound
            if inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS) then
                inst.AnimState:Show("ARM_carry")
                inst.AnimState:Hide("ARM_normal")
            end
        end,
    })

    AddStategraphPostInit("wilson", function(sg)
    local _PLAY = inst.actionhandlers[ACTIONS.PLAY].deststate --Save the original function determining the state for the PLAY action
    inst.actionhandlers[ACTIONS.PLAY].deststate = function(inst, act, ...)
        return act.invobject ~= nil --Make sure the object responsible for the action exists, unlikely to happen, but if it does happen, the game would crash! So this check is important
            and    (act.invobject:HasTag("rain_shell") and "play_shell") --If the object has the "rain_shell" tag, then the play_shell state will play
            or _PLAY(inst, act, ...) --If all checks fail, go back to the original vanilla function
    end
end)

Edit: Oh wait lol I forgot to change the EventHandler at the beginning of each. I did that and it crashed again. But this time it loaded a little further in.

 

client_log.txt

Edited by thegreatJash
  • Like 1
Link to comment
Share on other sites

2 hours ago, thegreatJash said:

Edit: Oh wait lol I forgot to change the EventHandler at the beginning of each. I did that and it crashed again. But this time it loaded a little further in.

Ahh, I made a small mistake here
 

  AddStategraphPostInit("wilson", function(sg)
    local _PLAY = inst.actionhandlers[ACTIONS.PLAY].deststate --Save the original function determining the state for the PLAY action
    inst.actionhandlers[ACTIONS.PLAY].deststate = function(inst, act, ...)
        return act.invobject ~= nil --Make sure the object responsible for the action exists, unlikely to happen, but if it does happen, the game would crash! So this check is important
            and    (act.invobject:HasTag("rain_shell") and "play_shell") --If the object has the "rain_shell" tag, then the play_shell state will play
            or _PLAY(inst, act, ...) --If all checks fail, go back to the original vanilla function
    end
end)

some instances of "inst" here should actually be sg, like this.
 

  AddStategraphPostInit("wilson", function(sg)
    local _PLAY = sg.actionhandlers[ACTIONS.PLAY].deststate --Save the original function determining the state for the PLAY action
    sg.actionhandlers[ACTIONS.PLAY].deststate = function(inst, act, ...)
        return act.invobject ~= nil --Make sure the object responsible for the action exists, unlikely to happen, but if it does happen, the game would crash! So this check is important
            and    (act.invobject:HasTag("rain_shell") and "play_shell") --If the object has the "rain_shell" tag, then the play_shell state will play
            or _PLAY(inst, act, ...) --If all checks fail, go back to the original vanilla function
    end
end)

 

Link to comment
Share on other sites

7 hours ago, Hornete said:

Ahh, I made a small mistake here
 


  AddStategraphPostInit("wilson", function(sg)
    local _PLAY = inst.actionhandlers[ACTIONS.PLAY].deststate --Save the original function determining the state for the PLAY action
    inst.actionhandlers[ACTIONS.PLAY].deststate = function(inst, act, ...)
        return act.invobject ~= nil --Make sure the object responsible for the action exists, unlikely to happen, but if it does happen, the game would crash! So this check is important
            and    (act.invobject:HasTag("rain_shell") and "play_shell") --If the object has the "rain_shell" tag, then the play_shell state will play
            or _PLAY(inst, act, ...) --If all checks fail, go back to the original vanilla function
    end
end)

some instances of "inst" here should actually be sg, like this.
 


  AddStategraphPostInit("wilson", function(sg)
    local _PLAY = sg.actionhandlers[ACTIONS.PLAY].deststate --Save the original function determining the state for the PLAY action
    sg.actionhandlers[ACTIONS.PLAY].deststate = function(inst, act, ...)
        return act.invobject ~= nil --Make sure the object responsible for the action exists, unlikely to happen, but if it does happen, the game would crash! So this check is important
            and    (act.invobject:HasTag("rain_shell") and "play_shell") --If the object has the "rain_shell" tag, then the play_shell state will play
            or _PLAY(inst, act, ...) --If all checks fail, go back to the original vanilla function
    end
end)

 

Alright. I'll have to try this o8t tommorow. I have some final questions. I promise once these are answered and implemented the mod will be finished.

The minisign still doesn't work. You know, Im not too sure I should be listening to you on this one because your mods don't have minisign icons either. I tested it on Crow's Nest.

Your gradual rain code worked like a charm. Thanks for that.

I can't seem to figure out how to make rain_shell hammerable. I want it to be hammerable like the rest of the shell bells, one swing, same sound, same animation with the little bug. Instead it would drop three shards instead of one though.

I'm also trying to figure out how to play around with the sounds it would make. I want to play a sound when the player walks close to it, similar to the other shell bells, and it able to be "hit" to cycle through the three sounds you gave me. Again, similar to the other shell bells. I think it would be cool if you could choose which of the three sounds you like best and that would be the one that would play when you blow it. Would I have to make a variable or something to keep track of the current selected sound? I'll try to figure out how to make a little bop animation later.

Thanks in advance.

Edit: Also, I would replace every inst in the code with sg?

Edited by thegreatJash
Link to comment
Share on other sites

10 hours ago, thegreatJash said:

The minisign still doesn't work. You know, Im not too sure I should be listening to you on this one because your mods don't have minisign icons either. I tested it on Crow's Nest.

RegisterInventoryItemAtlas("images/rain_shell.xml", "rainshell.tex")

This'll work for realsies, I promise.

Also, none of my mods have minisign icons, because I forgot the minisign existed.

thanks for letting me know lol

10 hours ago, thegreatJash said:

I can't seem to figure out how to make rain_shell hammerable. I want it to be hammerable like the rest of the shell bells, one swing, same sound, same animation with the little bug. Instead it would drop three shards instead of one though.

inst:AddComponent("workable")
inst.components.workable:SetWorkAction(ACTIONS.HAMMER)
inst.components.workable:SetWorkLeft(1)
inst.components.workable:SetOnFinishCallback(onfinishwork)
inst.components.workable.savestate = false

You'll need to add the workable component, I took this snippet of code from the singing shells file. You'll also need to have this "onfinishwork" function defined.

local function onfinishwork(inst, worker)
	inst.components.lootdropper:DropLoot()
	SpawnPrefab("singingshell_critterfx").Transform:SetPosition(inst.Transform:GetWorldPosition())
	inst.SoundEmitter:PlaySound("dontstarve/common/destroy_pot")
	inst:Remove()
end

In addition, you'll also need to add the lootdropper component and set its loot like so.
 

local singingshellloot = { "slurtle_shellpieces", "slurtle_shellpieces", "slurtle_shellpieces" } --three snurtle shells

inst:AddComponent("lootdropper")
inst.components.lootdropper:SetLoot(singingshellloot)

 

 

  • Like 1
Link to comment
Share on other sites

3 hours ago, Hornete said:

RegisterInventoryItemAtlas("images/rain_shell.xml", "rainshell.tex")

This'll work for realsies, I promise.

Also, none of my mods have minisign icons, because I forgot the minisign existed.

thanks for letting me know lol


inst:AddComponent("workable")
inst.components.workable:SetWorkAction(ACTIONS.HAMMER)
inst.components.workable:SetWorkLeft(1)
inst.components.workable:SetOnFinishCallback(onfinishwork)
inst.components.workable.savestate = false

You'll need to add the workable component, I took this snippet of code from the singing shells file. You'll also need to have this "onfinishwork" function defined.


local function onfinishwork(inst, worker)
	inst.components.lootdropper:DropLoot()
	SpawnPrefab("singingshell_critterfx").Transform:SetPosition(inst.Transform:GetWorldPosition())
	inst.SoundEmitter:PlaySound("dontstarve/common/destroy_pot")
	inst:Remove()
end

In addition, you'll also need to add the lootdropper component and set its loot like so.
 


local singingshellloot = { "slurtle_shellpieces", "slurtle_shellpieces", "slurtle_shellpieces" } --three snurtle shells

inst:AddComponent("lootdropper")
inst.components.lootdropper:SetLoot(singingshellloot)

 

 

So I just put this all together in the rainshell.lua? Seems like a lot just to make it hammerable. It would be cool if you could attach a downloadable file for singshell.lua because I don't know what's wrong with me but I can't seem to find it. Thanks.

Link to comment
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
 Share

×
  • Create New...