Search the Community
Showing results for tags 'age'.
Found 2 results
I'm currently having a problem with my code within the modmain of a custom character I was creating and I was able to isolate it down to this line here: if v.components.age:GetAgeInDays() % daysRequired = 0 then What I'm trying to accomplish is a simple RNG item giver to a specific character, but only when their time alive in the world fully divides (nothing in the decimal places) into the required day count (determined by the config data of 'gem_generation'). However, when it comes to running the code below, I always receive the same results from the game. For the line I isolated above, it always crashes saying that "then is expected near =" for said line. I'd appreciate any assistance in finding out the issue as well as how to solve it. The full code: if GetModConfigData('gem_generation') > 0 then local function GiveGems() for i,v in ipairs(AllPlayers) do local daysRequired = tonumber(GetModConfigData('gem_generation')) local playerAge = tonumber(v.components.age:GetAgeInDays()) -- If the player is example, has more than 0 health (isn't dead) and the age of the player meets the generation requirements if (v:HasTag("example")) and (v.components.health.currenthealth > 0) and (playerAge > 1) and not v:HasTag("playerghost") then if v.components.age:GetAgeInDays() % daysRequired = 0 then --Gives the player a random gem local RNG = math.random(1,36) if RNG < 7 then v.components.inventory:GiveItem("redgem") elseif RNG >= 7 and RNG < 13 then v.components.inventory:GiveItem("orangegem") elseif RNG >= 13 and RNG < 19 then v.components.inventory:GiveItem("yellowgem") elseif RNG >= 19 and RNG < 25 then v.components.inventory:GiveItem("greengem") elseif RNG >= 25 and RNG < 31 then v.components.inventory:GiveItem("bluegem") else v.components.inventory:GiveItem("purplegem") end end end end end -- Runs GiveGems local function OnDayComplete(inst,day) GiveGems() end -- Runs GiveGems at the start of a new day AddWorldPostInit(function(w) w:WatchWorldState("cycles", OnDayComplete) end) end
I wanted to get your opinions on how old you think the playable characters are in this game. Due to the Tim Burton art style, it can be hard to tell exactly how old the characters are. Here are my theories. Wilson- You can clearly see Wilson has a few wrinkles under his eyes, so i would say he is middle aged. Estimated age- 42 Willow- She is fully grown, but she also carries a teddy bear around, so i think she might be a teenager. Estimated age- 16 Wendy- She is much smaller than the other characters, and she dosn't seem to understand the fact that her sister is dead. She is clearly Elementry school age. Estimated age- 7 Wolfgang- He dosn't have as many wrinkles as Wilson, so i would say he's a few years yonger. Estimated age- 34 What are your opinions?