sasukefan01234 Posted February 8, 2015 Share Posted February 8, 2015 basically i want to make it so an event is pushed when the character dies, this event will resurrect the player after 15 seconds, to give the player time to move away from place of death. i want to learn how to do this and if it is possible at all. The reason i want to make a character autorevive is to have him available to my friends who are newer to the game and dont like having to wait for a revive or having to walk to spawn (we play on endless) Link to comment https://forums.kleientertainment.com/forums/topic/50697-need-help-pushing-an-event-when-the-character-dies-and-becomes-a-ghost/ Share on other sites More sharing options...
Jjmarco Posted February 8, 2015 Share Posted February 8, 2015 @sasukefan01234, Use a scheduled task:-- Will apply to every playerAddPlayerPostInit(function(inst) if GLOBAL.TheNet:GetIsServer() then -- only host must run this inst:ListenForEvent("death", function() -- when players dies inst:DoTaskInTime(15, function() -- you can change the time (now 15 seconds) inst:PushEvent("respawnfromghost") -- push resurrection event after 15 seconds end) end) endend) 1 Link to comment https://forums.kleientertainment.com/forums/topic/50697-need-help-pushing-an-event-when-the-character-dies-and-becomes-a-ghost/#findComment-610987 Share on other sites More sharing options...
rezecib Posted February 8, 2015 Share Posted February 8, 2015 And if you want to change the generic "was resurrected by shenanigans!" message, you can use:inst:PushEvent("respawnfromghost", {source={name="your favorite reason"}})For me, this makes the message "rezecib was resurrected by your favorite reason." Link to comment https://forums.kleientertainment.com/forums/topic/50697-need-help-pushing-an-event-when-the-character-dies-and-becomes-a-ghost/#findComment-611076 Share on other sites More sharing options...
sasukefan01234 Posted February 9, 2015 Author Share Posted February 9, 2015 thank you for your responses guys, that was fast, but i have a question... Where am i supposed to add that function?I only want that event pushed when a certain character dies (EX. when anyone using willow dies wait 15 seconds and revive only willow. If any other player dies using any other character that isn't willow he cant push this event to get respawned and will have to be revived using official methods.) How can i make this a perk on a custom character (the one they will be using)? Link to comment https://forums.kleientertainment.com/forums/topic/50697-need-help-pushing-an-event-when-the-character-dies-and-becomes-a-ghost/#findComment-611235 Share on other sites More sharing options...
sasukefan01234 Posted February 9, 2015 Author Share Posted February 9, 2015 bump Link to comment https://forums.kleientertainment.com/forums/topic/50697-need-help-pushing-an-event-when-the-character-dies-and-becomes-a-ghost/#findComment-611288 Share on other sites More sharing options...
rezecib Posted February 9, 2015 Share Posted February 9, 2015 bump Do not bump your posts. AddPlayerPostInit is a modmain thing, but that would make this happen for every character. I think you want it just for your character, so you can just pull out the inner portion of that and put it in your character's master_postinit:inst:ListenForEvent("death", function() -- when players dies inst:DoTaskInTime(15, function() -- you can change the time (now 15 seconds) inst:PushEvent("respawnfromghost", {source={name="reason"}}) -- push resurrection event after 15 seconds end)end)You won't need the GetIsServer part if you put it there, because the master_postinit only runs on the server, anyway. Link to comment https://forums.kleientertainment.com/forums/topic/50697-need-help-pushing-an-event-when-the-character-dies-and-becomes-a-ghost/#findComment-611316 Share on other sites More sharing options...
KonnoMasaki Posted February 14, 2015 Share Posted February 14, 2015 Do not bump your posts. AddPlayerPostInit is a modmain thing, but that would make this happen for every character. I think you want it just for your character, so you can just pull out the inner portion of that and put it in your character's master_postinit:inst:ListenForEvent("death", function() -- when players dies inst:DoTaskInTime(15, function() -- you can change the time (now 15 seconds) inst:PushEvent("respawnfromghost", {source={name="reason"}}) -- push resurrection event after 15 seconds end)end)You won't need the GetIsServer part if you put it there, because the master_postinit only runs on the server, anyway. Now I've tried imputing this into a custom character I've been making for hours onw, and still can't get it to work... can anyone show me exactly how to enter this into the master_postinit? Link to comment https://forums.kleientertainment.com/forums/topic/50697-need-help-pushing-an-event-when-the-character-dies-and-becomes-a-ghost/#findComment-612934 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