-LukaS- Posted July 19, 2022 Share Posted July 19, 2022 Make sure you're not missing the leap attack state and make sure you have the appropriate EventHandler set up for it. From SGspider.lua: EventHandler("doattack", function(inst, data) if not (inst.sg:HasStateTag("busy") or inst.components.health:IsDead()) then --target CAN go invalid because SG events are buffered if inst:HasTag("spider_warrior") then inst.sg:GoToState( data.target:IsValid() and not inst:IsNear(data.target, TUNING.SPIDER_WARRIOR_MELEE_RANGE) -- This checks whether the mob is near its target and "warrior_attack" -- If it's too far away do leap attack or "attack", -- Else, do normal attack data.target ) elseif inst:HasTag("spider_spitter") then -- The rest is for other spider types inst.sg:GoToState( data.target:IsValid() and not inst:IsNear(data.target, TUNING.SPIDER_SPITTER_MELEE_RANGE) and "spitter_attack" --Do spit attack or "attack", data.target ) elseif inst:HasTag("spider_moon") then inst.sg:GoToState( data.target:IsValid() and not inst:IsNear(data.target, TUNING.SPIDER_WARRIOR_MELEE_RANGE) and "spike_attack" or "attack", data.target ) elseif inst:HasTag("spider_healer") then if data.target:IsValid() and (inst.healtime == nil or GetTime() - inst.healtime >= TUNING.SPIDER_HEALING_COOLDOWN) then inst.sg:GoToState("heal", data.target) else inst.sg:GoToState("attack", data.target) end else inst.sg:GoToState("attack", data.target) end end end) Link to comment Share on other sites More sharing options...
Dragolantis Posted July 19, 2022 Author Share Posted July 19, 2022 (edited) Shortly after sharing my problem, I double checked my code and did notice the rest of the doattack missing. Only problem is I need to cut out the warrior spider tag from the code entirely, and when I do things start falling apart. Either things start crashing and I think I'm getting somewhere, or it doesn't leap at me Edited July 19, 2022 by Dragolantis Link to comment Share on other sites More sharing options...
Dragolantis Posted July 19, 2022 Author Share Posted July 19, 2022 NVM. After a bit of looking, my problem lied in the warrior attack itself. when setting up the states, I had somehow wrapped the warrior attack state INSIDE the regular attack state. after fixing that the mob yeeted itself at me. Link to comment Share on other sites More sharing options...
Dragolantis Posted July 20, 2022 Author Share Posted July 20, 2022 Since I'm set on the coding part of my mod for a while, I was wondering about something not explicitly said throughout the forums that I might use later. I've seen plenty of tutorials and guides on how to replace music files. but how do I add them. even just looking at the code I can figure out how to implement my creature sounds to replace the spider ones, but I just don't understand how don't starve handles deciding which track to play when. Maybe I'm looking for the wrong files looking for music or sound prefabs, or maybe the tracks are contained in the mobs using them. but I just don't get how dst determines its soundtrack. I'm asking for something I might do later. Link to comment Share on other sites More sharing options...
-LukaS- Posted July 20, 2022 Share Posted July 20, 2022 For that i suggest you look through dynamicmusic.lua. It's a component that manages playing music when working or fighting certain monsters. Link to comment Share on other sites More sharing options...
Dragolantis Posted July 20, 2022 Author Share Posted July 20, 2022 (edited) I knew the file had to do with music or sound, but I didn't think it'd start with a d. I was just going down to m and s in my library to find it. Thanks for this! is it in the prefabs file or somewhere else? EDIT: found it in components. Edited July 20, 2022 by Dragolantis Link to comment Share on other sites More sharing options...
Dragolantis Posted July 23, 2022 Author Share Posted July 23, 2022 (edited) So I'm stuck in the graphical portion of my mod (I'm not an artsy fartsy type. I'll likely spend most the development time on the mod in this part of the mod making process) So in order to make some progress on my mod now that I'm in the headspace, I wanted to ask questions on how world spawning works. Tying back my original problem with the outdated tutorials, they had one for world spawning. I said before I was gonna use something similar to the dirt piles to spawn my mobs in the game. but after looking through the prefabs of the dirt piles, the tracks themselves, and the mob that spawns from them, I feel like I'm missing some things here. I'm looking for the specific trigger that spawns both the original dirt pile (I know how the game spawns subsequent ones) and the creatures that spawn from the hunt. This isn't tying in how I know I'll have to look into how the clay varg and it's subordinates spawn to get the spawning mechanic I'm looking for. Edited July 23, 2022 by Dragolantis Link to comment Share on other sites More sharing options...
Dragolantis Posted July 26, 2022 Author Share Posted July 26, 2022 reasking my question because I'm really stuck on this one. I don't properly understand spawning mechanics, and while I work on the model and anim, I want to also work on the spawning mechanics Link to comment Share on other sites More sharing options...
Dragolantis Posted October 18, 2022 Author Share Posted October 18, 2022 I'm back to work on my mod after taking a little hiatus with the start of the school year, and I was wondering @-t-, if you could help me out once again. I never really got an answer with it last time, but I'm just very confused as to how the animal tracks spawn the koalephant as well as the hunt surprises. I think I understand the trigger a bit better now this time, but I dont exactly understand what the dirtpile or animal track uses to trigger the spawning of a koalephant. I want a variation of the dirtpile to spawn in my new creature, and I cant really figure out how the dirtpile and subsequent animal track functions. Link to comment Share on other sites More sharing options...
-LukaS- Posted October 21, 2022 Share Posted October 21, 2022 Game tracks who is uncovering the dirt piles and how many in the hunter component. Whenever a player interacts with a dirtpile this function is run: function self:OnDirtInvestigated(pt, doer) assert(doer) --print("Hunter:OnDirtInvestigated (by "..tostring(doer)..")") local hunt = nil -- find the hunt this pile belongs to for i,v in ipairs(_activehunts) do if v.lastdirt ~= nil and v.lastdirt:GetPosition() == pt then hunt = v inst:RemoveEventCallback("onremove", v.lastdirt._ondirtremove, v.lastdirt) break end end if hunt == nil then -- we should probably do something intelligent here. --print("yikes, no matching hunt found for investigated dirtpile") return end hunt.activeplayer = doer if hunt.numtrackstospawn ~= nil and hunt.numtrackstospawn > 0 then if SpawnTrack(pt, hunt) then --print(" ", hunt.trackspawned, hunt.numtrackstospawn) if hunt.trackspawned < hunt.numtrackstospawn then if SpawnDirt(pt, hunt) then --print("...good job, you found a track!") else --print("SpawnDirt FAILED! RESETTING") ResetHunt(hunt) end elseif hunt.trackspawned == hunt.numtrackstospawn then if SpawnHuntedBeast(hunt,pt) then --print("...you found the last track, now find the beast!") hunt.activeplayer:PushEvent("huntbeastnearby") StartCooldown(inst, hunt) else --print("SpawnHuntedBeast FAILED! RESETTING") ResetHunt(hunt) end end else --print("SpawnTrack FAILED! RESETTING") ResetHunt(hunt) end end end line 480 - components/hunter.lua You can see here that if hunt.trackspawned == numtracktospawn then it spawns a randomly chosen mob. I don't know exactly how you want to trigger the spawning of your mob but generally you would need some entity that you can interact with, then you can just spawn the mob when it's interacted with. Link to comment Share on other sites More sharing options...
Dragolantis Posted October 23, 2022 Author Share Posted October 23, 2022 Apologies for the late reply, but thank you, this will help me out to a degree. I'll have to look at this for a bit to actually break this down into parts that I can make sense of and use, but one thing that bothers me is I dont know where this was pulled from. I checked the dirtpile and animaltrack prefabs and found nothing like this. If I could find the original file this comes from it would probably help me out even further. Link to comment Share on other sites More sharing options...
-LukaS- Posted October 23, 2022 Share Posted October 23, 2022 On 10/21/2022 at 2:29 PM, -t- said: line 480 - components/hunter.lua Link to comment Share on other sites More sharing options...
Dragolantis Posted October 23, 2022 Author Share Posted October 23, 2022 Ah thanks I missed that Link to comment Share on other sites More sharing options...
Dragolantis Posted October 25, 2022 Author Share Posted October 25, 2022 @-t- Originally I decided to use something similarly to tracks because I had no better option. I might use track spawning later, but for now, I just want to use something like the cookiecutter spawner. Simple, it spawns my creature naturally, and it works to make repetitive fights with it easy to do. One problem this new concept introduces is the idea that I have to code it to spawn in a certain biome or area, and I have no idea where it does that for the cookiecutter spawner, but if you could show me where that is, I could implement something similar to it for my mob. Your help would be very much appreciated. Link to comment Share on other sites More sharing options...
-LukaS- Posted October 26, 2022 Share Posted October 26, 2022 Cookie Cutter spawner is an invisible entity thats spawned in Brine Pool waters. It respawns Cookie Cutters every now and again. The spawners are spawned on world creation so if you want to do something similar you'll need a spawner. prefabs/cookiecutter_spawner.lua You can add entities to biomes by doing something like this: AddRoomPreInit("BGForest", function(room) room.contents.distributeprefabs["your_prefab_here"] = 0.2 end) Biomes are broken into rooms. "BGForest" is one of the rooms that spawns in the forest biome. If you want to check what this room has you can find it here: map/rooms/forest/terrain_forest.lua Link to comment Share on other sites More sharing options...
Dragolantis Posted October 27, 2022 Author Share Posted October 27, 2022 thank you for this. This will be very helpful @-t- Question, how would I go about havnig the mod change existing code. For example I'd likely put the mobs I want in the terrain_forest and terrain_rocky. Would I create a duplicate of these map scripts with the modded creatures I want in them? And if I did, would I run it alongside or somehow replace the old terrain files? Link to comment Share on other sites More sharing options...
Dragolantis Posted October 28, 2022 Author Share Posted October 28, 2022 (edited) @-t- Question, how would I go about havnig the mod change existing code. For example I'd likely put the mobs I want in the terrain_forest and terrain_rocky. Would I create a duplicate of these map scripts with the modded creatures I want in them? And if I did, would I run it alongside or somehow replace the old terrain files? (repeated because I dont think it pings you if replies merge) Edited October 28, 2022 by Dragolantis Link to comment Share on other sites More sharing options...
-LukaS- Posted October 29, 2022 Share Posted October 29, 2022 Simply add AddRoomPreInit("room_you_want_to_edit", function(room) room.contents.distributeprefabs["your_prefab_here"] = 'some_number' end) to your modmain.lua to edit any room you want. Link to comment Share on other sites More sharing options...
Dragolantis Posted October 30, 2022 Author Share Posted October 30, 2022 thanks, I will be sure to use this. Link to comment Share on other sites More sharing options...
Dragolantis Posted November 29, 2022 Author Share Posted November 29, 2022 @-t- So I tried replacing the cookiecutter with one of my creatures, and it worked like a charm, I was wondering though, would I be able to make it spawn both the little ones and the big one, or would I have to relegate that to two seperate spawners? Link to comment Share on other sites More sharing options...
-LukaS- Posted November 30, 2022 Share Posted November 30, 2022 childspawner supports "rarechildren", you can set them up with SetRareChild. Link to comment Share on other sites More sharing options...
Dragolantis Posted November 30, 2022 Author Share Posted November 30, 2022 Thanks! I'll see what I can do with that. But can I ask where this rare children thing is used? I ask so I can better slot it into my current code. Link to comment Share on other sites More sharing options...
-LukaS- Posted December 1, 2022 Share Posted December 1, 2022 Assuming you used a similar way of spawning to cookie cutters. The spawner uses the childspawner component. You can set up rare children there. I think cave spider holes use rare children to spawn either cave spiders or spitters. The latter one being the rare variant Link to comment Share on other sites More sharing options...
Dragolantis Posted December 3, 2022 Author Share Posted December 3, 2022 (edited) Thank you! I'll check it out EDIT: So after looking around the spiderhole code, I see the term rarechild set up once. I have no idea where it is actually put into place, and I have no idea if its a guranteed spawn for the rarechild or if there is a chance to spawn. I need my spawner to spawn only one of the rare child guranteed per spawner Edited December 3, 2022 by Dragolantis Link to comment Share on other sites More sharing options...
Dragolantis Posted December 9, 2022 Author Share Posted December 9, 2022 @-t- just reposting so you see. But I only found one instance of the rarechild code when I took a look into spiderhole. I dont know nearly enough about it. I have no idea if i need to define it in my own spawner, no idea if its a guranteed or chance to spawn, and no idea how many I can spawn with it. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now