ALBS - RPG Battle/Inventory System

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Message
Author
Counter Arts
Miko-Class Veteran
Posts: 649
Joined: Fri Dec 16, 2005 5:21 pm
Completed: Fading Hearts, Infinite Game Works
Projects: Don't Save the World
Organization: Sakura River
Location: Canada
Contact:

ALBS - RPG Battle/Inventory System

#1 Post by Counter Arts »

Currently I am programming an RPG battle system for ren'py. However, I over-engineered it a bit and made it so open ended. For my game it's a bit too much, however, other people may want to use it.

Mind you this is the engine, not the interface. And you program the turn-order and stuff like that yourself. I'll be making a basic one though.

Anyone interested in using it?
Last edited by Counter Arts on Fri Jan 05, 2007 8:25 am, edited 1 time in total.

User avatar
DaFool
Lemma-Class Veteran
Posts: 4171
Joined: Tue Aug 01, 2006 12:39 pm
Contact:

#2 Post by DaFool »

I'm definitely interested.

And if I can implement something like the Grandia battle system on it, I will worship you forever.

Counter Arts
Miko-Class Veteran
Posts: 649
Joined: Fri Dec 16, 2005 5:21 pm
Completed: Fading Hearts, Infinite Game Works
Projects: Don't Save the World
Organization: Sakura River
Location: Canada
Contact:

#3 Post by Counter Arts »

Actually I didn't know about the Grandia (III) battle system till I wikipedia'ed it. The system I had in mind is kinda like that only not so 3-D-ish. (Darn, I didn't know someone else thought of that system a long time ago.)

My idea includes that and inserting renpy scenes in the middle of battle. Also, I'm also trying to give options to do stuff like, think and talk. However, it would be far easier to just choose attack and just go crazy in fighting. You do get about 3 actions per turn though.

But if you're going to implement something like a Grandia battle system, you're doing the interface, battle mechanics and game balancing yourself. That's still a lot of work on your part.

Still, I'd be willing to share my system once I can water it down a bit.

jjsonick
Newbie
Posts: 16
Joined: Mon Jan 01, 2007 12:12 pm
Contact:

#4 Post by jjsonick »

I'd be really interested in this too. Having a battle system framework (even a very simple one) would likely guarantee I actually make a complete Ren'Py game. :D

Counter Arts
Miko-Class Veteran
Posts: 649
Joined: Fri Dec 16, 2005 5:21 pm
Completed: Fading Hearts, Infinite Game Works
Projects: Don't Save the World
Organization: Sakura River
Location: Canada
Contact:

#5 Post by Counter Arts »

Yeah, it started out as good programming but now as I started to over engineer it, I'll need to do water it down a bit.

I'll need to make it so that people who aren't programmers can use it. Of course, customization requires programming.

But I'll be crying when I see my beloved menu animation being overused. Oh well.

jjsonick
Newbie
Posts: 16
Joined: Mon Jan 01, 2007 12:12 pm
Contact:

#6 Post by jjsonick »

Well, I don't mind getting my hands somewhat dirty with programming -- I don't think at this point I'd be good building from scratch, but I think I could do some tweaking of code to suit my needs. It'd be worth it to have those systems. :)

bardsmanship
Regular
Posts: 41
Joined: Sat Jun 04, 2005 7:47 pm
Location: Singapore
Contact:

#7 Post by bardsmanship »

I'd like to have a look at this, too. I might just find some use for it.

chisa-chan
Regular
Posts: 197
Joined: Fri Nov 10, 2006 3:25 am
Location: at a village near Bandung, Indonesia
Contact:

#8 Post by chisa-chan »

Wow :D I bet this will be interesting.
I'll wait for this one.
Kalau tidak suka ya jangan diladeni, gitu aja kok repot™.
Cynanthia's Blog (Indonesian)

Counter Arts
Miko-Class Veteran
Posts: 649
Joined: Fri Dec 16, 2005 5:21 pm
Completed: Fading Hearts, Infinite Game Works
Projects: Don't Save the World
Organization: Sakura River
Location: Canada
Contact:

#9 Post by Counter Arts »

Well if you know the concept of passing a function as variable then you can tweak this code well enough I think. Though it is largely untested.

But this is really largely implemented in python.

I'll be making a very basic turn based system for you guys to expand upon to show you how to take advantage of the features of my system (and mostly interface). You'll even get to know how to use ren'py's interface system with style if you figure out my code!

- you go first
- enemies go second
- physical damage = attackPower - defensePower
- similar with magical damage
- you get one spell called heal

This will be in my sample code.

Counter Arts
Miko-Class Veteran
Posts: 649
Joined: Fri Dec 16, 2005 5:21 pm
Completed: Fading Hearts, Infinite Game Works
Projects: Don't Save the World
Organization: Sakura River
Location: Canada
Contact:

#10 Post by Counter Arts »

Alright! The battle portion of my code is finished. No documentation though.

I also made an interesting menu interface.

I'll give you my first uncut code for you to read and test. If you have ANY questions, please ask!

This python code has the flavour of a C++ programmer in it. A lot of habits that I gained from programming OS features in a university course are still within me. (Implementing memory paging, file systems as well as concurency is very painful)

