Frankenmoo

  • Content Count

    6
  • Joined

  • Last visited

 Content Type 

Profiles

Forums

Downloads

Klei Bug Tracker

Game Updates

Hot Lava Bug Reporter

Posts posted by Frankenmoo


  1. local function onhungerchange(inst, data)if inst.components.hunger:GetPercent() < DESIRED AMOUNT theninst.components.health:StartRegen(50, 5) elseinst.components.health:StopRegen()
    end
    end

    inst:ListenForEvent("hungerdelta", onhungerchange)

     

    I have yet to test this, and am too busy to test it at the moment. But it may work.

     

     

     

    So i essentially copied and pasted and i got an error to be specific when I introduced the last line that listens for the event 

     

    it says "attempt to index 'global' (nill value ) 

    local function hunger_heal (inst, data)	 	if inst.components.hunger:GetPercent() < 80 then 		inst.components.health:StartRegen(50,5)		else 	inst.components.health:StopRegen()	end endinst:ListenForEvent("hungerdelta", onhungerchange)

    I understand pretty much everything you wrote but what is "hungerdelta" i thought the event that is being listened for is on hungerchange so im confused on what is  "hungerdelta"

     

    Also is there a site that you can introduce me to that explains some of the things like Dodelta and inst is? Ive checked out the tutorials that the forums have but doesn't explains these things

     

    Thank you for everything 


  2. So I'm basically trying to make it so that every 5 seconds you get healed for 50 (test) if you are full. The problem is it does nothing and idk why

     

    local function hunger_heal (inst, owner)if (owner.components.health and owner.components.health:IsHurt()) and (owner.components.hunger and owner.components.hunger.current > 5  )theninst.task = inst:DoPeriodicTask(1, owner.components.health:DoDelta(50) )end end

    this is basically what im trying

     

    If you are hurt and are not hungry

     

    heal for 50 every second