Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Help With RPG
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
dehoogrules




PostPosted: Fri Dec 13, 2002 10:06 pm   Post subject: Help With RPG

Hey everyone, I need a little help with an RPG I'm making as a final project for my programming class. I want to do a Final Fantasy style RPG (I mean the original). I have the images I need, and the music, but I'm not sure how to make the battle code work. Can anyone help me out? The project's due Thursday.

Just so you know, I'm using OOT 3.11. My school has 4.0.1, but I don't have it at home.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sat Dec 14, 2002 3:24 am   Post subject: (No subject)

that would greatly depend on the battle system you're going to have.

check out our FTP site ftp://swat@danco.no-ip.com/Turing/ we got 2 RPG games done in turing avialable to give you ideas. QFTB is done by Dan and is really good, not sure if it has a battle system though. Another one, done by Krishon has a simple battle system. If you're really stuck, you can get ideas there.


Some random things to think about:
how will characters take turns?
what options will be there for attack?
how do they attack?
how does enemy react?
etc.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
dehoogrules




PostPosted: Sat Dec 14, 2002 11:48 am   Post subject: (No subject)

Well, if you've ever played the original Final Fantasy for NES, then you would know what I'm trying to mimic. Each character (There are 4) has four attacks to choose from, via probably a case statement. One of these attacks, the best one, can't be done until two turns have been taken (gonna keep track of that with an int var). All 4 characters turns are decided, and then they attack in a random order. The monster will also be added to that order. It will have four attacks too, chosen by randint. Attacks do damage with randint too.
Dan




PostPosted: Sat Dec 14, 2002 9:11 pm   Post subject: hi

well QFTB dose have a btale sytem very simeral to what you whont but with one player and they only start with one spell and can go up to like 6. QFTB is made for turing 3.1.1 and you shode be carfule becuse 3.1.1 and 4.0.1 are quite difrent, like there are not sprints in 4.0.1. i whode sugested doing most of it at school busces you coude get some BIG bugs if you do it in difrent vesrions of turing.

as for ideas for rpgs, i fownd that if you look for a progame claed rpg maker 2000 or somting like that on the net you will also find a lot of ideas, pics, muscik, chaters, batter sytem ideas and much more with sites for the rpg maker. altho the rpg maker will not do you any good due to the fact you are doing it in turing. they probley even have good pics to use for a Final Fantasy like game.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
azndragon




PostPosted: Sat Dec 14, 2002 11:27 pm   Post subject: (No subject)

I have a battle system that's over 2000 lines long. It has attack, defend, item (incomplete), skills, and run. It also have a level up, and skill level up system, complete with item drops, and gold findings. But I spent so much time on it, so I probably wouldn't give it to anyone, and I guess there's no point in posting it here, but oh well Rolling Eyes
Tony




PostPosted: Sun Dec 15, 2002 1:40 am   Post subject: (No subject)

thx for sharing your thoughs with us...

Battle systems can be complex... as azndragon said, it took him 2000 lines of code.

So if you're out of time (and can't type up 2000 lines of code in a day...) then just go with simple stuff like static attack. Actually by eliminating options, you can put together a BASIC fight system VERY fast.

Here's sample battle system

code:

%VARIABLES
var myHP : int := 100
var myATT : int := 10
var danHP : int := 50
var danATT : int := 7

%FIGHTING
loop
danHP:= danHP - myATT
put "Tony attacks for ", myATT, " Dan's life is now ", danHP
if danHP <=0 then
put "Dan died"
exit
end if
myHP := myHP - danATT
put "Dan attacks for ", danATT, " Tony's life is now ", myHP
if myHP <=0 then
put "You died, game over"
return
end if
end loop


You can add a bit of variety to it by having a random myATT between min and max values of the weapon.

Then at the beginning of each loop you can ask if you want to run away or use an item

code:

get answer
if answer = "run" then
exit
elsif answer = "potion" and potioncount >0 then
myHP := myHP +10
end if
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
krishon




PostPosted: Sun Dec 15, 2002 1:15 pm   Post subject: (No subject)

if u want to have moving characters and stuff, turing 3.01 is the better version. Since it has sprites, u can use them to move around and collect items. I suggest u look at Dan's QFTB game, as it is a perfect example
azndragon




PostPosted: Sun Dec 15, 2002 5:21 pm   Post subject: (No subject)

What I like to do, is have a Rand.Int (1,5) after every attack, because it adds some randomization to the damage. Some other things you might want to consider are weapon powers, weapon bonuses, and critical hits. I kinda took a bit of every RPG I've ever played, but I can't really go on with the game, until I figure out how to get that stupid saving feature to work Rolling Eyes

krishon wrote:
if u want to have moving characters and stuff, turing 3.01 is the better version. Since it has sprites, u can use them to move around and collect items. I suggest u look at Dan's QFTB game, as it is a perfect example


