lyria Posted May 26, 2012 Posted May 26, 2012 Hello! I want to implement "Jail" and a "Dead" mode in the game of mine. I am using a fresh installation of ezRPG. I am having a module I would want to be showed if the user is Dead or respectively in Jail. But I'm not sure where I should put the code where I make the redirection to the certain module if the criteria is filled, for example, if you are dead you would just want to have access to like Logout, dead module, etcetera. If I put the redirection in a hook i'd have a never ending circle of redirections, but if i rather assign a variable in the hook like IS_DEAD and then redirect in every module, wouldn't it be unnecsseary to have to place that code in every module?... If i place it in base module, i would not have any access at all to any module... So how do i make some sort of "Dead mode" when the user is dead (0 hp) i redirect him to some sort of dead module, and then i restrict him to certain modules, but some modules he should still have access to..? Thanks in advance Quote
Meloen Posted May 28, 2012 Posted May 28, 2012 I think you have 2 options: 1. Use a hook (positive of this: there's no escape possible, negative side (as you already mentioned) : on everything the player loads, it is being checked if he´s alive). 2. Activate the dead mode at the code where the player can actually die. So in your "attack" module (and everywere else where a player can die) you check if the player died and if he did, you active the mode. (positive of this: it'll save resources, negative side: risk of forgetting the check if you continue to develop your game over time) Quote
Aventro Posted May 30, 2012 Posted May 30, 2012 Agreed, set a variable in the Hook and then put a check on the different modules it would be unaccountable for a "Dead" user. You could add a function like IsDead() RedirectIfDead() or something similar and send the user to a certain destination. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.