Support » Plugin: WordPress RPG » Need Help on Cron Jobs

  • Resolved FataLogic


    I have been using WP3.9 and I have tested installing this plugin. I also installed the attack module. So far, I have problem modifying the EXP needed to to reach certain level, modifying the attack damage calculation, modifying the HP progress, and modifying the effect of the action. But these can wait~~

    What I have been wondering is how to set up the Cron Jobs for HP replenishment. I set the plugin to default so that the HP is recovered by 1 for every 30 minutes, but it doesn’t work.

    PS: would be nice if I can set limit on how many times a person can attack, may be some kind of “energy”

Viewing 15 replies - 1 through 15 (of 23 total)
  • He’s currently working on the XP problems and I’m testing those for him, they should be released soon.

    As for the HP replenish I noticed it doesn’t work myself. There’s also currently a limit to how many times you can attack on person for a day.

    Cron job is usually something that’s set up in the cpanel, but nowadays, I don’t think you have to do cron jobs from cpanel anymore. I am thinking that you could actually tell the cpanel to do cron job on a PHP file to replenish the HP….

    Ah! I didn’t notice that there is already a limit to how many times you can attack someone for a day! It would be nice if I could edit that….

    I will be happy to test and help out as much as I can.
    I think it is indeed a good project.
    SMF,PHPBB, etc have RPG plugin already, it is time for wordpress to have one too!

    What’s your website you’re testing it on, we can work together for ideas and testing.

    Plugin Author Tim


    Cron Jobs with wordpress are fundamentally different. I’ve set this plugin up to use the same cron system that WordPress uses (wp-cron). To create the native Linux Cron job, you’d have to make a custom PHP function yourself that calls the MySQL Query. You could base it off of the HP Replenish call itself as it’s just a simple “Increase Everyone’s HP except those over 100”

    I put the game test there~~ as you can see there, even after 30 minutes, the HP doesn’t replenish….
    please share your website too if you are testing it, would like to see some reference here~~ thanks!


    thanks for your answer~~

    about this wp-cron function, which part of the wordpress-rpg.php code that corresponds to this function? is it this part?:

    public function wpRPG_RegisterSettings() {
            // Add options to database if they don't already exist
            add_option('wpRPG_rpg_installed', "0", "", "yes");
            if (get_option('wpRPG_last_cron') == null) {
                update_option('wpRPG_last_cron', time());
            } elseif (get_option('wpRPG_last_cron') == false) {
                add_option('wpRPG_last_cron', time(), "", "yes");
            if (get_option('wpRPG_next_cron') == null) {
                update_option('wpRPG_next_cron', (time() - (time() % 1800) + 1800));
            } elseif (get_option('wpRPG_next_cron') == false) {
                add_option('wpRPG_next_cron', (time() - (time() % 1800) + 1800), "", "yes");
            // Register settings that this form is allowed to update
            register_setting('rpg_settings', 'wpRPG_rpg_installed');
            register_setting('rpg_settings', 'wpRPG_last_cron');
            register_setting('rpg_settings', 'wpRPG_next_cron');

    He corrected the HP replenish and it should be updated soon.


    I installed the hospital module and for some reason I can not activate it. I thought it is still in development LOL.

    how do you activate that Hospital function in your blog?

    Plugin Author Tim


    Hospital, Registration, and Profiles come native right now in the 1.0.6+ versions of wpRPG. As long as wpRPG is activated, the hospital is activated.
    add [wprpg_hospital] to a page to create a Hospital.
    [view_profile] creates a Profile page
    [list_players] to list all players.

    Tested the newest version, and here is what happened to me:
    1. I make new pages under my “GAME” page, made “FIGHT” page with [list_players] under “GAME” , made “HOSPITAL” page with [wprpg_hospital] under “GAME”, made “PROFILE” page with [view_profile] under “GAME”

    And turns out it doesn’t work.

    2. I tried going to my wp-admin, and then went to wp-rpg setting module to change the Profile page, but it doesn’t want to change to my “PROFILE” page, it keeps coming back to “GAME” instead of “PROFILE”

    Plugin Author Tim


    I cannot reproduce your issue FataLogic. My test site which only uses updates directly from WP Repos that you guys have access too, doesn’t have such an error. Nor does dblegendz have the issue on his site.
    This leads me to believe that there’s another issue at bay. It’s redirecting back to this page for no reason that wpRPG can explain. Since even going to /game/SomeString redirects back to this page too. There’s no code in the hospital or profile to deal with or modify url querys or redirects. I could possibly assist by taking a look if you were to create a temporary account that gives me Page editor abilities, but the call is yours to make. Otherwise I’d say relook and debug your 404 redirect errors to see if it may not be my plugin but another issue you may have.

    I myself believe that this is actually the problem with my template theme. Soooo what I did:
    1. Deleted every child page of “Game”
    2. Created “parent page” for “fight” with [list_players], “hospital” with [wprpg_hospital], and “info” with [view_profile]
    3. Put the fight, hospital, and info links on “Game”

    It works now, but for some reason there is nothing yet for hospital and info in my case

    And ah! The HP replenishment works now. Just that…it also add 1 life to the ones with maximum HP~~

    Plugin Author Tim


    reconfirm for me that you have the latest 1.0.10. I believe there was an issue with 1.0.9 not publishing to the WP Repo though I had the Tag updated on the SVN on my end :/. But as of right now it appears the website is showing 1.0.10. (.9 had the HP Fix that Legendz mentioned earlier). The error being that it was updating everyone that had >100 HP rather than <100 😛

    As of right now (5:09PM EST) looking at your hospital the Hosptial does appear (message stating “You’re Already Fully Healed! Come Back When You Need Help!” and your Fight page shows all names.

    BUT…for some reason you have the Player Info’s redirecting to “; which I have to assume is coded on your half, as I use jQuery currently until I can fix and get a hang of the WP-Rewrites.

    Ah, indeed I was still using the version that’s less than 1.0.10! You update it real fast!~~

    Now let’s see if the HP replenishment works fine~~:D (will report back to you).

    About the redirection to “;: Hmmm, I didn’t code it that way. I will go code it and remove the “/wp-admin” part then, but not sure where (which file) I should look for it, let’s see if I can find the file and edit it myself:P

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘Need Help on Cron Jobs’ is closed to new replies.