Daily Bonus

dailyBonus1

This script provides a simple “daily bonus” mechanic, allowing players to receive bonus rewards once a day. It assumes that you can get a bonus on a new day, but you can write your conditions to use different periods if you want.

It is intended for offline games and uses the player’s system time to reward bonuses and to determine whether rewards can be rewarded.

In order to provide developers with more control over the rewards, script calls are provided. It is up to the developer to determine how to set it up for their game.

Download

Script: download here

Installation

Place this script below Materials and above Main

Usage

The following script calls are provided.

daily_bonus_available?

This checks whether you are eligible for daily bonuses, based on the current
day. The assumption is that you can only get rewards once a day, and so this
method returns true only if the day is different from the last recorded day.

update_bonus_time

This will update the time that the bonus was taken. You should call this
whenever a bonus is rewarded.

If “daily bonus” is not suitable, you can get the last reward time directly

last_reward_time

Which returns a Time object. You can then use this to check against the current
time.

Example

dailyBonus2

Suppose you decided to create an event that serves as the reward NPC. Use a variable to determine how many times you have received rewards.

You would have a conditional branch that checks whether login bonuses are available. If so, you would then go through a series of variable checks to determine which reward to give them.

Finally, you would call update_bonus_time to log the actual reward.

You may also like...

36 Responses

  1. Rithy says:

    Hi, i read your blog from time to time and i own a similar
    one and i was just curious if you get a lot of spam feedback?
    If so how do you protect against it, any plugin or
    anything you can recommend? I get so much lately it’s driving me mad so any help is very much appreciated.

  2. Margot says:

    Hello, just wanted to mention, I liked this blog post.
    It was inspiring. Keep on posting!

  3. Bucky says:

    Hey There. I found your blog using msn. This is
    a very well written article. I will be sure
    to bookmark it and return to read more of your useful info.
    Thanks for the post. I’ll definitely return.

  4. Marquez says:

    You really make it seem really easy with your presentation however
    I in finding this topic to be actually one thing which I think I would never understand.
    It seems too complicated and very large for me. I’m taking
    a look forward for your subsequent put up, I’ll attempt to get
    the grasp of it!

  5. Anda says:

    I’m impressed, I have to admit. Rarely do I encounter
    a blog that’s equally educative and engaging, and without a
    doubt, you’ve hit the nail on the head. The issue is something not enough folks are
    speaking intelligently about. I am very happy that I stumbled across this in my search for something regarding this.

  6. Shanetra says:

    An outstanding share! I’ve just forwarded this onto a
    co-worker who had been conducting a little homework on this.
    And he actually bought me breakfast due to the fact that I discovered it for him…

    lol. So allow me to reword this…. Thank YOU for
    the meal!! But yeah, thanx for spending time to talk about
    this matter here on your web site.

  7. Hagop says:

    Hey there! Do you know if they make any plugins to assist with SEO?
    I’m trying to get my blog to rank for some targeted
    keywords but I’m not seeing very good gains. If you know of any please share.
    Kudos!

  8. Chantale says:

    I am actually grateful to the holder of this web page who has shared this great article at
    at this time.

  9. Abagail says:

    My brother recommended I might like this blog. He was totally right.

    This post truly made my day. You can not imagine simply how much
    time I had spent for this info! Thank you!

  10. Jaramie says:

    I have read so many posts on the topic of the blogger lovers except this article
    is really a pleasant paragraph, keep it up.

  11. Honesty says:

    Hey there I am so glad I found your weblog, I really found you by accident,
    while I was researching on Askjeeve for something else, Nonetheless I am here now and would just like to say thanks a
    lot for a marvelous post and a all round entertaining
    blog (I also love the theme/design), I don’t have time to look over it
    all at the minute but I have book-marked it and also added in your RSS feeds, so when I have time I will be back
    to read more, Please do keep up the awesome work.

  12. Michelle says:

    Do you have a spam problem on this blog; I also am
    a blogger, and I was wanting to know your situation; many of us have developed some nice practices and we
    are looking to trade solutions with others, please shoot me an email if interested.

  13. Nashay says:

    Hi there, just became aware of your blog through Google,
    and found that it is really informative. I am gonna watch
    out for brussels. I’ll be grateful if you continue this in future.
    Many people will be benefited from your writing. Cheers!

  14. Tesia says:

    My family every time say that I am wasting my time here at web, but I know
    I am getting know-how daily by reading such fastidious content.

  15. Alyx says:

    Hi, i believe that i noticed you visited my weblog thus i came to
    go back the choose?.I am trying to in finding issues to improve my
    web site!I assume its good enough to make use of a few of your ideas!!

  16. Kash says:

    Hi, i read your blog from time to time and i own a similar one and i was just curious if you get a lot of spam comments?
    If so how do you protect against it, any plugin or anything you can suggest?

    I get so much lately it’s driving me insane so any help is very much appreciated.

  17. Elisheva says:

    Wow! In the end I got a web site from where I be capable of truly obtain useful facts concerning
    my study and knowledge.

  18. Chancy says:

    I’ve been browsing online more than three hours lately, yet I by no means discovered any
    fascinating article like yours. It is lovely worth enough for me.

    Personally, if all site owners and bloggers made good content material as you probably did, the net can be much more useful than ever before.

  19. Winn says:

    Way cool! Some very valid points! I appreciate you writing this post and also the
    rest of the site is also really good.

  20. Chiquetta says:

    Genuinely no matter if someone doesn’t know then its up to other users that they will
    assist, so here it takes place.

  21. Brendin says:

    hello there and thank you for your information – I have certainly picked up anything
    new from right here. I did however expertise some
    technical points using this web site, as I experienced to reload the website many times previous to I could
    get it to load correctly. I had been wondering if your hosting is OK?

    Not that I’m complaining, but slow loading instances times will very frequently affect your placement
    in google and can damage your high-quality score if ads and marketing with Adwords.
    Well I’m adding this RSS to my e-mail and could look out for
    a lot more of your respective interesting content. Make sure you update this again soon.

  22. Brittay says:

    Heya! I understand this is kind of off-topic however I had to ask.
    Does operating a well-established blog like yours take a lot of work?
    I’m brand new to running a blog but I do write in my journal daily.
    I’d like to start a blog so I can easily share my experience and thoughts online.
    Please let me know if you have any kind of ideas or tips for brand new aspiring
    bloggers. Thankyou!

  23. Benisha says:

    Very soon this web page will be famous among
    all blogging viewers, due to it’s pleasant articles or reviews

  24. Avian says:

    you’re in point of fact a just right webmaster. The website loading pace is amazing.
    It sort of feels that you’re doing any unique trick.

    Furthermore, The contents are masterwork. you have done
    a great task on this subject!

  25. Cornelious says:

    Hello there, I found your web site via Google while searching for a comparable
    subject, your site came up, it seems good.
    I have bookmarked it in my google bookmarks.
    Hi there, simply become aware of your weblog via Google, and found that it is truly
    informative. I’m going to be careful for brussels. I will be grateful if you continue this in future.

    Lots of other people will likely be benefited
    out of your writing. Cheers!

  26. Nyya says:

    Magnificent goods from you, man. I’ve understand your stuff previous to and you’re just too great.
    I actually like what you’ve acquired here, really like what
    you’re stating and the way in which you say it.
    You make it enjoyable and you still take care of to keep it wise.
    I can not wait to read far more from you. This is actually a great web site.

  27. Jassen says:

    Great site you have here.. It’s difficult to find quality writing like yours nowadays.
    I really appreciate people like you! Take care!!

  28. Byron says:

    Fantastic beat ! I wish to apprentice while you amend your site, how can i subscribe for a blog web site?

    The account helped me a acceptable deal. I had been a little bit acquainted of this your broadcast offered bright clear
    concept

  29. Tyron says:

    I like the helpful info you provide in your articles.
    I’ll bookmark your weblog and check again here frequently.
    I’m quite sure I will learn plenty of new stuff right here!
    Best of luck for the next!

  30. Delvin says:

    I have read a few excellent stuff here. Definitely value bookmarking for revisiting.
    I wonder how so much effort you place to create such a magnificent informative web site.

  31. Coolie says:

    I have 30 different conditional branches (one for each day) inside the conditional branch which asks if the player is eligible for a reward (daily_bonus_available?), and it is returning ALL of them as TRUE, even though those conditional branches are tied to a completely different thing (an in-game variable) and only one out of the 30 should be returned as TRUE.

  32. azurezero says:

    I get a cant compare to nil error when i call the conditional branch…

    • azurezero says:

      got it working but its a shame you cant get the first daily bonus immediately (it crashes if i hadnt called update once before the conditional)

      • Hime says:

        I’ve updated the script so that you can specify exactly how many seconds to wait before the next reward is available.
        So if you wanted the first reward to be offset by a certain amount of time after the game starts, just make the call

        update_bonus_time(seconds)

        And it should work.

  33. icesiul says:

    Hello there Hime.

    Once again, your work is awesome but I'm really noob on scripting so I'm pretty lost: how do you change the timer for the reward?

    I'm wondering if you were able to upload a master demo of your scripts or something like this (I guess a demo for each script is way too tiresome), since I can see how it works by my own more easily.

    Thanks in advance.

    • Hime says:

      The easiest way would be to find a script that allows you to compare two times and then use it in a scripted conditional branch.

      I don't provide that functionality in this script because that is not the purpose of the script.

Leave a Reply to Hime Cancel reply

Your email address will not be published. Required fields are marked *