Augustusc Posted May 14, 2017 Share Posted May 14, 2017 Hello! I got a few questions as to if things could be done 1. A character say only one word or phrase (You could change the speech file, but then mod items aren't affected. could you make it so no matter what it will be the word or phrase) 2. An item that when used, is an area of effect reviving? ( Taking the files for the pan flute, coping it, and making it do area of reviving dead players instead of make area of sleep) 3. making it so a character gets a bonus/penalty from eating a specific type of food (The specific character gets less food from eating meat and gets extra health from eating vegetables) If these could be done. Could you maybe point me in the right direction to figuring out how to implement it? I hope I'm not being a bother asking these. Thanks in advance Link to comment Share on other sites More sharing options...
Aquaterion Posted May 14, 2017 Share Posted May 14, 2017 1. I'm guessing you could override some function that processes talking to replace words with your string, not sure tho.. 2. Definitely, using TheSim:FindEntities to find nearby players that are ghosts, and then pushing the event "respawnfromghost" on them with a for loop. 3. You could either set an OnEat function in masterpostinit of your in character prefab, to deduct or add extra stats AFTER the food is eaten or you could override the method Eat to check add or deduct the stats BEFORE getting eaten. Link to comment Share on other sites More sharing options...
DarkXero Posted May 14, 2017 Share Posted May 14, 2017 5 hours ago, Augustusc said: 1. A character say only one word or phrase (You could change the speech file, but then mod items aren't affected. could you make it so no matter what it will be the word or phrase) -- Speech strings and chat (not the actual chat text) strings converted local function OneLine(old_message) return "AAA" end AddPrefabPostInit("wilson", function(inst) inst.components.talker.mod_str_fn = OneLine end) -- Speech strings only local function OneLine() return "AAA" end local _GetSpecialCharacterString = GLOBAL.GetSpecialCharacterString GLOBAL.GetSpecialCharacterString = function(character) if character == nil then return nil end character = string.lower(character) return (character == "wilson" and OneLine()) or _GetSpecialCharacterString(character) end 6 hours ago, Augustusc said: 2. An item that when used, is an area of effect reviving? ( Taking the files for the pan flute, coping it, and making it do area of reviving dead players instead of make area of sleep) local pos = inst:GetPosition() local ents = TheSim:FindEntities(pos.x, pos.y, pos.z, 10, {"playerghost"}) for i, v in ipairs(ents) do v:PushEvent("respawnfromghost") end 6 hours ago, Augustusc said: 3. making it so a character gets a bonus/penalty from eating a specific type of food (The specific character gets less food from eating meat and gets extra health from eating vegetables) AddPrefabPostInit("wilson", function(inst) local _Eat = inst.components.eater.Eat inst.components.eater.Eat = function(self, food, feeder) local foodtype = food and food.components.edible and food.components.edible.foodtype if foodtype == "MEAT" then self:SetAbsorptionModifiers(1, 0.5, 1) elseif foodtype == "VEGGIE" then self:SetAbsorptionModifiers(1.5, 1, 1) else self:SetAbsorptionModifiers(1, 1, 1) end return _Eat(self, food, feeder) end end) 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