View unanswered posts | View active topics


Post a new topicPost a reply
Previous topic | Next topic 

  Beginner BeginnerMember since: 14.06.2012, 16:14Posts: 26 Likes: 0
 

 Post Topic: Hunger mechanic- can anyone solve this?
PostPosted 18.06.2012, 10:00 
Hi

I've been trying to add a hunger mechanic to the game. The idea is that a math:add, node, connected to a progress bar, adds 1 to a running total every x seconds. When the count reaches 100, the player is slowly damaged, until they eat 'food'- usable basic entities scattered across the map. Using one will cause it to disappear, and will subtract a certain amount from the running total.
I can't get it to work, however- look at the screenshot below. When I use the entity, I used the setnumber node to specify how much to subtract from the running total. The problem is that using the entity doesn't trigger the subtract sum- it just loops over and over as soon as I ctrl+g. Since it is taking away from 0, this causes a negative value, making the progress bar disappear.
Can anyone work out how to make using an entity trigger the math:sub node?
Attachments:

flowgraph2.jpg

User avatar   Uber Modder Uber ModderMember since: 20.01.2009, 02:39Posts: 1915Location: DFW, Texas Likes: 25
 

 Post Topic: Re: Hunger mechanic- can anyone solve this?
PostPosted 24.06.2012, 06:57 
Not the best choice for this application. what you need to do is use a GameToken. Set it to, say, "Int" mode and use the same method you already have (add/subtract numbers). GameTokens are more stable and reliable for in Game usage.
Look here for moar info
http://freesdk.crydev.net/display/SDKDOC2/Game+Tokens


Lead Flowgraph Designer, Binary Sword Pty Ltd
Flowgraphs? I'm your guy
Sarcasm is ON OFF
Quote by Lavizh:
Holy shitsticks. That's pure beauty!

Image
  Beginner BeginnerMember since: 14.06.2012, 16:14Posts: 26 Likes: 0
 

 Post Topic: Re: Hunger mechanic- can anyone solve this?
PostPosted 24.06.2012, 16:02 
Okay,

I started using gametokens. I'm a lot closer now, but there is still a problem. Every time I eat food the running total drops by 15, as it should, but then it goes straight back up to the number it was previously, and keeps counting from there.

Any ideas?
Attachments:

flowgraph3.jpg
User avatar   Uber Modder Uber ModderMember since: 20.01.2009, 02:39Posts: 1915Location: DFW, Texas Likes: 25
 

 Post Topic: Re: Hunger mechanic- can anyone solve this?
PostPosted 24.06.2012, 23:57 
Instead of Direct Modifying the token, try adding/subtracting for the hunger portion.


Lead Flowgraph Designer, Binary Sword Pty Ltd
Flowgraphs? I'm your guy
Sarcasm is ON OFF
Quote by Lavizh:
Holy shitsticks. That's pure beauty!

Image
  Beginner BeginnerMember since: 14.06.2012, 16:14Posts: 26 Likes: 0
 

 Post Topic: Re: Hunger mechanic- can anyone solve this?
PostPosted 25.06.2012, 10:25 
Well, I've tried doing that, but it's still not working. Part of the problem seems to actually be triggering the subtraction. I tried to use the set number node, but it seems to set the number at the start, rather than when the input is recieved.
Attachments:

flowgraph5.jpg