playMaker

Author Topic: Make a pet hungry every 6 hours even the game is not on  (Read 4144 times)

nehz

  • Playmaker Newbie
  • *
  • Posts: 2
Make a pet hungry every 6 hours even the game is not on
« on: January 20, 2012, 09:58:42 PM »
How can i make a pet hungry every 6 hours?(real life time)
This includes the next time the player start the game, it will calculate how much time had passed since and for every 6 hours the hunger/food of the pet will will decrease by 10 from the global hunger value pre-set when the egg is hatch.

any help would be much appreciated.
 

elvis75k

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 97
    • nRender
Re: Make a pet hungry every 6 hours even the game is not on
« Reply #1 on: January 21, 2012, 09:49:21 AM »
searching the site for making custom actions i find some hints on how to access system date..
Animal crossing use this kind of variable and i love how it work.

https://hutonggames.fogbugz.com/default.asp?W351

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Make a pet hungry every 6 hours even the game is not on
« Reply #2 on: January 24, 2012, 04:35:09 AM »
Hi,

 Yes, you'll likely need to create some custom actions.

look at the following timespan class:
http://msdn.microsoft.com/en-us/library/system.timespan.hours.aspx


 1: store a datetime as frame of reference ( like the last time you have increased his hunger).
 2: on start, get the current time and store the difference between the current time and the frame of reference in a timespan class. then find out the number of hours elapsed you can then decrease the value by the number of hours.

if you need help to create the custom actions required for this, tell me and I'll do them.

 Bye,

 Jean

nehz

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Make a pet hungry every 6 hours even the game is not on
« Reply #3 on: January 24, 2012, 04:41:57 PM »
@ Jean:
Can you make the custom actions for me please?

Thank you for your assistance.

Mark_T

  • 1.2 Beta
  • Junior Playmaker
  • *
  • Posts: 72
Re: Make a pet hungry every 6 hours even the game is not on
« Reply #4 on: January 25, 2012, 01:32:19 AM »

Such an action might be really useful.
Would it be an OS specific action? Or it`s the same for every platform?
Thanks.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Make a pet hungry every 6 hours even the game is not on
« Reply #5 on: January 25, 2012, 03:19:08 AM »
Hi,

They would work on any platform ( I am pretty sure of that).

 I'll work on some actions for this. Remind me again sometimes next week if nothing come up before... running in all directions at the moment, so might slipped off my mind.

 Bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Make a pet hungry every 6 hours even the game is not on
« Reply #6 on: January 27, 2012, 07:00:16 AM »
Hi,

 Here is is:

http://hutonggames.com/playmakerforum/index.php?topic=1047.0

and I made a unitypackage with a working scene. This is just a proof of concept and more will need to be done for a fully working hunger system, but it deduce per hour, and store in the playerprefs settings so that if you stop and repen it will catch up and starve the right amount since the last time.

 Hopefully, that is what you are after. If you need any help or have question, don't hesitate.

Bye,

 Jean