Ghost_starved Posted February 19, 2021 Share Posted February 19, 2021 Please tell me how the character code should look like so that he can restore his sanity next to, for example, with Wilson Link to comment Share on other sites More sharing options...
Yakuzashi Posted February 19, 2021 Share Posted February 19, 2021 (edited) local function friendsFOREVER(inst) local pt = inst:GetPosition() local range = 10 -- range of ability local hps = 5 -- sanity amount per tick local frens = { "wilson" } local targets = TheSim:FindEntities(pt.x,pt.y,pt.z, range, frens) for _,ent in ipairs(targets) do inst.components.sanity:DoDelta(hps) end end local function BFFs(inst) if not inst.components.health:IsDead() and not inst:HasTag("playerghost") then friendsFOREVER(inst) end end This part below needs to be placed inside master_postinit local toim = 2 -- time interval between every sanity tick (seconds-ish, it's not 100% accurate) inst:DoPeriodicTask(toim, BFFs, nil, inst) Try this inside [character's.name].lua Edited February 19, 2021 by Yakuzashi Link to comment Share on other sites More sharing options...
Ghost_starved Posted February 19, 2021 Author Share Posted February 19, 2021 When you enter the server, the game freezes, and then disconnects 52 minutes ago, Yakuzashi said: Эту часть ниже необходимо поместить в master_postinit. Попробуйте это внутри [имя персонажа] .lua Everything is fine, but when you enter the server, the game freezes, and then disconnects Link to comment Share on other sites More sharing options...
Ghost_starved Posted February 19, 2021 Author Share Posted February 19, 2021 1 hour ago, Yakuzashi said: Эту часть ниже необходимо поместить в master_postinit. Попробуйте это внутри [имя персонажа] .lua what is it "Toim" Link to comment Share on other sites More sharing options...
Yakuzashi Posted February 19, 2021 Share Posted February 19, 2021 I have added comment so you should understand what is it. Place everything inside master_postinit and try again. If not send me crash log Link to comment Share on other sites More sharing options...
Ghost_starved Posted February 19, 2021 Author Share Posted February 19, 2021 I put this part in "master_postinit" local toim = 2 inst:DoPeriodicTask(toim, BFFs, nil, inst) I put this part in Code local function friendsFOREVER(inst) local pt = inst:GetPosition() local range = 10 -- range of ability local hps = 5 -- sanity amount per tick local frens = { "wilson" } local targets = TheSim:FindEntities(pt.x,pt.y,pt.z, range, frens) for _,ent in ipairs(targets) do inst.components.sanity:DoDelta(hps) end end local function BFFs(inst) if not inst.components.health:IsDead() and not inst:HasTag("playerghost") then friendsFOREVER(inst) end end But it doesn't work, I noticed errors where Friends are written as FRENS Im new to Modding and I don't understand much Link to comment Share on other sites More sharing options...
Yakuzashi Posted February 19, 2021 Share Posted February 19, 2021 Probably Wilson doesn't have his own tag, so you need to swap "wilson" with "character". And add Quote inst:AddTag( "yourcharacter'snamehere" ) inside common_postinit. Then add this line Quote local notag = {"yourcharacter'snamehere"} under Quote local frens = {"character"} and modifiy Quote local targets = TheSim:FindEntities(pt.x,pt.y,pt.z, range, frens) for something like this Quote local targets = TheSim:FindEntities(pt.x,pt.y,pt.z, range, frens, notag) Link to comment Share on other sites More sharing options...
Ghost_starved Posted February 20, 2021 Author Share Posted February 20, 2021 (edited) local function onbecamehuman(inst) -- Set speed when not a ghost (optional) inst.components.locomotor:SetExternalSpeedMultiplier(inst, "wuk_speed_mod", 1) end inst:AddTag( "wuk" ) local function friendsFOREVER(inst) local pt = inst:GetPosition() local range = 10 -- range of ability local hps = 6 -- sanity amount per tick local friends = { "webber" } local targets = TheSim:FindEntities(pt.x,pt.y,pt.z, range, friends , notag) for _,ent in ipairs(targets) do inst.components.sanity:DoDelta(hps) end end local function BFFs(inst) if not inst.components.health:IsDead() and not inst:HasTag("playerghost") then friendsFOREVER(inst) end end local common_postinit = function(inst) local notag = {"wuk"} local frens = {"webber"} -- Minimap icon inst.MiniMapEntity:SetIcon( "wuk.tex" ) end is everything right? Edited February 21, 2021 by Ghost_starved Link to comment Share on other sites More sharing options...
Yakuzashi Posted February 21, 2021 Share Posted February 21, 2021 Nope. Just upload your whole mod in .zip or wuk.lua Link to comment Share on other sites More sharing options...
Ghost_starved Posted February 21, 2021 Author Share Posted February 21, 2021 8 hours ago, Yakuzashi said: Nope. Just upload your whole mod in .zip or wuk.lua but ... i didn't understand Link to comment Share on other sites More sharing options...
Yakuzashi Posted February 21, 2021 Share Posted February 21, 2021 So it's all about language barrier then... I can't do much in this matter Link to comment Share on other sites More sharing options...
Ghost_starved Posted February 28, 2021 Author Share Posted February 28, 2021 (edited) Can you try to explain it to me again? Only in more detail and clearer Edited February 28, 2021 by Ghost_starved Link to comment 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