Here is some sample code to run my ALBS (AL's Battle System).

Note: The pc and npc varibles are already initialized before this.

Code: Select all

label battle_begin:
    $ battle_result = 0 # 0=in progress 1 = userWon 2 = userLost
    "The battle has begun!"
    "Are you ready?"

    while battle_result == 0:
        call battle_Start_Turn
        
        $ temp1 = pc.stats.hp
        $ temp2 = pc.stats.maxHP
        $ temp3 = pc.stats.mp
        $ temp4 = pc.stats.maxMP
        "HP: %(temp1)s /%(temp2)s MP: %(temp3)s / %(temp4)s"
        
        $ menu1Text = "Attack with Bat"
        $ menu1Clicked = ui.returns("Attack")
        $ menu2Text = "Heal"
        $ menu2Clicked = ui.returns("Heal")
        $ menu3Text = "Magical Attack"
        $ menu3Clicked = ui.returns("Magic")

        show menu1 at menuIn1 with Pause(0.1)
        show menu2 at menuIn2 with Pause(0.1)
        show menu3 at menuIn3 with Pause(0.2)
        $ action = ui.interact()
        
        hide menu1
        hide menu2
        hide menu3
        
        if action == "Attack":
            $ temp = pc.rightEquip.use([npc, pc])
            $ print temp
        elif action == "Heal":
            $ pc.stats.hp += 10
        elif action == "Magic":
            $ temp = pc.ability.use([npc, pc])
        
        call checkFinished
        if battle_result != 0:
            jump battleFinished
        # Now the Enemy Attacks
        
        $ temp = npc.attacks(pc)
        $ temp2 = npc.name
        $ temp3 = pc.name
        "The %(temp2)s attacks %(temp3)s for %(temp)s damage"
        $ print temp
        call checkFinished
        
        label battleFinished:
        
    
    if battle_result == 1:
        "You win!"
    else:
        "You lose!"

    return
Attachments
battle demo.zip
Here is the first uncut code.
(96.01 KiB) Downloaded 211 times

User avatar
DaFool
Lemma-Class Veteran
Posts: 4171
Joined: Tue Aug 01, 2006 12:39 pm
Contact:

#11 Post by DaFool »

Although the moving buttons are cool, I'm thinking of just using a standard menu interface for consistency when integrating into my game (It's supposed to look primarily like a visual novel after all, not an RPG)
Also, I think I might want to add scenes in order to prolong the battle sequence, instead of just
""The Monster attacks You for X damage"

Counter Arts
Miko-Class Veteran
Posts: 649
Joined: Fri Dec 16, 2005 5:21 pm
Completed: Fading Hearts, Infinite Game Works
Projects: Don't Save the World
Organization: Sakura River
Location: Canada
Contact:

#12 Post by Counter Arts »

Yep, that's the idea behind this. You add your stuff like scenes.

I have a cleaner version of the code now. I'll upload it in a bit.

User avatar
DaFool
Lemma-Class Veteran
Posts: 4171
Joined: Tue Aug 01, 2006 12:39 pm
Contact:

#13 Post by DaFool »

Successfully integrated the engine into the game (success = no crashes and still proceeds to play the rest of my game). I took out the blue textbox, but other then that, it inherited the style options I set for the rest of my game. I think the whizzing buttons are neat, on second thought, so I decided to let them be.

I'd like to add scenes, but I don't know how to navigate around the ui statements. Anyone familiar with python, I'd appreciate some help. I hope that this won't affect rollback should it get messy.

Note I tried changing batswinging to shotgun firing in defining the statements, but messed it up, so I just changed what it says while keeping the definition terms as bat swinging, its essentially the same thing. The magical attack is defined in similar fashion, so I just need to know how to insert scenes or at least image sequences here.

Code: Select all

init:
    python:
                
        def batSwing(args):
            tempUser = args[ALBS_User]
            tempTarget = args[ALBS_Target]
            temp = tempTarget.recieveAttack(tempUser.stats.atk + 4)
            #ui.window()
            ui.text("You fire the shotgun!")
            ui.saybehavior(afm="You fire the shotgun!")
            ui.interact()
            #narrator "You fire the shotgun!"
            #ui.window()
            #I'd like to place a CG event here, but how?
            tempText = "You deal %d damage!" % (temp) 
            ui.text(tempText)
            ui.saybehavior(afm="You deal " + tempText + "damage!")
            #I'd like to place a second CG event here, but how?
            ui.interact()
            return temp
So how do I insert 2 CG events inside, what kind of show statements are needed?

Many thanks.

Counter Arts
Miko-Class Veteran
Posts: 649
Joined: Fri Dec 16, 2005 5:21 pm
Completed: Fading Hearts, Infinite Game Works
Projects: Don't Save the World
Organization: Sakura River
Location: Canada
Contact:

#14 Post by Counter Arts »


Lee_Hitsugaya
Regular
Posts: 115
Joined: Mon Apr 23, 2007 8:50 pm
Contact:

#15 Post by Lee_Hitsugaya »

I am new to Ren'Py but I'd love to use this form my Avatar RPG! Also it may be good for Star Trek: Valiant but I'll see once i get a look at it. So whenever you get it "watered down" as you say I'd love to see it. and i am no programmer so i will probably use the following smilie....alot...( :?: ) lol. THANKS IN ADVANCE!
in a perfect world those who can do it teach others how to do it. but were not in a perfect world. So were primarily stuck with teachers who don't kno jack.

Avatar: The Last Airbender Visual Novel forums

http://img509.imageshack.us/my.php?imag ... rekzs0.png

Post Reply

Who is online

Users browsing this forum: Amazon [Bot], Andredron, Google [Bot]