So if I wanted to add sprites to my RPG, I would have to use Turing 3? Oh well, I'll add that sometime later, my game's text-based, I'm still new to this, I learned basic Turing in class on November 29, so I still have A LOT to learn. Like procedures..hehe..before I knew how to use that, I had to copy the battle system over and over in each battle, it was a pain. Laughing

I'm gonna go post part of my battle system, so others can see it. It only has the attack command, for simplicity reasons:
code:

put "********************************************************************************"
put "                            Fight against ", monster, ""
put "********************************************************************************"
put ""
put "HP: ", character_currenthp, "/", character_maxhp, ""
put "MP: ", character_currentmp, "/", character_maxmp, ""
put ""
put "Weapon: ", character_weapon, ""
put "Armor: ", character_armor, ""
put "Helm: ", character_helm, ""
put "Shield: ", character_shield, ""
put ""
put "You are now ready for combat. The ", monster, " is also ready. You go first."
loop
    loop
        put "What do you do?"
        put ""
        get battle_command

        if battle_command = "Attack" then
            battle_command := "Attack"

        elsif battle_command = "attack" then
            battle_command := "Attack"

        elsif battle_command = "Skill" then
            battle_command := "Skill"

        elsif battle_command = "skill" then
            battle_command := "Skill"

        elsif battle_command = "Magic" then
            battle_command := "Magic"

        elsif battle_command = "magic" then
            battle_command := "Magic"

        elsif battle_command = "Defend" then
            battle_command := "Defend"

        elsif battle_command = "defend" then
            battle_command := "Defend"

        elsif battle_command = "Item" then
            battle_command := "Item"

        elsif battle_command = "item" then
            battle_command := "Item"

        elsif battle_command = "Run" then
            battle_command := "Run"

        elsif battle_command = "run" then
            battle_command := "Run"

        else
            battle_command := "Repeat"
            put "Invalid command. Please select another."
        end if
        exit when battle_command not= "Repeat"
    end loop

    if battle_command = "Attack" then %User has selected attack
        skill_damage := 0
        spell_damage := 0

        loop
            put ""
            put "What would you like to attack? Your choices are:"
            put ""
            put "", monster, ""
            get battle_command : *
            if battle_command = monster then
                chance_to_hit := weapon_chance_to_hit + character_dexterity + character_level + Rand.Int (1, 100) %Calculate player's chance to hit

                if character_status = "Concentrate" then
                    chance_to_hit := chance_to_hit * 2
                end if

                if day_status = "Night" then
                    chance_to_hit := chance_to_hit div 2
                end if

                if character_status = "Owl's Eye" and day_status = "Night" then
                    chance_to_hit := chance_to_hit * 2
                end if

                chance_to_dodge := monster_agility + monster_level + Rand.Int (1, 10) %Calculate monster's chance to dodge

                if chance_to_hit >= chance_to_dodge then     %Sucessful Hit
                    if weapon_type = "Bow" then
                        attack_damage := character_dexterity + weapon_modifier
                    else
                        attack_damage := character_strength + weapon_modifier %Calculate max player damage
                    end if

                    attack_damage := attack_damage - monster_vitality     %Calculate damage reduction
                    critical_hit := Rand.Int (1, 32) + (character_luck div 3)   %Calculating chances of critical hit

                    if critical_hit >= 32 then     %Sucessful critical hit
                        attack_damage := attack_damage * 2
                    else     %Normal hit
                        attack_damage := attack_damage * 1
                    end if

                    critical_dodge := Rand.Int (1, 32) + (monster_luck div 3)    %Calculating chances of critical dodge

                    if critical_dodge >= 32 then     %Sucessful critical dodge
                        attack_damage := attack_damage div 2
                    else     %Normal hit
                        attack_damage := attack_damage div 1
                    end if

                    attack_damage := attack_damage + Rand.Int (1, 5)    %Varies the damage done
                    attack_damage := attack_damage + weapon_bonus %Adds attack bonuses, like +1
                    if character_class = "Fighter" and weapon_type = "Sword" then
                        attack_damage := attack_damage + 2
                    elsif character_class = "Monk" and weapon_type = "Fist" then
                        attack_damage := attack_damage + 2
                    elsif character_class = "Thief" and weapon_type = "Dagger" then
                        attack_damage := attack_damage + 2
                    elsif character_class = "Mage" and weapon_type = "Staff" then
                        attack_damage := attack_damage + 2
                    elsif character_class = "Archer" and weapon_type = "Bow" then
                        attack_damage := attack_damage + 2
                    end if

                    if attack_damage < 1 then
                        attack_damage := 1
                    end if

                    if critical_hit >= 32 then     %Displays critical hit
                        put ""
                        put "Critical hit!"
                        put "You attack the ", monster, ", and strike it's weak spot, dealing ", attack_damage, " damage!"

                    elsif critical_dodge >= 32 then     %Displays critical dodge
                        put ""
                        put "Critical dodge!"
                        put "You attack the ", monster, ", but you merely graze the monster, dealing ", attack_damage, " damage!"

                    elsif critical_dodge >= 32 then
                        if critical_hit >= 32 then
                            put ""
                            put "You attack the ", monster, " for ", attack_damage, " damage!"
                        end if
                    else
                        put ""
                        put "You attack the ", monster, " for ", attack_damage, " damage!"
                    end if
                else
                    put "You miss the monster."
                    attack_damage := 0
                end if
            else
                put "Invalid Target"
                battle_command := "Repeat"
                attack_damage := 0
            end if
            exit when battle_command not= "Repeat"
        end loop

        if character_skill = "Double Attack" then
            double_attack := character_skill_level * 5
            if double_attack >= Rand.Int (1, 100) then
                put "You attack the ", monster, " again for ", attack_damage, " damage!"
                monster_hp := monster_hp - attack_damage
            end if
        elsif character_skill2 = "Double Attack" then
            double_attack := character_skill2_level * 5
            if double_attack >= Rand.Int (1, 100) then
                put "You attack the ", monster, " again for ", attack_damage, " damage!"
                monster_hp := monster_hp - attack_damage
            end if
        elsif character_skill3 = "Double Attack" then
            double_attack := character_skill3_level * 5
            if double_attack >= Rand.Int (1, 100) then
                put "You attack the ", monster, " again for ", attack_damage, " damage!"
                monster_hp := monster_hp - attack_damage
            end if
        elsif character_skill4 = "Double Attack" then
            double_attack := character_skill4_level * 5
            if double_attack >= Rand.Int (1, 100) then
                put "You attack the ", monster, " again for ", attack_damage, " damage!"
                monster_hp := monster_hp - attack_damage
            end if
        elsif character_skill5 = "Double Attack" then
            double_attack := character_skill5_level * 5
            if double_attack >= Rand.Int (1, 100) then
                put "You attack the ", monster, " again for ", attack_damage, " damage!"
                monster_hp := monster_hp - attack_damage
            end if
        end if



