lakhnish Posted December 26, 2017 Share Posted December 26, 2017 I would like to know where the winter's feast event's data is in the lua. I would like to read it to verify information about the event through the game code rather than word of mouth or a wiki that does not show the game code to verify how parts of the event work. Like for example, I'd like to find the lua for the loot table for sleeping under the X-mas tree and how it works. I can't seem to find it. Link to comment https://forums.kleientertainment.com/forums/topic/85825-where-is-the-winters-feast-event-data-in-the-lua/ Share on other sites More sharing options...
CarlZalph Posted December 26, 2017 Share Posted December 26, 2017 @lakhnish It's all defined in data/scripts/prefabs/winter_tree.lua. The function where the loot is chosen happens in 'dogifting'. The function on loot boils down to: if (last check time > 4 days) then Give a stack of 4 of a random winter food, and 1 random trinket. if (fully decorated) then Give 1 of these items with these odds: {beefalohat = 0.1, bluegem = 0.04, cane = 0.02, catcoonhat = 0.1, earmuffshat = 0.1, gears = 0.08, greengem = 0.04, molehat = 0.1, orangegem = 0.04, panflute = 0.02, redgem = 0.04, sewing_kit = 0.08, walrushat = 0.1, winterhat = 0.1, yellowgem = 0.04} if (25% chance) then Give 1 random "fancy" ornament end else Give 1 of these items with these odds: {beefalohat = 0.053763440860215, bluegem = 0.053763440860215, catcoonhat = 0.053763440860215, compass = 0.053763440860215, earmuffshat = 0.053763440860215, flint = 0.10752688172043, gears = 0.053763440860215, greengem = 0.010752688172043, molehat = 0.053763440860215, moonrocknugget = 0.10752688172043, nitre = 0.10752688172043, orangegem = 0.010752688172043, redgem = 0.053763440860215, sewing_kit = 0.053763440860215, silk = 0.10752688172043, winterhat = 0.053763440860215, yellowgem = 0.010752688172043} if (25% chance) then Give 1 random "plain" ornament end end else Give 1 random winter food, and 1 charcoal. end Optimal tree placement is apart of the circle packing in a circle problem. Radius is 25 units for player sleeping and the radius on a per-tree basis away must be >= 3.2 units. If you're using a square grid layout, then you'll get 193 trees place. If you're using a hexagonal layout, then you'll get 301 trees place. Spoiler The easiest method is the hexagon approach and using the geometric placement. Link to comment https://forums.kleientertainment.com/forums/topic/85825-where-is-the-winters-feast-event-data-in-the-lua/#findComment-987689 Share on other sites More sharing options...
clri Posted December 27, 2017 Share Posted December 27, 2017 There's also more information in prefabs/bundle.lua (code for replacing Oasis Crumpled Packages that contain trinkets with ornaments and festive lights), prefabs/klaus.lua (for dropping the deer, Krampus, and Klaus ornaments), prefabs/winter_ornaments.lua, prefabs/wintersfeastfood.lua, etc. There's also a part in the code that defines how many additional (plain/fancy) ornaments drop in addition to the boss-specific Magnificent Adornments when you kill certain bosses. Crumpled Package script (prefabs/bundle.lua): if IsSpecialEventActive(SPECIAL_EVENTS.WINTERS_FEAST) and string.sub(item, 1, 7) == "trinket" and item ~= "trinket_26" then --chance to replace trinkets (but not potatocup) local rnd = math.random(6) if rnd == 1 then item = GetRandomBasicWinterOrnament() elseif rnd == 2 then item = GetRandomFancyWinterOrnament() elseif rnd == 3 then item = GetRandomLightWinterOrnament() end end components/lootdropper.lua: if IsSpecialEventActive(SPECIAL_EVENTS.WINTERS_FEAST) then local prefabname = string.upper(self.inst.prefab) local num_decor_loot = TUNING.WINTERS_FEAST_TREE_DECOR_LOOT[prefabname] or nil if num_decor_loot ~= nil then for i = 1, num_decor_loot.basic do self:SpawnLootPrefab(GetRandomBasicWinterOrnament(), pt) end if num_decor_loot.special ~= nil then self:SpawnLootPrefab(num_decor_loot.special, pt) end elseif not TUNING.WINTERS_FEAST_LOOT_EXCLUSION[prefabname] and (self.inst:HasTag("monster") or self.inst:HasTag("animal")) then local loot = math.random() if loot < 0.005 then self:SpawnLootPrefab(GetRandomBasicWinterOrnament(), pt) elseif loot < 0.20 then self:SpawnLootPrefab("winter_food"..math.random(NUM_WINTERFOOD), pt) end end end Mobs that don't drop Winter's Feast loot, and the number of additional ornaments each boss drops (tuning.lua): WINTERS_FEAST_TREE_DECOR_LOOT = { DEERCLOPS = {basic=0, special="winter_ornament_boss_deerclops"}, BEARGER = {basic=1, special="winter_ornament_boss_bearger"}, DRAGONFLY = {basic=2, special="winter_ornament_boss_dragonfly"}, MINOTAUR = {basic=1, special=nil}, BEEQUEEN = {basic=2, special="winter_ornament_boss_beequeen"}, TOADSTOOL = {basic=2, special="winter_ornament_boss_toadstool"}, TOADSTOOL_DARK = {basic=3, special="winter_ornament_boss_toadstool"}, Goose = {basic=1, special="winter_ornament_boss_moose"}, -- Goose? ANTLION = {basic=1, special="winter_ornament_boss_antlion"}, }, WINTERS_FEAST_LOOT_EXCLUSION = { BEEGUARD = true, FROG = true, TENTACLE = true, KLAUS = true, STALKER = true, STALKER_FOREST = true, }, Link to comment https://forums.kleientertainment.com/forums/topic/85825-where-is-the-winters-feast-event-data-in-the-lua/#findComment-987719 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.