GreatSound Posted July 22, 2016 Share Posted July 22, 2016 I want to be able to eat nightmare fuel and gain the same stats as you get from dragonpie Link to comment https://forums.kleientertainment.com/forums/topic/69045-nightmare-fuel/ Share on other sites More sharing options...
DarkXero Posted July 22, 2016 Share Posted July 22, 2016 Copy paste into modmain.lua: -- Fuel eating local ACTIONS = GLOBAL.ACTIONS local ActionHandler = GLOBAL.ActionHandler -- Tags nightmare fuel to be eaten local function MakeDelicious(inst) inst:AddTag("nightmare_flavor") end AddPrefabPostInit("nightmarefuel", MakeDelicious) -- Effect of eating fuel local function OnFuelEat(inst) inst.components.health:DoDelta(40) inst.components.hunger:DoDelta(75) inst.components.sanity:DoDelta(5) end local function FuelEater(self) if self.inst:HasTag("nightmare_lover") then self.inst:ListenForEvent("fueled_up", OnFuelEat) end end AddComponentPostInit("eater", FuelEater) -- Action of eating fuel local function ProcessFuel(act) if act.doer and act.doer:HasTag("nightmare_lover") then local obj = act.target or act.invobject if obj and obj:HasTag("nightmare_flavor") then if obj.components.stackable then obj.components.stackable:Get():Remove() else obj:Remove() end act.doer:PushEvent("fueled_up") return true end end end AddAction("PROCESSFUEL", "Eat", ProcessFuel) -- Lets fuel get a Eat prompt on inventory local function FuelPrompt(inst, doer, actions) if inst and inst:HasTag("nightmare_flavor") then if doer and doer:HasTag("nightmare_lover") then table.insert(actions, ACTIONS.PROCESSFUEL) end end end AddComponentAction("INVENTORY", "inspectable", FuelPrompt) -- Looks like the player eats meat local processhandler = ActionHandler(ACTIONS.PROCESSFUEL, "eat") AddStategraphActionHandler("wilson", processhandler) AddStategraphActionHandler("wilson_client", processhandler) Then, in the common_postinit of your character, add the tag: inst:AddTag("nightmare_lover") Link to comment https://forums.kleientertainment.com/forums/topic/69045-nightmare-fuel/#findComment-795977 Share on other sites More sharing options...
GreatSound Posted July 22, 2016 Author Share Posted July 22, 2016 58 minutes ago, DarkXero said: Copy paste into modmain.lua: -- Fuel eating local ACTIONS = GLOBAL.ACTIONS local ActionHandler = GLOBAL.ActionHandler -- Tags nightmare fuel to be eaten local function MakeDelicious(inst) inst:AddTag("nightmare_flavor") end AddPrefabPostInit("nightmarefuel", MakeDelicious) -- Effect of eating fuel local function OnFuelEat(inst) inst.components.health:DoDelta(40) inst.components.hunger:DoDelta(75) inst.components.sanity:DoDelta(5) end local function FuelEater(self) if self.inst:HasTag("nightmare_lover") then self.inst:ListenForEvent("fueled_up", OnFuelEat) end end AddComponentPostInit("eater", FuelEater) -- Action of eating fuel local function ProcessFuel(act) if act.doer and act.doer:HasTag("nightmare_lover") then local obj = act.target or act.invobject if obj and obj:HasTag("nightmare_flavor") then if obj.components.stackable then obj.components.stackable:Get():Remove() else obj:Remove() end act.doer:PushEvent("fueled_up") return true end end end AddAction("PROCESSFUEL", "Eat", ProcessFuel) -- Lets fuel get a Eat prompt on inventory local function FuelPrompt(inst, doer, actions) if inst and inst:HasTag("nightmare_flavor") then if doer and doer:HasTag("nightmare_lover") then table.insert(actions, ACTIONS.PROCESSFUEL) end end end AddComponentAction("INVENTORY", "inspectable", FuelPrompt) -- Looks like the player eats meat local processhandler = ActionHandler(ACTIONS.PROCESSFUEL, "eat") AddStategraphActionHandler("wilson", processhandler) AddStategraphActionHandler("wilson_client", processhandler) Then, in the common_postinit of your character, add the tag: inst:AddTag("nightmare_lover") now would it be possible to add nightmare fuel to the meat category along with this Link to comment https://forums.kleientertainment.com/forums/topic/69045-nightmare-fuel/#findComment-796005 Share on other sites More sharing options...
DarkXero Posted July 22, 2016 Share Posted July 22, 2016 8 minutes ago, GreatSound said: now would it be possible to add nightmare fuel to the meat category along with this What do you mean, "category"? You want to make everybody eat nightmare fuel like it is meat? Link to comment https://forums.kleientertainment.com/forums/topic/69045-nightmare-fuel/#findComment-796007 Share on other sites More sharing options...
GreatSound Posted July 22, 2016 Author Share Posted July 22, 2016 5 minutes ago, DarkXero said: What do you mean, "category"? You want to make everybody eat nightmare fuel like it is meat? no i only want to be able to eat it i just want it to go in that food category for my character sense i'm planing on making my character only eat meat Link to comment https://forums.kleientertainment.com/forums/topic/69045-nightmare-fuel/#findComment-796010 Share on other sites More sharing options...
DarkXero Posted July 22, 2016 Share Posted July 22, 2016 7 minutes ago, GreatSound said: no i only want to be able to eat it i just want it to go in that food category for my character sense i'm planing on making my character only eat meat Then make it eat meat. The code I provided makes you eat fuel regardless of diet. Link to comment https://forums.kleientertainment.com/forums/topic/69045-nightmare-fuel/#findComment-796011 Share on other sites More sharing options...
GreatSound Posted July 22, 2016 Author Share Posted July 22, 2016 9 minutes ago, DarkXero said: Then make it eat meat. The code I provided makes you eat fuel regardless of diet. oh ok well thank you then. One more thing though can you make the garland hat infinite for my character Link to comment https://forums.kleientertainment.com/forums/topic/69045-nightmare-fuel/#findComment-796013 Share on other sites More sharing options...
DarkXero Posted July 22, 2016 Share Posted July 22, 2016 19 minutes ago, GreatSound said: One more thing though can you make the garland hat infinite for my character AddPrefabPostInit("flowerhat", function(inst) if inst.components.perishable then inst:ListenForEvent("equipped", function(inst, data) local owner = data and data.owner if owner and owner.prefab == "wilson" then inst.components.perishable.updatetask:Cancel() inst.components.perishable.updatetask = nil end end) inst:ListenForEvent("unequipped", function(inst, data) local owner = data and data.owner if owner and owner.prefab == "wilson" then inst.components.perishable:StartPerishing() end end) end end) Replace "wilson" for your character. Link to comment https://forums.kleientertainment.com/forums/topic/69045-nightmare-fuel/#findComment-796016 Share on other sites More sharing options...
GreatSound Posted July 22, 2016 Author Share Posted July 22, 2016 9 minutes ago, DarkXero said: AddPrefabPostInit("flowerhat", function(inst) if inst.components.perishable then inst:ListenForEvent("equipped", function(inst, data) local owner = data and data.owner if owner and owner.prefab == "wilson" then inst.components.perishable.updatetask:Cancel() inst.components.perishable.updatetask = nil end end) inst:ListenForEvent("unequipped", function(inst, data) local owner = data and data.owner if owner and owner.prefab == "wilson" then inst.components.perishable:StartPerishing() end end) end end) Replace "wilson" for your character. thanks again Link to comment https://forums.kleientertainment.com/forums/topic/69045-nightmare-fuel/#findComment-796018 Share on other sites More sharing options...
GreatSound Posted July 22, 2016 Author Share Posted July 22, 2016 22 minutes ago, DarkXero said: AddPrefabPostInit("flowerhat", function(inst) if inst.components.perishable then inst:ListenForEvent("equipped", function(inst, data) local owner = data and data.owner if owner and owner.prefab == "wilson" then inst.components.perishable.updatetask:Cancel() inst.components.perishable.updatetask = nil end end) inst:ListenForEvent("unequipped", function(inst, data) local owner = data and data.owner if owner and owner.prefab == "wilson" then inst.components.perishable:StartPerishing() end end) end end) Replace "wilson" for your character. now it wont let me eat the nightmare fuel but it displays the option to eat it Link to comment https://forums.kleientertainment.com/forums/topic/69045-nightmare-fuel/#findComment-796019 Share on other sites More sharing options...
DarkXero Posted July 22, 2016 Share Posted July 22, 2016 7 minutes ago, GreatSound said: now it wont let me eat the nightmare fuel but it displays the option to eat it You DID NOT replace "wilson" in the first code, right? Link to comment https://forums.kleientertainment.com/forums/topic/69045-nightmare-fuel/#findComment-796020 Share on other sites More sharing options...
GreatSound Posted July 22, 2016 Author Share Posted July 22, 2016 13 minutes ago, DarkXero said: You DID NOT replace "wilson" in the first code, right? I did but the game changed it back to wilson -_- i'm fixing it now wait hold on i didnt change anything with the nightmare stuff okay i fixed it Link to comment https://forums.kleientertainment.com/forums/topic/69045-nightmare-fuel/#findComment-796021 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