RPG Battle Engine - Alpha 7.5, downloads in first post

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Message
Author
User avatar
DesertFox
Regular
Posts: 196
Joined: Sun Jul 28, 2013 1:29 pm
Completed: Over The Hills And Far Away
Projects: My Little Dictator
Organization: WarGirl Games
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#211 Post by DesertFox » Tue Sep 24, 2013 3:51 pm

---
Last edited by DesertFox on Sun Nov 04, 2018 5:01 pm, edited 1 time in total.

User avatar
Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#212 Post by Jake » Mon Oct 07, 2013 8:32 pm

DesertFox wrote: When are you planning to release?

I have one or two more queries, mainly about customization. Should I wait or are you okay to answer them now?
Unfortunately, my day job and other paying work has to take priority - so as to when the next version will be released, the answer is "when it's done". I'm looking forward to getting back to it and finishing it off, but I can't say with any certainty when that will be... so go ahead, ask away and I'll answer as best I can in the context of the currently-released version.
Server error: user 'Jake' not found

User avatar
azureXtwilight
Megane Procrastinator
Posts: 4087
Joined: Fri Mar 28, 2008 4:54 am
Completed: Fantasia series (ROT and ROTA), Doppleganger: Dawn of The Inverted Soul, a2 (a due), Time Labyrinth
Projects: At Regime's End
Organization: Memento-Mori VNs, Team Sleepyhead
Location: Yogyakarta, Indonesia.
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#213 Post by azureXtwilight » Sun Oct 13, 2013 11:17 pm

I am wondering if there's a way to "unlearn" a skill under a certain "if" condition?
Image

User avatar
Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#214 Post by Jake » Mon Oct 14, 2013 2:55 am

azureXtwilight wrote:I am wondering if there's a way to "unlearn" a skill under a certain "if" condition?
To remove a skill from a fighter in the current build, you should be able to call:

Code: Select all

myFighter.UnregisterSkill(mySkill)
Bear in mind that the 'mySkill' you pass in there is the entire skill instance - the same thing that you passed in when you registered that skill on that fighter in the first place.

Caveats:
- Only the name of the skill that you pass in gets used, so if you have two skills with the same name, then you may accidentally remove another one instead
- This will only remove the first registration of a skill with that name that the system comes across, so if you registered the same skill on a fighter five times you need to remove it five times as well.


Also remember you can always have a condition on the skill class itself to make it unavailable in certain circumstances if you just want to disable it under certain conditions - UnregisterSkill removes it from that fighter permanently, and if you want it back you have to call RegisterSkill again.
Server error: user 'Jake' not found

User avatar
azureXtwilight
Megane Procrastinator
Posts: 4087
Joined: Fri Mar 28, 2008 4:54 am
Completed: Fantasia series (ROT and ROTA), Doppleganger: Dawn of The Inverted Soul, a2 (a due), Time Labyrinth
Projects: At Regime's End
Organization: Memento-Mori VNs, Team Sleepyhead
Location: Yogyakarta, Indonesia.
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#215 Post by azureXtwilight » Sun Oct 20, 2013 8:22 am

Got this error:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/ryuudou.rpy", line 581, in script
  File "game/ryuudou.rpy", line 582, in python
AttributeError: 'PlayerFighter' object has no attribute 'UnregisterSkill'

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "C:\renpy-6.14.1-sdk\renpy\execution.py", line 288, in run
    node.execute()
  File "C:\renpy-6.14.1-sdk\renpy\ast.py", line 718, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\renpy-6.14.1-sdk\renpy\python.py", line 1297, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/ryuudou.rpy", line 582, in <module>
    ryuu.UnregisterSkill(Library.Skills.MikRy)
AttributeError: 'PlayerFighter' object has no attribute 'UnregisterSkill'

Windows-7-6.1.7601-SP1
Ren'Py 6.15.7.374
A Ren'Py Game 0.0
Image

User avatar
Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#216 Post by Jake » Sun Oct 20, 2013 3:18 pm

azureXtwilight wrote:Got this error
Sorry, yes! I apparently didn't actually have a clean release of 7.5 in the project that I'd labelled as a clean release of 7.5, and that method isn't in 7.5 after all.


OK, if you haven't written any custom code in any skill class' RegisterFighter or SetUpFighter methods, then you're fine. All you'll need to do is open engine-fighters.rpy, go to line 153, and add in the following code:

Code: Select all

        # Remove a skill from this fighter's list of abilities
        def UnregisterSkill(self, skill):
            if (skill.Name in self._skillHandlers):
                del self._skillHandlers[skill.Name]
                
            self._skills = {}
            for s in self._skillHandlers.values():
                s.RegisterFighter(self)
            
        
