Jump to content
MakeWebGames

Where should I make redirection?


lyria

Recommended Posts

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

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...