and then after this, it goes on with the other battle commands, like skill, item, etc.

One thing, notice how in the top, I have:

code:

if battle_command = "Attack" then
            battle_command := "Attack"

        elsif battle_command = "attack" then
            battle_command := "Attack"


Is there a way to set it up so that it can be simplified so that it's not case sensitive? For example, if someone typed in attacK, Turing would crash, unless I specifically had Turing look for that command.

Another thing, is there a limit to how big a file is before you can indent it? My RPG won't indent, it says "Not enough memory to indent file". Is that a problem with the file size, or my RAM?
krishon




PostPosted: Mon Dec 16, 2002 7:52 pm   Post subject: (No subject)

well, for the attacK thing, like in my rpg, just put a loop statement around the fighting area. therefore if the person screws up, it will just loop and go back to the screen b4
azndragon




PostPosted: Mon Dec 16, 2002 9:13 pm   Post subject: (No subject)

krishon wrote:
well, for the attacK thing, like in my rpg, just put a loop statement around the fighting area. therefore if the person screws up, it will just loop and go back to the screen b4


Well, I have loops everywhere, such as when you mess up on the initial command, the skills/magic/item, and the monster name. It was pretty hard to organize in the beginning, but now it's almost a second nature for me to include loops, because my program is case-sensitive.
Tony




PostPosted: Mon Dec 16, 2002 9:19 pm   Post subject: (No subject)

ya, I should try to remember to make the "not-case sensative input" DLL for you guys some time... I just don't have much time now Confused

Also, I still want an opinion if you guys think it would be reasonable to "sell" DLL files for turing. Such as files that would allow you to have input that is not case sensative or do some other cool stuff like text effects I got in source-code topic. Since i know that there're 3rd party companies that sell functions for programming languages as VB or C++.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
dehoogrules




PostPosted: Wed Dec 18, 2002 6:46 pm   Post subject: (No subject)

I've got it all figured out now, and the battle system is complete. If I had more time, I would have implemented more than an intro movie, a battle, and an ending movie, but I'm strapped for time, and I still have to do both movies...Thanks for the help. Maybe I'll post some of my code later.
krishon




PostPosted: Wed Dec 18, 2002 8:32 pm   Post subject: (No subject)

ic, good work!!! u should add tony to ur msn list if u have msn, so u can send ur files to him through there. Then tony can post it up on the website and give it a review.
Dan




PostPosted: Wed Dec 18, 2002 8:47 pm   Post subject: well.....

if you whont to subit your game you can:

1. send it to my or tonys e-mail

2. send it to me or tony throw msn

3. wate a few moths for me to add an upload thingy to the site.


any way if you do whont to submit it ziping whode be a good idea if there are more then one file.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 14 Posts ]
Jump to:   


Style:  
Search: