Search the Community
Showing results for tags 'components'.
Found 3 results
Hello all, I'm trying to create a new widget to show when a character is in the 'rage' state. It activates fine, but the inside is offset by a lot (see the attached picture). Then when it deactivates, the widget is still there despite it being killed by the character prefab file. Any thoughts on why this is happening? Here's the character's rage function that should hide the widget: local function LoseRage(inst) inst:PushEvent("transform_normal") inst:RemoveTag("raging") inst.AnimState:SetBuild("normal") inst.components.talker:Say("That was exhausting.") inst.components.combat.damagemultiplier = 1.1 inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED inst.components.hunger:Resume() inst.components.sanity.ignore = false inst.components.health.absorb = 0 inst.components.sanity:DoDelta(-TUNING.SANITY_MEDLARGE) inst.components.rage:StopDrainEffect() GetSeasonManager():StopPrecip() if inst.HUD then if inst.HUD.ragemeter then print('removing rage hud') inst.HUD.controls.ragemeter:Deactivate() inst.HUD.controls.ragemeter:Kill() inst.HUD.controls.ragemeter = nil end inst.HUD.controls.crafttabs:Show() inst.HUD.controls.mapcontrols.minimapBtn:Show() end end rage_meter.lua rage_meter.zip
I know it seems like I live in this forum begging for help right now, but I'm really enjoying learning new things! I'm working on craftable stone/marble graves, and I want to be able to 'engrave' them like you can the signposts in game. I thought it would be fun to be able to mark spots, or to make graveyards for player deaths, or your faithful companions (beefalo graveyard, anyone?) I thought applying this to an item would be as simple as adding the 'writeable' component into the prefab, but it doesn't work. I've also tried making a standalone copy of "writeable" (etc) for my prefab to call on but that doesn't work. I've looked at 'Domestication Plus' since that uses the writeable component somehow, but I can't work out how they've done it. The file attached contains some edits of the files in Domestication Plus. Any hints/help would be appreciated! justjasper Craftable Gravestones (DST).rar
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