Jump to content

Recommended Posts

7 hours ago, Hornete said:

Sorry, yeah I was explaining what that line does.

Ok. So I put your code in an made a "music" animation with a "play" animation inside of that. I hope that's right. I put that animation in the "rain_shell" folder and it compiled. I ran into this crash though.

Honestly, I don't know what's going on with the play animation. I made the play animation, which I named "placeholder", and originally it worked fine, but it didn't look right. Then I tried to edit it, and every time I did it recompiled but never seemed to actually change, which was strange. Then I decided to take a break with that and I removed the "placeholder" animation from the "rain_shell" .scml file, but it remained in the game, which bothered me. Then a completely removed the "shell-1" file but it refused to recompile. It said that "the rain_shell animation couldn't find the shell-1 file", even though I removed the animation that used it in the first place. So, I put it back so the game wouldn't crash looking for an animation that refused to compile and came up with this crash. Thanks in advance.

Screenshot (32).png

client_log.txt

Edited by thegreatJash
  • Like 1
1 hour ago, thegreatJash said:

Ok. So I put your code in an made a "music" animation with a "play" animation inside of that. I hope that's right. I put that animation in the "rain_shell" folder and it compiled. I ran into this crash though.

Honestly, I don't know what's going on with the play animation. I made the play animation, which I named "placeholder", and originally it worked fine, but it didn't look right. Then I tried to edit it, and every time I did it recompiled but never seemed to actually change, which was strange. Then I decided to take a break with that and I removed the "placeholder" animation from the "rain_shell" .scml file, but it remained in the game, which bothered me. Then a completely removed the "shell-1" file but it refused to recompile. It said that "the rain_shell animation couldn't find the shell-1 file", even though I removed the animation that used it in the first place. So, I put it back so the game wouldn't crash looking for an animation that refused to compile and came up with this crash. Thanks in advance.

Screenshot (32).png

client_log.txt 33.1 kB · 0 downloads

Are you sure you defined the "OnCycle" function I gave you earlier? Here it says the variable doesn't exist.

How did you try to edit the placeholder animation? You only touched the pivot points correct? Moving the sprite in the animation itself does not change anything.

1 hour ago, Hornete said:

Are you sure you defined the "OnCycle" function I gave you earlier? Here it says the variable doesn't exist.

How did you try to edit the placeholder animation? You only touched the pivot points correct? Moving the sprite in the animation itself does not change anything.

Ah, I misunderstood what the pivot point meant. I get it now.

Also, I moved around the order the code that you gave me was in, and that fixed the OnCycle problem. But when I tried to cycle it, it crashed again, this time with PlaySound or OnSound or something not declared. If just moving around the order of the code fixed one crash, then it's probably the cause for the others. Is there sone sort of order the code should be put in, including the small chunk that makes it do the sound when the player walks near it, because that does the seem to work either. Thanks in advance.

Edited by thegreatJash
  • Like 1
5 minutes ago, thegreatJash said:

Ah, I misunderstood what the pivot point meant. I get it now.

Also, I moved around the order the code that you gave me was in, and that fixed the OnCycle problem. But when I tried to cycle it, it crashed again, this time with PlaySound or OnSound or something not declared. If just moving around the order of the code fixed one crash, then it's probably the cause for the others. Is there sone sort of order the code should be put in, including the small chunk that makes it do the sound when the player walks near it, because that does the seem to work either. Thanks in advance.

Yes, when a function is called, that function must be defined. For example.

 

local function TestFunction()
		print("test")
end

TestFunction()

This piece of code will work, because TestFunction is defined and then ran, however.
 

TestFunction() 

local function TestFunction()
	print("test")
end

Will not work, because when the game tries to run TestFunction, the definition for TestFunction hasn't occured yet since it happens later in the code.

As a good rule of thumb, place all your functions at the top of your prefab file.

  • Like 1
20 hours ago, Hornete said:

Yes, when a function is called, that function must be defined. For example.

 


local function TestFunction()
		print("test")
end

TestFunction()

This piece of code will work, because TestFunction is defined and then ran, however.
 


TestFunction() 

local function TestFunction()
	print("test")
end

Will not work, because when the game tries to run TestFunction, the definition for TestFunction hasn't occured yet since it happens later in the code.

As a good rule of thumb, place all your functions at the top of your prefab file.