It's a bit hackier than the next-release version, but it should work if you're not customising those two methods I mentioned above. The code around that area should then look like this:

Code: Select all

        # Add a skill to this fighter's list of abilities
        def RegisterSkill(self, skill):
            if (skill.Name in self._skillHandlers) == False:
                self._skillHandlers[skill.Name] = skill
                skill.RegisterFighter(self)
            
        # Remove a skill from this fighter's list of abilities
        def UnregisterSkill(self, skill):
            if (skill.Name in self._skillHandlers):
                del self._skillHandlers[skill.Name]
                
            self._skills = {}
            for s in self._skillHandlers.values():
                s.RegisterFighter(self)
            
        # State methods
        def getFaction(self):
            return self._faction
        def setFaction(self, val):
            self._faction = val
        Faction = property(getFaction, setFaction)
with the new method inserted in the middle.




If you have customised any RegisterFighter or SetUpFighter methods on any skills in such a way that the method would produce undesired effects if run a second time, then you'll have to either wait for the next release or just add your condition into the IsAvailable check on that skill and put up with it appearing in the skill menu but not being selectable.

Sorry!
Server error: user 'Jake' not found

User avatar
azureXtwilight
Megane Procrastinator
Posts: 4087
Joined: Fri Mar 28, 2008 4:54 am
Completed: Fantasia series (ROT and ROTA), Doppleganger: Dawn of The Inverted Soul, a2 (a due), Time Labyrinth
Projects: At Regime's End
Organization: Memento-Mori VNs, Team Sleepyhead
Location: Yogyakarta, Indonesia.
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#217 Post by azureXtwilight » Sun Oct 27, 2013 7:23 pm

Thank you!

Oh, I got this error mid-game. I wonder what caused it...

http://i.imgur.com/owMEKeK.jpg
Image

User avatar
Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#218 Post by Jake » Mon Oct 28, 2013 3:52 am

azureXtwilight wrote:Oh, I got this error mid-game. I wonder what caused it...

What happens in Ryuudou.rpy on line 210? It looks like the facing is being set on a fighter who isn't yet in a battle - if that's the case, you'll need to add fighters to a battle (using AddFighter in the usual way) before you can set their facing, because their facing only means anything in the context of a battlefield.
Server error: user 'Jake' not found

User avatar
Alitza
Newbie
Posts: 7
Joined: Fri Jun 07, 2013 7:32 am
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#219 Post by Alitza » Thu Nov 21, 2013 10:02 am

Hello

I tried to share inventory from shop module with personal inventory from equip module but still stuck :cry: . When I buy something in shop module it does not appear in equip module .

can you explain what am I doing wrong please ?

Code: Select all


init python:
    
    top_bar = Frame('gfx/top_bar.png', 7, 8)
    
    style.vscrollbar.top_bar = top_bar
    style.vscrollbar.bottom_bar = top_bar
    style.vscrollbar.thumb = 'gfx/thumb.png'
    style.vscrollbar.xminimum = 14
    style.vscrollbar.xmaximum = 14
    
label inv_test:
    
    python:
        
        # Here we're using the 'portrait' parameter to define a headshot of the character for use in UIs
        jack = PlayerFighter("Jack", portrait="gfx/jack.png", Health=100, Look=1, Lewd=1)
       
        money = 10000
        
        jackinv = BattleInventory()
        
      
        # The shop's inventory is stored in a BattleInventory instance - same as the player's
        # party inventory.
        
        shopInventory = BattleInventory()
        
        
        # To add a quantity of equipment, call the 'AddItem' method with two parameters -
        # the item itself, and the number to add.
        shopInventory.AddItem(Library.Equipment.Dress)
        shopInventory.AddItem(Library.Equipment.Panties)
        shopInventory.AddItem(Library.Equipment.Boots)
        
        money = renpy.call_screen("rpg_shop", partyInventory=jackinv, shopInventory=shopInventory, currency="Gold", money=money, fighters=[jack])
        
        
        # Let's go through all the stuff we bought:
        invItems = []
        for i in jackinv.GetItems():
            # i[0] is the name
            # i[1] is the quantity
            # i[2] is the item instance (in case you need it)
            itemString = str(i[1]) + " " + i[0]
            if i[1] > 1:
                itemString = itemString + "s"
            invItems.append(itemString)
        invString = ", ".join(invItems)
        
    "You bought: [invString]"
    
           
    show screen equip_select(partyInventory=jackinv, fighters=[jack])
    
    pause
    
jump mainmenu

User avatar
Tsundere Lightning
Miko-Class Veteran
Posts: 910
Joined: Sun Jul 06, 2008 4:30 pm
Projects: And plenty of them!
Location: Creche Alpha, Treasure Island
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#220 Post by Tsundere Lightning » Thu Nov 21, 2013 7:35 pm

