User Tag List

Results 1 to 10 of 10

Thread: Iterations

  1. #1
    No Products Registered

    Join Date
    Aug 2008
    Location
    Sweden
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Iterations

    One of the wonders of programming is the ability to write loops

    For example a loop that would scan through two indexed variables and add the values together in a third indexed variable is a piece of cake.

    Doing this should be possible in MMF, but how would i pull it off?

  2. #2
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Jaffob's Avatar
    Join Date
    May 2008
    Location
    USA
    Posts
    1,833
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Iterations

    Fast loops are exactly what you want.

    Under the Special Object, go to the "Fast Loops" submenu and choose "Start Loop". Enter the loop name and the number of times to run the loop. Then using the "On Loop" condition (also Special Object), you can create an event to be run on the loop. Example:

    Start of Frame:
    -Start Loop "Example" 100 times

    On Loop "Example":
    -Add 1 to Counter

    Assuming the counter started at 0, the counter would now read 100.

    Hope that helps.

  3. #3
    No Products Registered

    Join Date
    Aug 2008
    Location
    Sweden
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Iterations

    Thanks. That's just what i was looking for :3

  4. #4
    No Products Registered

    Join Date
    Aug 2008
    Location
    Sweden
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Iterations

    Ok. I've been thinking about this but unable to try it out seeing as i haven't gotten hold of MMF2 yet. Therefore no testing has been done.

    I'm planning on making a game and for that i need a very specific feature. I'm working on an RPG battle system that requires a set of variables (or counters) to increment with a specific value until one of the counters hits the maximum value.

    Right now it's just in planning stages so i'm just writing the specifications. Unable to try anything out without MMF2 in my hands.

    Here's a detailed explanation of my problem:


    I have a set of variables. One variable for each character and enemy in the battle. At the start of the battle these are all set to ZERO.

    Then a loop starts. In this loop, it goes through every variable and adds a value to it (value depends on speed rating of the character). This loop repeats UNTIL one of the variables has reached the max value (1000).

    Now it opens up an input menu, and the character (or monster) whose variable hit 1000 is free to take one action. That character's variable is now set to ZERO and the loop is called again.

    This is pretty much exactly how the battle system in Final Fantasy X works.

  5. #5
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Jaffob's Avatar
    Join Date
    May 2008
    Location
    USA
    Posts
    1,833
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Iterations

    Why can't you simply test for which character/enemy has the highest variable? That object is going to be the one to reach 1000 first, right?

  6. #6
    No Products Registered

    Join Date
    Aug 2008
    Location
    Sweden
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Iterations

    Quote Originally Posted by Jaffob
    Why can't you simply test for which character/enemy has the highest variable? That object is going to be the one to reach 1000 first, right?
    That does not work, because the system is based on variable speeds and a sequence. That is, each turn is not reset, if that was the case the fastest character would always be the one to act OR act first. That is not how this system works.

    I will draw it out for you:

    http://i6.photobucket.com/albums/y207/KGanryuS/meters.jpg

    This means if a character is twice as fast as another, that character will get to act twice in the time it takes the slower character to act once.

  7. #7
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Jaffob's Avatar
    Join Date
    May 2008
    Location
    USA
    Posts
    1,833
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Iterations

    Okay, now I understand.

    Add all the characters/enemies to a qualifier (Select all chars/enemies, go to the Events tab in properties, edit the qualifiers, and add to a group). Let's say you pick Group.Good.

    Each of Group.Good will have three alterable values named ID, Current, and Speed. Note that ID will have to be an alterable value that no other objects have, maybe C or D.

    Start of Frame:
    -Group.Good: Spread Value 0 in ID

    (Place here the condition(s) needed to run a turn)
    -Start Loop "Turn" NObjects("Group.Good") times

    On Loop "Turn"--
    Select Objects in reference to their alterable value (alterable value letter of ID):
    -Group.Good: Add Speed("Group.Good") to Current


    This will add the nessacary values to "Current". Hope that helps.

  8. #8
    No Products Registered

    Join Date
    Aug 2008
    Location
    Sweden
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Iterations

    Thanks. However, that's not the main issue here. I know how i would actually distribute the values and how to write the loop. The real problem is that i need to somehow make the loop stop when one character reaches max stat.

  9. #9
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Jaffob's Avatar
    Join Date
    May 2008
    Location
    USA
    Posts
    1,833
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Iterations

    Try adding:

    On Loop "Turn" --
    Select Objects in reference to their alterable value (alterable value letter of ID) --
    Current of Group.Good >= 1000
    -Stop Loop "Turn"
    -(Open Menu)

    (Menu is finished):
    -Start Loop "Turn" NObjects("Group.Good") times

    Does this work?

  10. #10
    No Products Registered

    Join Date
    Aug 2008
    Location
    Sweden
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Iterations

    Oh nice. Thanks! I'll that out as soon as i get my order :3

Posting Permissions

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