Ok. I moved the code around and fixed the one crash and got another crash regarding "PLANT_TAGS" or something like that. Dunno what that's about. I ripped the farm code out and I was able to cycle it without problems. However my "music" animation doesn't seem to work and instead makes the shell invisible, thus making it impossible to cycle it again. I loaded it in and have the "music.zip" file in the "anim" folder. Maybe you could take a look and see what's wrong? Is it in the wrong folder? It currently has the "rain_shell" folder as its root. Thanks in advance.

Screenshot (33).png

client_log.txt music.scml

11 minutes ago, thegreatJash said:

Ok. I moved the code around and fixed the one crash and got another crash regarding "PLANT_TAGS" or something like that.

Oh silly me, Put this line of code before the PlaySound function

local PLANT_TAGS = {"tendable_farmplant"}
12 minutes ago, thegreatJash said:

Dunno what that's about. I ripped the farm code out and I was able to cycle it without problems. However my "music" animation doesn't seem to work and instead makes the shell invisible, thus making it impossible to cycle it again. I loaded it in and have the "music.zip" file in the "anim" folder. Maybe you could take a look and see what's wrong? Is it in the wrong folder? It currently has the "rain_shell" folder as its root. Thanks in advance.

You shouldn't be creating a new project for the one animation, it should be in the "rain_shell.scml" file along with your idle animation.
image.png.eeb30b70f220752dee2fe8540b194a6d.png

Like-so. If you don't know how to create a new animation, you can click the third button here
image.png.309553be75116a6c97cd1c79135ee5a7.png

  • Like 1
54 minutes ago, Hornete said:

Oh silly me, Put this line of code before the PlaySound function


local PLANT_TAGS = {"tendable_farmplant"}

You shouldn't be creating a new project for the one animation, it should be in the "rain_shell.scml" file along with your idle animation.
image.png.eeb30b70f220752dee2fe8540b194a6d.png

Like-so. If you don't know how to create a new animation, you can click the third button here
image.png.309553be75116a6c97cd1c79135ee5a7.png

Like this?

    local function PlaySound(inst, doer)
    local PLANT_TAGS = {"tendable_farmplant"}
    inst.SoundEmitter:PlaySound("hookline_2/characters/hermit/plugged_fissure/"..inst.components.cyclable.step) --Attach the current cycled step to this string to determine which of the 3 sounds to play

    inst.AnimState:PlayAnimation("music") --You need to make your own animation here!
end

  • Big Ups 1
18 minutes ago, Hornete said:

yup! that works.

Ok cool it tends to crops and plays the animation normally. The only two things left is that it doesn't do the little bop when walking near it, like it should, and I want to play the current cycled sound when playing it to summon rain. Thanks in advance.

Edited by thegreatJash
  • Like 1
1 hour ago, thegreatJash said:

I want to play the current cycled sound when playing it to summon rain.

timeline =
        {
            TimeEvent(30 * FRAMES, function(inst)
				local cycle = inst.bufferedaction.invobject.components.cyclable.step
                if inst:PerformBufferedAction() then
                    inst.SoundEmitter:PlaySound("hookline_2/characters/hermit/plugged_fissure/"..cycle)
                else
                    inst.AnimState:SetTime(94 * FRAMES)
                end
            end),
        },

If you go to your "play_shell" state and replace the timeline variable with this instead, then it should work!
 

 

1 hour ago, thegreatJash said:

The only two things left is that it doesn't do the little bop when walking near it, like it should,

Ah! Looks like I missed a few crucial things.
 

local function RegisterActiveShell(inst)
	if TheWorld.components.singingshellmanager == nil then
		TheWorld:AddComponent("singingshellmanager")
	end

	TheWorld.components.singingshellmanager:RememberActiveShell(inst)
end

local function UnregisterActiveShell(inst)
	if TheWorld.components.singingshellmanager ~= nil then
		TheWorld.components.singingshellmanager:ForgetActiveShell(inst)
	end
end

These functions will need to be defined, and then in the constructor function for the shell you'll need to have
 

inst.components.inventoryitem:SetOnDroppedFn(RegisterActiveShell)
inst.components.inventoryitem:SetOnPickupFn(UnregisterActiveShell)
inst.OnEntityWake = RegisterActiveShell
inst.OnEntitySleep = UnregisterActiveShell

(This is so the shell can "activate" and "deactivate" when unloaded/loaded or picked up/dropped, main purpose is for optimisation! I assume atleast)

  • Like 1
3 minutes ago, Hornete said:

timeline =
        {
            TimeEvent(30 * FRAMES, function(inst)
				local cycle = inst.bufferedaction.invobject.components.cyclable.step
                if inst:PerformBufferedAction() then
                    inst.SoundEmitter:PlaySound("hookline_2/characters/hermit/plugged_fissure/"..cycle)
                else
                    inst.AnimState:SetTime(94 * FRAMES)
                end
            end),
        },

If you go to your "play_shell" state and replace the timeline variable with this instead, then it should work!
 

 

Ah! Looks like I missed a few crucial things.
 


local function RegisterActiveShell(inst)
	if TheWorld.components.singingshellmanager == nil then
		TheWorld:AddComponent("singingshellmanager")
	end

	TheWorld.components.singingshellmanager:RememberActiveShell(inst)
end

local function UnregisterActiveShell(inst)
	if TheWorld.components.singingshellmanager ~= nil then
		TheWorld.components.singingshellmanager:ForgetActiveShell(inst)
	end
end

These functions will need to be defined, and then in the constructor function for the shell you'll need to have
 


inst.components.inventoryitem:SetOnDroppedFn(RegisterActiveShell)
inst.components.inventoryitem:SetOnPickupFn(UnregisterActiveShell)

inst.OnEntityWake = RegisterActiveShell
inst.OnEntitySleep = UnregisterActiveShell

(This is so the shell can "activate" and "deactivate" when unloaded/loaded or picked up/dropped, main purpose is for optimisation! I assume atleast)

Thanks! I will have to try this out tommorow. If this code works, then this mod will be finished tommorow.

  • Like 1
15 hours ago, Hornete said:

(This is so the shell can "activate" and "deactivate" when unloaded/loaded or picked up/dropped, main purpose is for optimisation! I assume atleast)

Hello again. I put the code in that you gave me. The piece where the shell plays the current cycled sound works fine, but the one where the shell plays the sound when walking near it does not however. No crashes though! I put the inst. code in the same spots with the inst.component stuff went. Also, how would I make it so the action "cycle" is "hit" in game? It's probably something really simple but I'm afraid to touch anything.

As always thanks in advance. Also, here's the rainshell.lua if you need to take a look at it.

rainshell.lua

25 minutes ago, thegreatJash said:

Hello again. I put the code in that you gave me. The piece where the shell plays the current cycled sound works fine, but the one where the shell plays the sound when walking near it does not however. No crashes though! I put the inst. code in the same spots with the inst.component stuff went. Also, how would I make it so the action "cycle" is "hit" in game? It's probably something really simple but I'm afraid to touch anything.

As always thanks in advance. Also, here's the rainshell.lua if you need to take a look at it.

rainshell.lua 4.49 kB · 1 download

Oh silly me, add the "singingshell" tag and the shell should bop when going near, it'll also make the "Cycle" string "Hit" instead like the other shells!

 

  • GL Happy 1
33 minutes ago, Hornete said:

Oh silly me, add the "singingshell" tag and the shell should bop when going near, it'll also make the "Cycle" string "Hit" instead like the other shells!

 

Ok last question. I swear. It bops when near and has "hit" now, which is great, but it plays the sound and acts as if I walked near whenever I drop it, which is strange. Is there a fix? Also how do I upload a mod to the dst workshop? I know you can use Don't Starve Mod Tools, but is there an easier way? Are there any tutorials? Thanks in advance.

  • Like 1
6 minutes ago, thegreatJash said:

Ok last question. I swear. It bops when near and has "hit" now, which is great, but it plays the sound and acts as if I walked near whenever I drop it, which is strange. Is there a fix? Also how do I upload a mod to the dst workshop? I know you can use Don't Starve Mod Tools, but is there an easier way? Are there any tutorials? Thanks in advance.

Alright, this should be the last stuff you need now, I swear.

local TRIGGER_MUST_TAGS = { "singingshelltrigger" }
local TRIGGER_CANT_TAGS = { "playerghost" }
local function PreventImmediateActivate(inst)
	if inst.entity:IsAwake() then
		local x, y, z = inst.Transform:GetWorldPosition()
		for _, v in ipairs(TheSim:FindEntities(x, y, z, TUNING.SINGINGSHELL_TRIGGER_RANGE, TRIGGER_MUST_TAGS, TRIGGER_CANT_TAGS)) do
			v.components.singingshelltrigger.overlapping[inst] = true
		end
	end
