tetrified Posted January 2, 2015 Share Posted January 2, 2015 (edited) Goal: get override triggers and area awareness to work in don't starve together Problem: The world overrides will rapidly flip from one setting to another if one player is in the trigger area and one player is not.In this specific case I'm attempting to modify the amount of time left in the day, the clock will switch from a long day to a short day, and the time will appear to be moving much faster on the short day clock during the day (when the hand on the short day clock reaches approximately the bottom of the clock, the hand on the long day clock is already in the 9 o'clock position) But once dusk hits (on both clocks at the same time due to time moving much faster on the long day clock) time appears to move more slowly on the long day clock, and takes five or so time segments to move one segment. and then once night hits, it takes three time segments to move one segment. Is it possible to have it be night in one part of the world, while still being day/dusk in another part? My progress: files - script for the area awareness component -Don't Starve Together Beta\data\scripts\components\area_aware.luascript for the area trigger component -Don't Starve Together Beta\data\scripts\components\area_trigger.luaPlayer_common prefab (is this even the right place to do this?)-Don't Starve Together Beta\data\scripts\prefabs\player_common.luacode -I've tried adding area aware and area trigger as components to player_common, when another player is in the and not in the spot where the trigger is, the world settings will flip back and forth periodically. local ground = TheWorld inst:AddComponent("area_aware") if ground.topology.override_triggers then inst:AddComponent("area_trigger") inst.components.area_trigger:RegisterTriggers(ground.topology.override_triggers) end for i,node in ipairs(ground.topology.nodes) do local story = ground.topology.ids[i] local story_depth = nil if ground.topology.story_depths then story_depth = ground.topology.story_depths[i] end if story ~= "START" then story = string.sub(story, 1, string.find(story,":")-1) end inst.components.area_aware:RegisterArea({idx=i, type=node.type, poly=node.poly, story=story, story_depth=story_depth}) end inst.components.area_aware:StartCheckingPosition() Edited January 2, 2015 by tetrified Link to comment https://forums.kleientertainment.com/forums/topic/48156-request-for-help-override-triggers-and-area-awareness/ Share on other sites More sharing options...
tetrified Posted January 2, 2015 Author Share Posted January 2, 2015 Edited original post; old problem is solved, new problem has arisen. Link to comment https://forums.kleientertainment.com/forums/topic/48156-request-for-help-override-triggers-and-area-awareness/#findComment-595614 Share on other sites More sharing options...
Kzisor Posted January 2, 2015 Share Posted January 2, 2015 (edited) Goal: get override triggers and area awareness to work in don't starve together Problem: The world overrides will rapidly flip from one setting to another if one player is in the trigger area and one player is not. You need to create a a custom event selection for onenter, onleave, and onchange. Example:function onenter(inst) if world.canchange and player_triggers_onenter then world.canchange = false -- DO OTHER STUFF HERE. endend function onleave(inst) if not world.canchange and player_triggers_onleave then world.canchange = true -- DO OTHER STUFF HERE endend When a player enters into an override area they trigger the onenter which locks the world into it's current changed state. When that player leaves the override area they trigger onleave which unlocks the world allowing it to change. EDIT:Seems the original post was edited as I made my post. I am not sure if what you are wanting to do is feasible. A possible solution:Segment your world and have a clock component for each segment. Upon entering a segment have it push an event which changes the clock appropriately to the current time zone. Edited January 2, 2015 by Kzisor Link to comment https://forums.kleientertainment.com/forums/topic/48156-request-for-help-override-triggers-and-area-awareness/#findComment-595621 Share on other sites More sharing options...
tetrified Posted January 2, 2015 Author Share Posted January 2, 2015 (edited) You need to create a a custom event selection for onenter, onleave, and onchange. Example:function onenter(inst) if world.canchange and player_triggers_onenter then world.canchange = false -- DO OTHER STUFF HERE. endend function onleave(inst) if not world.canchange and player_triggers_onleave then world.canchange = true -- DO OTHER STUFF HERE endend When a player enters into an override area they trigger the onenter which locks the world into it's current changed state. When that player leaves the override area they trigger onleave which unlocks the world allowing it to change. The problem is I only want it to be dusk/night for the person that is in the trigger, or I would just lock the state, as you said. I want it to be daytime for the people outside of the trigger, so the problem boils down to is it possible for it to be different times in different parts of the world? Edited January 2, 2015 by tetrified Link to comment https://forums.kleientertainment.com/forums/topic/48156-request-for-help-override-triggers-and-area-awareness/#findComment-595623 Share on other sites More sharing options...
Kzisor Posted January 2, 2015 Share Posted January 2, 2015 @tetrified, see edit of previous post. Note: The segmentation would probably need to occur in the world generation rather than after the game had been loaded. This would also require additional saving based on each of the segments. Also know that the more segments or time zones you create the more processing power your server would need to operate at full capabilities. Link to comment https://forums.kleientertainment.com/forums/topic/48156-request-for-help-override-triggers-and-area-awareness/#findComment-595625 Share on other sites More sharing options...
tetrified Posted January 2, 2015 Author Share Posted January 2, 2015 @tetrified, see edit of previous post. Note: The segmentation would probably need to occur in the world generation rather than after the game had been loaded. This would also require additional saving based on each of the segments. Also know that the more segments or time zones you create the more processing power your server would need to operate at full capabilities. I only plan on segmenting it twice, a la "Two Worlds", the adventure mode map. I'm going to be honest, I've never seen anything like this so I wouldn't even know where to start with segmenting the world like that, has anyone ever done it with anything else? Like, weather or seasons? Where could I go to read up on how to do this? Link to comment https://forums.kleientertainment.com/forums/topic/48156-request-for-help-override-triggers-and-area-awareness/#findComment-595629 Share on other sites More sharing options...
Kzisor Posted January 2, 2015 Share Posted January 2, 2015 @tetrified,honestly I am not sure. I would check with the guys creating Up and Away or the other mod for Don't Starve. Starting with Don't Starve would probably give you at least a slight indication if it's possible for Don't Starve Together. Link to comment https://forums.kleientertainment.com/forums/topic/48156-request-for-help-override-triggers-and-area-awareness/#findComment-595641 Share on other sites More sharing options...
tetrified Posted January 2, 2015 Author Share Posted January 2, 2015 (edited) @tetrified,honestly I am not sure. I would check with the guys creating Up and Away or the other mod for Don't Starve. Starting with Don't Starve would probably give you at least a slight indication if it's possible for Don't Starve Together. This would be really simple in don't starve, as we don't care about where the player isn't, but in don't starve together there could be another player outside of the trigger. As for the two clocks idea, the clock seems to be generated in a world-by-world basis, which means I would have to create two separate worlds, which is the same problem caves ends up having. I'm not too familiar with up and away, but it generates another world, like caves does, yes? At any rate, I'm going to sleep on it and see if I can come up with anything in the morning. Edited January 2, 2015 by tetrified Link to comment https://forums.kleientertainment.com/forums/topic/48156-request-for-help-override-triggers-and-area-awareness/#findComment-595645 Share on other sites More sharing options...
Kzisor Posted January 2, 2015 Share Posted January 2, 2015 @tetrified, you specifically asked about the weather being split. While yes we don't technically care in Don't Starve I could see benefits to having areas in which a player might come across two different types of weather at the same time. This would be a basic principal in creating the segmentation you were looking to create. As far as I know Up and Away does create a new world, haven't kept up with it's development that much though. As far as having to create two separate worlds for the clock, I don't think that would be necessary. All I think would need to be done is simply create two instances of the clock and setting each of their time upon world generation separately. I think the hardest part would be creating the segmentation because you are basically having to split the world into two instances. Link to comment https://forums.kleientertainment.com/forums/topic/48156-request-for-help-override-triggers-and-area-awareness/#findComment-595648 Share on other sites More sharing options...
tetrified Posted January 2, 2015 Author Share Posted January 2, 2015 (edited) @tetrified, you specifically asked about the weather being split. While yes we don't technically care in Don't Starve I could see benefits to having areas in which a player might come across two different types of weather at the same time. This would be a basic principal in creating the segmentation you were looking to create. Localized weather in don't starve:override_triggers = { ["START"] = { {"season", "summer"}, {"weather", "never"}, }, ["drysummerland"] = { {"season", "summer"}, {"weather", "never"}, }, ["wetwinterland"] = { {"season", "winter"}, {"weather", "wet"}, },},If I got the parameters right, this would create a world with a task that is always winter and always snowing, and a task that is always summer and never rains. I honestly doubt that I got the parameters right, but it would be a quick search through the files to find the right ones.Point being; you can easily create segments of the world that have the different seasons/weather/amount of daylight/whatever in the base game because there's only one player to worry about, however in don't starve together people can be standing on both triggers at the same time, thus causing issues. As far as having to create two separate worlds for the clock, I don't think that would be necessary. All I think would need to be done is simply create two instances of the clock and setting each of their time upon world generation separately. I think the hardest part would be creating the segmentation because you are basically having to split the world into two instances. Is splitting the world into two instances possible?The problem with generating two clocks is that clocks work on a world-by-world basis, not a task-by-task basis, though you did just give me the idea of creating a "main clock" and two "sub clocks" that run based on the "main clock" Although I'm still not sure if it's even possible to have it be night in one part of the world, while remaining day in the other part. I'll have to see tomorrow when I start coding again. EDIT:My other option is to force all players to go to the other side if one player chooses to, which would be a viable option, if not my first pick. Edited January 2, 2015 by tetrified Link to comment https://forums.kleientertainment.com/forums/topic/48156-request-for-help-override-triggers-and-area-awareness/#findComment-595651 Share on other sites More sharing options...
Kzisor Posted January 2, 2015 Share Posted January 2, 2015 Localized weather in don't starve:override_triggers = { ["START"] = { {"season", "summer"}, {"weather", "never"}, }, ["drysummerland"] = { {"season", "summer"}, {"weather", "never"}, }, ["wetwinterland"] = { {"season", "winter"}, {"weather", "wet"}, },},If I got the parameters right, this would create a world with a task that is always winter and always snowing, and a task that is always summer and never rains. I honestly doubt that I got the parameters right, but it would be a quick search through the files to find the right ones.Point being; you can easily create segments of the world that have the different seasons/weather/amount of daylight/whatever in the base game because there's only one player to worry about, however in don't starve together people can be standing on both triggers at the same time, thus causing issues. You are forgetting that there would be a location in the original Don't Starve game where both weather places would touch. This means that both weathers would have to be active at the same time and could be active on the screen splitting the screen in half. Either way you'd need to segment the worlds. Link to comment https://forums.kleientertainment.com/forums/topic/48156-request-for-help-override-triggers-and-area-awareness/#findComment-595689 Share on other sites More sharing options...
tetrified Posted January 2, 2015 Author Share Posted January 2, 2015 You are forgetting that there would be a location in the original Don't Starve game where both weather places would touch. This means that both weathers would have to be active at the same time and could be active on the screen splitting the screen in half. Either way you'd need to segment the worlds. That is correct, my code there would cause a snowy world on one side of an invisible line and a summer world on the other Link to comment https://forums.kleientertainment.com/forums/topic/48156-request-for-help-override-triggers-and-area-awareness/#findComment-595770 Share on other sites More sharing options...
Kzisor Posted January 2, 2015 Share Posted January 2, 2015 That is correct, my code there would cause a snowy world on one side of an invisible line and a summer world on the other How well would that work in practice though? You're still going to have the issue of it being sunny in one location and rainy in another. Would it be raining on the screen until you cross the magical threshold/line or would it actually show you that line? In the case of phases of day, it would be the former rather than the latter. There would be a line where once the player crossed their phase for day would change. They would not get the visualization until they crossed said line. Link to comment https://forums.kleientertainment.com/forums/topic/48156-request-for-help-override-triggers-and-area-awareness/#findComment-595799 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