User Tag List

Results 1 to 5 of 5

Thread: Percentage of Counter

  1. #1
    No Products Registered

    Join Date
    Apr 2007
    Location
    Summerville, SC
    Posts
    58
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Percentage of Counter

    Hi, I'm still working on that RPG game and I was thinking of adding status effects (Poison, Paralysis, etc.) in a traditional turn-by-turn RPG battle. If, say, you are poisoned, every turn you'd have you get 10% of your health subtracted. Would there be a way for MMF2 to take whatever amount the counter for your health is and subtract exactly(Or about) 10% of that? Thanks.

  2. #2
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Percentage of Counter

    Multiply it by 1.10 for +10% and by 0.90 for -10%.

    EDIT: Round it (or floor or ceil it) after if you want whole numbers only.

  3. #3
    No Products Registered

    Join Date
    Apr 2007
    Location
    Summerville, SC
    Posts
    58
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Percentage of Counter

    How exactly do you round? I have taken your advice so far and it is working exactly as I wanted it. It works perfectly when I have it do 10% of 10 but when I make it 12 it turns into 1.2. I'd want it to round to the lesser amount to keep them whole numbers. I'd just need to know how to round it off. Thanks.

  4. #4
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Percentage of Counter

    Entering round([value]) into the expression editor should round the number to the nearest whole number. Similarly, floor([value]) and ceil([value]) will always round down and up, respectively.

  5. #5
    No Products Registered

    Join Date
    Jun 2006
    Location
    Land of raging rockets
    Posts
    1,231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Percentage of Counter

    You probably don't want to remove 10% of the counter's value, but 10% of the counter's maximum value - else the counter might never become 0 and it removes less every time:
    10 - 1.0 = 9 (9.0)
    9 - 0.9 = 8 (8.1)
    8 - 0.8 = 7 (7.2)
    7 - 0.7 = 6 (6.3)
    6 - 0.6 = 5 (5.4)
    5 - 0.5 = 5 (4.5)
    >> it will stop at 5!

    Now what you want is remove 10% of the maximum the counter can hold - e.g.:
    max_health = 50
    current_health = 34
    remove 10%:
    current_health = Round(current_health - max_health * 0.1)
    >> current_health = 29

    If you want roughly 10%, use the mighty random() function.
    Random(x) gives a number between 0 and x-1.
    soo... if you use
    Round(current_health - max_health * (Random(10) + 5) * 0.01)
    then you get something between 5% and 15%.
    Round(current_health - max_health * Random(20) * 0.01)
    gives you between 0% and 20%.

Similar Threads

  1. How to get the percentage of two counters?
    By Corlen in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 4th April 2012, 06:09 PM
  2. Cannot get percentage?
    By Dynamite in forum Multimedia Fusion 2 - Technical Support
    Replies: 18
    Last Post: 14th May 2010, 01:08 PM
  3. Percentage Question
    By scdlsam in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 22nd April 2007, 04:05 PM
  4. Percentage
    By dingdong in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 13th December 2006, 06:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •