ARINGARING1234

  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About ARINGARING1234

  • Rank
    Junior Member
...
  1. Hi, I'm a beginner of mode maker, First of all, I apologize for my poor English. I'm making a gardener character of one game. he is human and love plant and flower so I wanna give ability of farming work. about here 1. Restores sanity when planting. 2. Can talk to crops without any tools 3. Can farming without any tools 4. Can check to crops feeling without any tools It's similar to wormwood, right? so, I have pasted from wormwood code to my code local WATCH_WORLD_PLANTS_DIST_SQ = 20 * 20 local SANITY_DRAIN_TIME = 5 local function SanityRateFn(inst, dt) local amt = 0 for i = #inst.plantbonuses, 1, -1 do local v = inst.plantbonuses[i] if v.t > dt then v.t = v.t - dt else table.remove(inst.plantbonuses, i) end amt = amt + v.amt end return amt end local function DoPlantBonus(inst, bonus, overtime) if overtime then table.insert(inst.plantbonuses, { amt = bonus / SANITY_DRAIN_TIME, t = SANITY_DRAIN_TIME }) else while #inst.plantpenalties > 0 do table.remove(inst.plantpenalties) end inst.components.sanity:DoDelta(bonus) inst.components.talker:Say(GetString(inst, "ANNOUNCE_GROWPLANT")) end end local function CalcSanityMult(distsq) distsq = 1 - math.sqrt(distsq / WATCH_WORLD_PLANTS_DIST_SQ) return distsq * distsq end local function WatchWorldPlants(inst) if inst._onitemplanted == nil then inst._onitemplanted = function(src, data) if data == nil then --shouldn't happen elseif data.doer == inst then DoPlantBonus(inst, TUNING.SANITY_TINY * 2) elseif data.pos ~= nil then local distsq = inst:GetDistanceSqToPoint(data.pos) if distsq < WATCH_WORLD_PLANTS_DIST_SQ then DoPlantBonus(inst, CalcSanityMult(distsq) * TUNING.SANITY_SUPERTINY * 2, true) end end end inst:ListenForEvent("itemplanted", inst._onitemplanted, TheWorld) end end local function StopWatchingWorldPlants(inst) if inst._onitemplanted ~= nil then inst:RemoveEventCallback("itemplanted", inst._onitemplanted, TheWorld) inst._onitemplanted = nil end end But, it doesn't work!!! So I'd like to ask for your help by attaching my code screenshot. Where, how, and what should I put in? X( Help me!! plz...