dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: [F8] HELP T_T Turnbased RPG Battles

  1. #1
    Junior Member
    Join Date
    Dec 2007
    Posts
    9

    [F8] HELP T_T Turnbased RPG Battles

    Development of my RPG is going soothly until I hit a rather large snag...

    I'm basically not using an ATB system or having straight forward fixed turn orders in battle for the characters & enemies. Instead the order in which the characters take turns during battle is decided by their Speed Attribute.
    So... the character/enemy with the highest speed goes first, the one with the second highest goes next etc.

    Simply, I need help writing some sort of code which can be called at various points in the timeline that compares these Speed values and places character/enemy IDs in Order starting with the highest. A sort of Queue.

    This needs to be updated after everyone has had a turn in case some Speed reducing/enhancing spell/ability is used changing the order of turns for the next round.

    T_T i've asked a few friends and they mentioned stuff like forLoops and Arrays.. but i aint got a clue about those.

    Any help or pointing me in the right direction would be great... I just finished random battle script and sorted out Experience Points & Stats.... i just gotta work on the Battle system now.

  2. #2
    Junior Member
    Join Date
    Dec 2007
    Posts
    9
    Hmm... i'd been looking around and it seems Arrays might the way to go with this. I've even found some code that will sort the Array (comprised of Speed Values) into ascending number order.

    I just need to know how to grab the new sorted Array information using a variable for my order placement.

  3. #3
    Ryan :D ryanp321's Avatar
    Join Date
    Nov 2007
    Location
    Wallasey
    Posts
    292
    hey im sorry to do this
    but i dnt actually know a thing about arrays.
    but i was wondering.
    would you mind sharing how you did the random encounters?
    im reli interested to know.
    if not dnt worry.
    sorry i cant help you out

  4. #4
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,379
    A linked list is the best bet. Push all enemies/allies into an array, and then use the sort array class function to sort them in descending order. But then of course you'll have to have another list of the enemies/allies themselves, which is set in the same order as the array of speed attributes.

  5. #5
    Junior Member
    Join Date
    Dec 2007
    Posts
    9
    Thanks very much for your replies. I sorta know where Iam going with this now... i hope.

    Um... I did random battles in the simplest way possible- a basic counter/timer which starts when a movement key is pushed down (when in overworld mode) and stops when a key is released.
    When the player enters the area or after an encounter ends a random number between a range like 50-500 is chosen. When the counter reaches that number, boom!! the player head jumps to a new frame on the timeline.
    You might want to consider this number range, ive done some research and it seems the thing that most people hate about random battles is when theyre in a dungeon doing a puzzle and it keeps interupting them. So.. its a good idea to control this range in different areas. I even have the script in the same keyframe to control the level & type of monsters which are encountered.

  6. #6
    Ryan :D ryanp321's Avatar
    Join Date
    Nov 2007
    Location
    Wallasey
    Posts
    292
    would you mind if i could have like, a preview ?
    of your script.
    If used all credit would go to you like,
    just so i can see the things i'm guna have to go through to get it.
    Please and thanks anyway

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center