nextwebber1 Posted December 15, 2018 Share Posted December 15, 2018 (edited) This isn't really a question about modding... But I didn't know where to put it. Sorry. So, me and my friends have always wanted to fight the Ancient Fuelweaver on the surface. But we've just never been able to find a way to do that. But recently, I finally ran into a post talking about how to edit fossil_mound.lua to make it possible to fight the Ancient Fuelweaver on the surface. But the thing is, I have a few questions. 1: If I edit the .lua file, will my game become unplayable and/or will crash everytime? (Really don't know about that, sorry i'm new here ;-;) 2: How do I edit my fossil_mound.lua file to add this in it? local G = GLOBAL if G.TheNet:GetIsServer() then local ATRIUM_RANGE = 8.5 local function ActiveStargate(gate) return gate:IsWaitingForStalker() end local function IsNearAtrium(inst, other) local stargate = inst.components.entitytracker:GetEntity("stargate") return stargate ~= nil and stargate:HasTag("intense") end AddPrefabPostInit("fossil_stalker", function(inst) local function ItemTradeTest(inst, item, giver) if item == nil or item.prefab ~= "shadowheart" or giver == nil or giver.components.areaaware == nil then return false elseif inst.form ~= 1 then return false, "WRONGSHADOWFORM" elseif giver.components.areaaware:CurrentlyInTag("Atrium") and (G.FindEntity(inst, ATRIUM_RANGE, ActiveStargate, {"stargate"}) == nil or G.GetClosestInstWithTag("stalker", inst, 40) ~= nil) then return false, "CANTSHADOWREVIVE" end return true end local function OnAccept(inst, giver, item) if item.prefab == "shadowheart" then local stalker local stargate = G.FindEntity(inst, ATRIUM_RANGE, ActiveStargate, {"stargate"}) if stargate ~= nil then stalker = G.SpawnPrefab("stalker_atrium") stalker.components.entitytracker:TrackEntity("stargate", stargate) stargate:TrackStalker(stalker) else stalker = G.SpawnPrefab("stalker") end local x, y, z = inst.Transform:GetWorldPosition() local rot = inst.Transform:GetRotation() inst:Remove() stalker.Transform:SetPosition(x, y, z) stalker.Transform:SetRotation(rot) stalker.sg:GoToState("resurrect") giver.components.sanity:DoDelta(TUNING.REVIVE_SHADOW_SANITY_PENALTY) end end inst.components.trader.onaccept = OnAccept inst.components.trader:SetAbleToAcceptTest(ItemTradeTest) end) end I know how to find and open the fossil_mound.lua file, but I don't know what to do next. I've tried deleting some parts of the file and replace them with the above, only for my game to keep crashing once I open it, so I always restored the file to its original state. I do have Notepad++. Oh, and this is what the original fossil_mound.lua file looks like: local assets = { Asset("ANIM", "anim/fossil_stalker.zip"), } local prefabs = { "fossil_piece", "collapse_small", "stalker", "stalker_forest", "stalker_atrium", } local NUM_FORMS = 3 local MAX_MOUND_SIZE = 8 local MOUND_WRONG_START_SIZE = 5 local ATRIUM_RANGE = 8.5 local function ActiveStargate(gate) return gate:IsWaitingForStalker() end local function ItemTradeTest(inst, item, giver) if item == nil or item.prefab ~= "shadowheart" or giver == nil or giver.components.areaaware == nil then return false elseif inst.form ~= 1 then return false, "WRONGSHADOWFORM" elseif not TheWorld.state.isnight then return false, "CANTSHADOWREVIVE" elseif giver.components.areaaware:CurrentlyInTag("Atrium") and ( FindEntity(inst, ATRIUM_RANGE, ActiveStargate, { "stargate" }) == nil or GetClosestInstWithTag("stalker", inst, 40) ~= nil ) then return false, "CANTSHADOWREVIVE" end return true end local function OnAccept(inst, giver, item) if item.prefab == "shadowheart" then local stalker if not TheWorld:HasTag("cave") then stalker = SpawnPrefab("stalker_forest") elseif not giver.components.areaaware:CurrentlyInTag("Atrium") then stalker = SpawnPrefab("stalker") else local stargate = FindEntity(inst, ATRIUM_RANGE, ActiveStargate, { "stargate" }) if stargate ~= nil then stalker = SpawnPrefab("stalker_atrium") -- override the spawn point so stalker stays around the gate stalker.components.entitytracker:TrackEntity("stargate", stargate) stargate:TrackStalker(stalker) else --should not be possible stalker = SpawnPrefab("stalker") end end local x, y, z = inst.Transform:GetWorldPosition() local rot = inst.Transform:GetRotation() inst:Remove() stalker.Transform:SetPosition(x, y, z) stalker.Transform:SetRotation(rot) stalker.sg:GoToState("resurrect") giver.components.sanity:DoDelta(TUNING.REVIVE_SHADOW_SANITY_PENALTY) end end local function UpdateFossileMound(inst, size, checkforwrong) if size < MOUND_WRONG_START_SIZE then --reset case, not really used tho inst.form = 1 elseif checkforwrong and inst.moundsize < MOUND_WRONG_START_SIZE then --3/5 chance of form 1 (correct form) inst.form = math.max(1, math.random(-1, NUM_FORMS)) end inst.moundsize = size inst.components.workable:SetWorkLeft(size) inst.AnimState:PlayAnimation(tostring(inst.form).."_"..tostring(inst.moundsize)) if size >= MAX_MOUND_SIZE then inst.components.trader:Enable() else inst.components.trader:Disable() end end local function lootsetfn(lootdropper) local loot = {} for i = 1, lootdropper.inst.moundsize do table.insert(loot, "fossil_piece") end lootdropper:SetLoot(loot) end local function onworked(inst) local pos = inst:GetPosition() local fx = SpawnPrefab("collapse_small") fx.Transform:SetPosition(pos:Get()) fx:SetMaterial("rock") inst.components.lootdropper:DropLoot(pos) inst:Remove() end local function onrepaired(inst) UpdateFossileMound(inst, inst.moundsize + 1, true) inst.SoundEmitter:PlaySound("dontstarve/creatures/together/fossil/repair") end local function getstatus(inst) return inst.moundsize >= MAX_MOUND_SIZE and (inst.form > 1 and "FUNNY" or "COMPLETE") or nil end local function onsave(inst, data) data.moundsize = inst.moundsize > 1 and inst.moundsize or nil data.form = inst.form > 1 and inst.form or nil end local function onload(inst, data) if data ~= nil then --backward compatibility for data.wrong inst.form = math.clamp(data.form or (data.wrong and 2 or 1), 1, NUM_FORMS) UpdateFossileMound(inst, math.clamp(data.moundsize or 1, 1, MAX_MOUND_SIZE), false) end end local function makemound(name) local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddSoundEmitter() inst.entity:AddNetwork() MakeObstaclePhysics(inst, .45) inst.AnimState:SetBank(name) inst.AnimState:SetBuild(name) inst.AnimState:PlayAnimation("1_1") inst:AddTag("structure") --trader (from trader component) added to pristine state for optimization --inst:AddTag("trader") --Trader will be disabled by default constructor inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end inst:AddComponent("inspectable") inst.components.inspectable.getstatus = getstatus inst:AddComponent("lootdropper") inst.components.lootdropper:SetLootSetupFn(lootsetfn) inst:AddComponent("workable") inst.components.workable:SetWorkAction(ACTIONS.HAMMER) inst.components.workable:SetMaxWork(MAX_MOUND_SIZE) inst.components.workable:SetWorkLeft(1) inst.components.workable:SetOnWorkCallback(onworked) inst.components.workable.savestate = true inst:AddComponent("repairable") inst.components.repairable.repairmaterial = MATERIALS.FOSSIL inst.components.repairable.onrepaired = onrepaired inst.components.repairable.noannounce = true inst:AddComponent("trader") inst.components.trader:SetAbleToAcceptTest(ItemTradeTest) inst.components.trader.onaccept = OnAccept MakeHauntableWork(inst) inst.form = 1 UpdateFossileMound(inst, 1) inst.OnSave = onsave inst.OnLoad = onload return inst end return Prefab(name, fn, assets, prefabs) end return makemound("fossil_stalker") Soooo what do I need to do to make this work? What part of the original fossil_mound.lua file do I need to replace with the edited stuff? I know, I might sound dumb for making this post and it's not even about modding, but I'm new here and I need some help. ;-; Edited December 15, 2018 by nextwebber1 Link to comment Share on other sites More sharing options...
Ultroman Posted December 15, 2018 Share Posted December 15, 2018 (edited) Stop stop stop. You don't edit the game files. That WILL mess up your game. The code you have there (in the first block) is code for a mod.You make a new mod, put that code in your modmain.lua file, and set up your modinfo.lua file, and your preview image, and upload the mod. Can't comment on the code, because I never tried anything like this. Find one of your simplest mods in your "mods" folder in your game files. I can recommend to copy a mod like "Quick Pick", since its files are very simple. Make a copy of that folder. Give it a name saying in few words what the mod is. - Edit the modinfo.lua and set: all_clients_require_mod = true - Also change the name, description, author and version number (just put in "0.1" or something). - Get the TexTool (version 1.4.1) from here. - Make a new PNG image (logo) for your mod. Make the image 128x128 pixels. - Open TexCreator.exe and create a tex file from your image file. - Replace the "preview.tex" file with the one you just made. - Open the modmain.lua and delete everything in it. Paste in the code you have in your first block. - Test the mod locally, to make sure there are no bugs. - Get the "Don't Starve Mod Tools" on Steam and run it. Remember to change the game to "Don't Starve Together". - Select the folder with your mod in it, and click on the button to upload the mod. - Then move the folder you made out of the "mods" folder, since you will be downloading the mod from the workshop next. If all goes well, your mod should appear on the Workshop, so you and your friend can both subscribe to it. Edited December 15, 2018 by Ultroman 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