I'm working on something with Focus as well as MP. It's supposed to start at 10 and go up by 5 each time a Fighter Attacks or Skips, then cap at 100. Then you can spend it on special abilities.

How would you implement this?
She's sun and rain: She's fire and ice. A little crazy, but it's nice.
Bliss Stage: Love is your weapon! A sci-fi visual novel about child soldiers coming of age. Kickstarter prerelease here. WIP thread here. Original tabletop game by Ben Lehman here. Tumblr here.

User avatar
Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#221 Post by Jake » Thu Nov 21, 2013 8:53 pm

Alitza wrote: When I buy something in shop module it does not appear in equip module .

Code: Select all

    show screen equip_select(partyInventory=jackinv, fighters=[jack])
Your problem is in the line of code I left in the quote above - the equip_select screen expects the inventory to be passed in with the parameter name "equipment". If you change it to the following, it looks like it should work:

Code: Select all

    show screen equip_select(equipment=jackinv, fighters=[jack])
Server error: user 'Jake' not found

User avatar
Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#222 Post by Jake » Thu Nov 21, 2013 9:01 pm

Tsundere Lightning wrote:I'm working on something with Focus as well as MP. It's supposed to start at 10 and go up by 5 each time a Fighter Attacks or Skips, then cap at 100. Then you can spend it on special abilities.

How would you implement this?
This is all off the top of my head, and it's late and I'm tired so apologies if I miss something or I'm not clear enough:

For the stat, I would suggest adding it in the first place with a value of 100, which by default sets the maximum value for that stat to be 100. Then you can set it directly to 10 immediately after creating the fighter to set the initial level.

For the skills, I'd suggest implementing your own skill handler classes - take a look at the AttackSkill and SkipSkill classes in engine-skills.rpy for examples (or maybe inherit from them). I'd then alter the PerformAction method to add 5 to the Focus stat alongside all the other stuff it does (or with inheritance; add 5 then call the implementation on the parent class), then on your special-ability skill classes, just put a check in IsAvailable to check the Focus stat is high enough alongside the check for MPs or whatever other requirements you have for that skill.
Server error: user 'Jake' not found

User avatar
Alitza
Newbie
Posts: 7
Joined: Fri Jun 07, 2013 7:32 am
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#223 Post by Alitza » Fri Nov 22, 2013 7:07 am

Thanks alot Jake.
works fine now :D

User avatar
Tsundere Lightning
Miko-Class Veteran
Posts: 910
Joined: Sun Jul 06, 2008 4:30 pm
Projects: And plenty of them!
Location: Creche Alpha, Treasure Island
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#224 Post by Tsundere Lightning » Fri Nov 22, 2013 5:25 pm

Jake wrote:
Tsundere Lightning wrote:I'm working on something with Focus as well as MP. It's supposed to start at 10 and go up by 5 each time a Fighter Attacks or Skips, then cap at 100. Then you can spend it on special abilities.

How would you implement this?
This is all off the top of my head, and it's late and I'm tired so apologies if I miss something or I'm not clear enough:

For the stat, I would suggest adding it in the first place with a value of 100, which by default sets the maximum value for that stat to be 100. Then you can set it directly to 10 immediately after creating the fighter to set the initial level.

For the skills, I'd suggest implementing your own skill handler classes - take a look at the AttackSkill and SkipSkill classes in engine-skills.rpy for examples (or maybe inherit from them). I'd then alter the PerformAction method to add 5 to the Focus stat alongside all the other stuff it does (or with inheritance; add 5 then call the implementation on the parent class), then on your special-ability skill classes, just put a check in IsAvailable to check the Focus stat is high enough alongside the check for MPs or whatever other requirements you have for that skill.
Going to try this now. Thank you! It helps that Focus-consuming attacks never cost MP, at least not in my game.

EDITED WITH A QUESTION:
Is the "Magic" stat you have as the default in the engine a parallel stat to Attack, or is it just maximum MP? Because if it's just max MP, then I'm going to need to alter spells to deal damage off a different stat.
She's sun and rain: She's fire and ice. A little crazy, but it's nice.
Bliss Stage: Love is your weapon! A sci-fi visual novel about child soldiers coming of age. Kickstarter prerelease here. WIP thread here. Original tabletop game by Ben Lehman here. Tumblr here.

PeterTehDumb
Newbie
Posts: 2
Joined: Thu Oct 10, 2013 7:49 am
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#225 Post by PeterTehDumb » Sun Dec 01, 2013 11:00 am

Hello,

I'm only here to ask about the license. As I'm new with CC License terms.

Here's my question :
Am I allowed to place a donate button to cover up some image material's funds for a VN?
This VN will be free to play though.

Post Reply

Who is online

Users browsing this forum: No registered users