whismerhill Posted April 4, 2016 Share Posted April 4, 2016 hi, for the purpose of making a character levelup from monster kills, I was thinking of listening for death events. This is completely new territory however so I'm a bit lost.I was thinking of something like this in my character.lua : local function ondeathawardxp(inst,cause,afflicter) -- how to add event handlers -- "entity_death", data = { inst = deadthing, cause = cause, afflicter = afflicter } end self:ListenForEvent("entity_death", ondeathawardxp, getworld()) Link to comment https://forums.kleientertainment.com/forums/topic/66066-levelupxp-system-on-death-event/ Share on other sites More sharing options...
Mobbstar Posted April 4, 2016 Share Posted April 4, 2016 It's probably easier to listen for the "killed" event, which pushes straight from your character instance. local function awardxp(inst,data) --calculate xp --give xp to player --check levelup end inst:ListenForEvent("killed",awardxp) Link to comment https://forums.kleientertainment.com/forums/topic/66066-levelupxp-system-on-death-event/#findComment-744302 Share on other sites More sharing options...
whismerhill Posted April 4, 2016 Author Share Posted April 4, 2016 haaaa, thanks a lot sidequestion, is there a list of those events somewhere ? Link to comment https://forums.kleientertainment.com/forums/topic/66066-levelupxp-system-on-death-event/#findComment-744345 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