RustyNayle Posted October 31, 2015 Share Posted October 31, 2015 (edited) Hi guys, I want my Wanda character to be able to craft a scroll that forces precipitation locally (increasing farm yields and causing mushrooms to start growing again), and causes snow to melt (making continued farming possible during Winter). Please help? Cheers, Rusty Edited November 2, 2015 by RustyNayle Link to comment Share on other sites More sharing options...
RustyNayle Posted November 30, 2015 Author Share Posted November 30, 2015 Charlie the Gardener ( http://steamcommunity.com/sharedfiles/filedetails/?id=417049595 ) has a book that causes global rain, I'm just wondering if local rain is possible? Link to comment Share on other sites More sharing options...
Kzisor Posted November 30, 2015 Share Posted November 30, 2015 @RustyNayle, local rain is possible, however, it will require a good amount of effort in order for you to get it to work correctly. You will basically have to recreate the entire way weather works in order to have localized weather conditions. Link to comment Share on other sites More sharing options...
Mobbstar Posted November 30, 2015 Share Posted November 30, 2015 @RustyNayle, local rain is possible, however, it will require a good amount of effort in order for you to get it to work correctly. You will basically have to recreate the entire way weather works in order to have localized weather conditions. I'd think "simply" making a prefab that spawns rain fx around it (or for the players around it) and causes nearby things to become wet (which is a mechanic I to this day do not understand) is sufficient. Of course, this prefab would have to disappear when real precip starts. Link to comment Share on other sites More sharing options...
Kzisor Posted November 30, 2015 Share Posted November 30, 2015 I'd think "simply" making a prefab that spawns rain fx around it (or for the players around it) and causes nearby things to become wet (which is a mechanic I to this day do not understand) is sufficient. The problem is with how things 'become' wet. It's so intertwined with the weather mechanics that creating said prefab is essentially creating a completely new weather system. Link to comment Share on other sites More sharing options...
RustyNayle Posted November 30, 2015 Author Share Posted November 30, 2015 Damn, I just wrote a whole bunch of stuff but I think Klei auto signed me out or something, so I lost it all! Anyways, just quickly, I spent some time looking at the lines of code for global rain book of Charlie the Gardener (417049595), ability to fertilise during winter by Walter the Botanist (422744946), and Wren the Stormcaller (417238901) looking for some lines of code. Charlie's charliebooks.lua : function rainfn(inst, reader) local pt = Vector3(reader.Transform:GetWorldPosition()) reader.components.sanity:DoDelta(-TUNING.SANITY_LARGE) local range = 90 local ents = TheSim:FindEntities(pt.x, pt.y, pt.z, range) for k, v in pairs(ents) doif v.components.burnable thenv.components.burnable:Extinguish()endendTheWorld:PushEvent("ms_forceprecipitation") return trueend function growfn(inst, reader) local pt = Vector3(reader.Transform:GetWorldPosition()) reader.components.sanity:DoDelta(-TUNING.SANITY_LARGE) local range = 30 local ents = TheSim:FindEntities(pt.x, pt.y, pt.z, range) for k, v in pairs(ents) do if v.components.pickable ~= nil then v.components.pickable:FinishGrowing() end if v.components.crop ~= nil then v.components.crop:DoGrow(TUNING.TOTAL_DAY_TIME * 3) end if v.components.growable ~= nil and v:HasTag("tree") and not v:HasTag("stump") then v.components.growable:DoGrowth() end end return trueend Walter's modmain.lua : AddComponentPostInit("crop", function(self) local old = self.Fertilize function self:Fertilize(fertilizer) local pt = self.inst:GetPosition() local ents = GLOBAL.TheSim:FindEntities(pt.x, pt.y, pt.z, 5, {"player", "greenthumb"}, {"playerghost"}) if #ents > 0 then self.growthpercent = self.growthpercent + fertilizer.components.fertilizer.fertilizervalue * self.rate self.inst.AnimState:SetPercent("grow", self.growthpercent) if self.growthpercent >=1 then self.inst.AnimState:PlayAnimation("grow_pst") self:Mature() self.task:Cancel() self.task = nil end if (fertilizer.components.stackable ~= nil) then fertilizer.components.stackable:Get(1):Remove() end return true else return old(self, fertilizer) end endend) weather.lua from the C:\Program Files (x86)\Steam\steamapps\common\Don't Starve Together\data\scripts\components\ has 981 lines of code, I was trying to extract some of the code terminology such as wetness, moisture, pollen, snow.tex, mud.tex, puddles, etc Anyway, I've wasted enough time typing this twice, I'll have to come back and look at this later. Link to comment Share on other sites More sharing options...
RustyNayle Posted November 30, 2015 Author Share Posted November 30, 2015 (edited) Gosh, it looks like there's others such as moisture.lua to look through as well... I don't know if raising the local temperature is necessary as well as the rain to melt snow / make farms yieldable again in Winter. Anyway, rather than actually simulating local rain over time, there could be one big instantaneous downpour effect that does something similar to Wickerbottom's Applied Agriculture (and Charlie's rainbook, which has similar effects included) with some of the following effects: Pickables (grass, twigs, etc) finish growingFarms and berry bushes mature (or have their day number tuned, which is what Wicker's book does?)Mushrooms re-growNon-stump trees grow As well as, Characters and other prefabs in the area increase wetnessSnow meltsPuddles (mud) formFirepit, camp fire and torch durability reduces (i.e. burn out)Chance of lightning or frog rain Here's the code from Wickerbottom's books.lua in the DST prefabs directory, function growfn(inst, reader) local pt = Vector3(reader.Transform:GetWorldPosition()) reader.components.sanity:DoDelta(-TUNING.SANITY_LARGE) local range = 30 local ents = TheSim:FindEntities(pt.x, pt.y, pt.z, range) for k, v in pairs(ents) do if v.components.pickable ~= nil then v.components.pickable:FinishGrowing() end if v.components.crop ~= nil then v.components.crop:DoGrow(TUNING.TOTAL_DAY_TIME * 3, true) end if v.components.growable ~= nil and v:HasTag("tree") and not v:HasTag("stump") then v.components.growable:DoGrowth() end end return trueend Edited November 30, 2015 by RustyNayle Link to comment Share on other sites More sharing options...
RustyNayle Posted November 30, 2015 Author Share Posted November 30, 2015 Oh, I just realised that the Charlie book actually does everything the Wickerbottom book does, and then just makes it rain globally, and instantly extinguishes stuff, so you didn't really need me to copy the Wicker book code again Link to comment Share on other sites More sharing options...
Kzisor Posted November 30, 2015 Share Posted November 30, 2015 @RustyNayle, the weather.lua component OnUpdate function is what handles snow melting etc. Link to comment Share on other sites More sharing options...
RustyNayle Posted December 2, 2015 Author Share Posted December 2, 2015 Thanks @Kzisor . I'm supergreen to coding, if it weren't for the help from those such as @Zackreaver and @DarkXero, my Wanda mod character would have only been custom stats and starting inventory, but you guys are all so generously helping me to make her into a much more immersive playing experience. @DarkXero , any idea how to make this book work? Link to comment Share on other sites More sharing options...
RustyNayle Posted December 11, 2015 Author Share Posted December 11, 2015 I was thinking, maybe Wanda could make anti-freeze fertiliser water balloons using Glommer goop, or something? Maybe that would be a more simple local effect, rather than a downpour Link to comment Share on other sites More sharing options...
Maris Posted December 11, 2015 Share Posted December 11, 2015 Guys, what do you think about local season? Is it possible in general? All season mechanics should depend on item/player position. Link to comment Share on other sites More sharing options...
DarkXero Posted December 11, 2015 Share Posted December 11, 2015 Guys, what do you think about local season? Is it possible in general? Would require you to remove seasons from world_network and adding a player_seasons component or something. The component would update itself when the player enters a new part of the map. All season mechanics should depend on item/player position. The mechanics are here already. Look up the areaaware component.It helps the monkeys transform in nightmare areas when the phase is right.Nightmare areas are rooms with "Nightmare" tag. So to make seasonal biomes, you would have to go through all tasks and rooms, putting "autumn" (only autumn in the area), "winter", "spring", "summer", "autumn/winter (autumn then winter then autumn again cycle)", "autumn/winter/spring", "autumn/winter/spring/summer" (complete cycle in area) tags. Then you have to edit all the world temperature and stuff depending on seasons, if needed. World temperature depends on season, so you would need player_worldtemperature component. Basically, a lot of rewriting. Link to comment Share on other sites More sharing options...
RustyNayle Posted December 13, 2015 Author Share Posted December 13, 2015 (edited) So, are we talking about powerful spellbooks that actually add a temporary tag to the current area of turf to make it Spring on just those tiles; making it rain, causing snow to melt, mushrooms to regrow, flowers to multiply (pollinate), and farms to yield quicker? What about a craftable turf that is Spring all the time using really rare items so they can only make enough for a couple of farms? Edited December 13, 2015 by RustyNayle Link to comment Share on other sites More sharing options...
RustyNayle Posted December 30, 2015 Author Share Posted December 30, 2015 Ping 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