end
-- Prevents shell from immediately playing if spawning within range of a singingshelltrigger(or dropped)
inst:DoTaskInTime(0, PreventImmediateActivate)
inst:ListenForEvent("exitlimbo", PreventImmediateActivate)

 

7 minutes ago, thegreatJash said:

I know you can use Don't Starve Mod Tools, but is there an easier way? Are there any tutorials? Thanks in advance.

The Mod Tools are the only way, it should not be difficult to use though, open it up, select "Don't Starve Together" as the game to upload the mod to, click "Add" and that should bring you to this page.
image.thumb.png.c344215588354771d07df80d81e0db24.png
For "Update Data" simply click browse and then select your mod folder, select a preview image for the mod, and put in the details you'd like (These details can be changed later in steam page itself, I usually like to do that since I find it easier to type in the steam page itself).

Also, you may want to create a copy of your mod folder and make that the public release version and use that to upload to the workshop, and then remove the "exported" folder and any other png's, since those aren't needed and are just unncessary space taken up, though the game won't blow up if you leave those things in.

  • Like 1
22 hours ago, Hornete said:

Alright, this should be the last stuff you need now, I swear.


local TRIGGER_MUST_TAGS = { "singingshelltrigger" }
local TRIGGER_CANT_TAGS = { "playerghost" }
local function PreventImmediateActivate(inst)
	if inst.entity:IsAwake() then
		local x, y, z = inst.Transform:GetWorldPosition()
		for _, v in ipairs(TheSim:FindEntities(x, y, z, TUNING.SINGINGSHELL_TRIGGER_RANGE, TRIGGER_MUST_TAGS, TRIGGER_CANT_TAGS)) do
			v.components.singingshelltrigger.overlapping[inst] = true
		end
	end
end

-- Prevents shell from immediately playing if spawning within range of a singingshelltrigger(or dropped)
inst:DoTaskInTime(0, PreventImmediateActivate)
inst:ListenForEvent("exitlimbo", PreventImmediateActivate)

 

The Mod Tools are the only way, it should not be difficult to use though, open it up, select "Don't Starve Together" as the game to upload the mod to, click "Add" and that should bring you to this page.
image.thumb.png.c344215588354771d07df80d81e0db24.png
For "Update Data" simply click browse and then select your mod folder, select a preview image for the mod, and put in the details you'd like (These details can be changed later in steam page itself, I usually like to do that since I find it easier to type in the steam page itself).

Also, you may want to create a copy of your mod folder and make that the public release version and use that to upload to the workshop, and then remove the "exported" folder and any other png's, since those aren't needed and are just unncessary space taken up, though the game won't blow up if you leave those things in.

Is there any specific place to put that code? I just tossed in into the rainshell.lua and got a crash.

client_log.txt

1 minute ago, thegreatJash said:

Is there any specific place to put that code? I just tossed in into the rainshell.lua and got a crash.

client_log.txt 38.34 kB · 0 downloads

What does your rainshell.lua file look like?

  • Like 1
1 minute ago, thegreatJash said:

I put that code along with the other functions?

rainshell.lua 5.06 kB · 0 downloads

image.thumb.png.d4acc0464913ab16a7887a3c893db590.png

The highlighted lines should be in the part of the code where the entity is being created(with the components, tags, and such, like so)

image.png.6cf1bebe41f93702328c4f4f095db3a3.png

  • Like 1
Just now, Hornete said:

image.thumb.png.d4acc0464913ab16a7887a3c893db590.png

The highlighted lines should be in the part of the code where the entity is being created(with the components, tags, and such, like so)

image.png.6cf1bebe41f93702328c4f4f095db3a3.png

Lol how am I so stupid. I looked around on the Mods Tools and can't find a way to upload screenshots of the mod in game. Do you have to do that on Steam?

  • Like 1

@Hornete Well, here it is, the final product.

https://steamcommunity.com/sharedfiles/filedetails/?id=2522367292&searchtext=

I probably annoyed you to high hell with all the questions I constantly bugged you with, but thanks again. I probably couldn't have done this mod without you. If you would like, I could send you a friend request on Steam so we can be friends, so I can add you as an author. Your choice.

For now, I am probably going to take a break from modding. I do have a bunch of other cool ideas, so much so that I could probably have a massive mod adding an additional unique drop from each boss, and maybe I'll get good enough at modding to do that. I'm going to probably make a giant see weed Crab King zone to farm him for rainy shell bells. Fill up chests with them. Thanks again.

  • Like 1

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...