Combat

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
User avatar
Wright1000
Miko-Class Veteran
Posts: 629
Joined: Thu Mar 31, 2011 10:20 am
Completed: Finding A Murderer, Memory Loss, Crime Investigation, Stay away from the graveyard, Last Day at School, Lonesome, Email, Hired Gun, Dusk, Hired Gun 2, Man-at-arms, Hired Gun 3, The Phantom Caller, Street Girl, Free love, The Story of Isabel Claudia
Contact:

Combat

#1 Post by Wright1000 » Thu Apr 07, 2011 10:43 am

I want to make a game with combat.
Will someone teach me how does combat work in Ren'py?
In every different attack I want the opponent to lose different number of points.
Sometimes, I also want the opponent to dodge.
But, how is this done?
Does anyone know how to make games with combat?
He who doesn't care about the environment doesn't care about his grandchildren.

ninjagrass
Regular
Posts: 104
Joined: Wed Mar 04, 2009 9:16 am
Projects: To Love Ru Trial Trouble, Bleach Battle Ignition, A new secret project...
Contact:

Re: Combat

#2 Post by ninjagrass » Fri Apr 08, 2011 7:18 am

There are various ways of making combat in a game. Each person seems to have their own way of expressing it. Well to start off define the HP, MAXHP variables.

Code: Select all

init:
   $ hp = 100
   $ maxhp = 100
   $ enemyhp = 100
   $ enemymaxhp = 100
Then show this using ui functions (bar etc). An attack will be simple...

Code: Select all

label attack:
   "I attack the enemy"
   $ enemyhp -= 10
   "I deal 10 damage"
return
Dodging can be based on probabilities or an attack to make you invunerable. What I used was...

Code: Select all

if renpy.random.randint(1,6) > 4:
   "The enemy dodges the attack"
else:
   call attack
return
Defending is (0.25*dmg) and so on (you really have to experiment and play around this this). Now you can have all fancy menus on top and animations etc to make it look good. Hope this helps.

User avatar
Wright1000
Miko-Class Veteran
Posts: 629
Joined: Thu Mar 31, 2011 10:20 am
Completed: Finding A Murderer, Memory Loss, Crime Investigation, Stay away from the graveyard, Last Day at School, Lonesome, Email, Hired Gun, Dusk, Hired Gun 2, Man-at-arms, Hired Gun 3, The Phantom Caller, Street Girl, Free love, The Story of Isabel Claudia
Contact:

Re: Combat

#3 Post by Wright1000 » Fri Apr 08, 2011 10:24 am

Thank you.
But after the battle is over, how to I restore my hp?
He who doesn't care about the environment doesn't care about his grandchildren.

ninjagrass
Regular
Posts: 104
Joined: Wed Mar 04, 2009 9:16 am
Projects: To Love Ru Trial Trouble, Bleach Battle Ignition, A new secret project...
Contact:

Re: Combat

#4 Post by ninjagrass » Fri Apr 08, 2011 10:29 am

Code: Select all

$ hp = maxhp

User avatar
Wright1000
Miko-Class Veteran
Posts: 629
Joined: Thu Mar 31, 2011 10:20 am
Completed: Finding A Murderer, Memory Loss, Crime Investigation, Stay away from the graveyard, Last Day at School, Lonesome, Email, Hired Gun, Dusk, Hired Gun 2, Man-at-arms, Hired Gun 3, The Phantom Caller, Street Girl, Free love, The Story of Isabel Claudia
Contact:

Re: Combat

#5 Post by Wright1000 » Sat Apr 09, 2011 9:15 am

Thank you.
Now, there is only one thing remaining.
Where do I get music that can be played when the combat is going on?
Where did you get your music from?
Can you give me some of the combat music which you used in your game?
He who doesn't care about the environment doesn't care about his grandchildren.

ninjagrass
Regular
Posts: 104
Joined: Wed Mar 04, 2009 9:16 am
Projects: To Love Ru Trial Trouble, Bleach Battle Ignition, A new secret project...
Contact:

Re: Combat

#6 Post by ninjagrass » Sat Apr 09, 2011 4:03 pm

Bleach OST, original music by xxfatxxx and some source even I don't know! I'm sure you download Bleach OST on google etc.

User avatar
Wright1000
Miko-Class Veteran
Posts: 629
Joined: Thu Mar 31, 2011 10:20 am
Completed: Finding A Murderer, Memory Loss, Crime Investigation, Stay away from the graveyard, Last Day at School, Lonesome, Email, Hired Gun, Dusk, Hired Gun 2, Man-at-arms, Hired Gun 3, The Phantom Caller, Street Girl, Free love, The Story of Isabel Claudia
Contact:

Re: Combat

#7 Post by Wright1000 » Thu Apr 21, 2011 12:54 am

First they say that I need to register before I can download any music.
Then, after I download, they say that I need to spread information about that website if I want to download music.
Forget that website. I have got music from other websites.
But, now, tell me one thing.
Your random system in combat did not work.
I want my enemy to have a chance of dodging the attack by 50%.
How is it done?
Please, can you show me your script of one full combat or please, can you send me your script at wrightrobinson1@gmail.com.
He who doesn't care about the environment doesn't care about his grandchildren.

shuen
Regular
Posts: 72
Joined: Tue Mar 22, 2011 2:36 pm
Contact:

Re: Combat

#8 Post by shuen » Thu Apr 21, 2011 1:47 am

Maybe you can find something useful here:
http://lemmasoft.renai.us/forums/viewto ... 07&start=0
Image
.Traditional Chinese Site.
~Illustrator+Graphic/Web Designer~

ninjagrass
Regular
Posts: 104
Joined: Wed Mar 04, 2009 9:16 am
Projects: To Love Ru Trial Trouble, Bleach Battle Ignition, A new secret project...
Contact:

Re: Combat

#9 Post by ninjagrass » Thu Apr 21, 2011 6:18 am

Wright1000 wrote:First they say that I need to register before I can download any music.
Then, after I download, they say that I need to spread information about that website if I want to download music.
Forget that website. I have got music from other websites.
But, now, tell me one thing.
Your random system in combat did not work.
I want my enemy to have a chance of dodging the attack by 50%.
How is it done?
Please, can you show me your script of one full combat or please, can you send me your script at wrightrobinson1@gmail.com.
Lol... what websites did you go to... but for a 50% dodge you have to do:

Code: Select all

if renpy.random.randint(1,4) > 2:
     "Enemy dodges attack"
else:
     call attack
This is really abstract as for the code. Lets see, I'll look for the demo script and send it. The code is pretty much everywhere, so good luck in trying to figure it out...

User avatar
LVUER
King of Lolies
Posts: 4538
Joined: Mon Nov 26, 2007 9:57 pm
Completed: R.S.P
Location: Bandung, West Java, Indonesia
Contact:

Re: Combat

#10 Post by LVUER » Thu Apr 21, 2011 6:44 am

I never meet sites like that. The most "unique" site I've meet is the one where I have to post more than x message in order to download files. Or press the "like" button...
"Double the princesses, quadruple the fun!" - Haken Browning (SRW-OG Endless Frontier)

DeviantArt Account
MoeToMecha Blog (under construction)
Lolicondria Blog (under construction) <- NSFW

ninjagrass
Regular
Posts: 104
Joined: Wed Mar 04, 2009 9:16 am
Projects: To Love Ru Trial Trouble, Bleach Battle Ignition, A new secret project...
Contact:

Re: Combat

#11 Post by ninjagrass » Thu Apr 21, 2011 10:35 am

Here are the demo scripts loaded. The way I started a battle is very different, complex and hard to explain to other people, so I won't explain it. Remember some of the functions in the battle framework are specific to fights, which means I didnt develop the system to be global and compatible with every fight (like in create a battle). For that you need the ACTUAL real scripts of the finished game, which even I have lost...
Attachments
script.rpy
(55.07 KiB) Downloaded 99 times
other.rpy
(17.91 KiB) Downloaded 80 times
zap.rpy
(20.12 KiB) Downloaded 103 times

User avatar
Wright1000
Miko-Class Veteran
Posts: 629
Joined: Thu Mar 31, 2011 10:20 am
Completed: Finding A Murderer, Memory Loss, Crime Investigation, Stay away from the graveyard, Last Day at School, Lonesome, Email, Hired Gun, Dusk, Hired Gun 2, Man-at-arms, Hired Gun 3, The Phantom Caller, Street Girl, Free love, The Story of Isabel Claudia
Contact:

Re: Combat

#12 Post by Wright1000 » Sat Apr 23, 2011 12:51 am

Thank you.
He who doesn't care about the environment doesn't care about his grandchildren.

User avatar
Wright1000
Miko-Class Veteran
Posts: 629
Joined: Thu Mar 31, 2011 10:20 am
Completed: Finding A Murderer, Memory Loss, Crime Investigation, Stay away from the graveyard, Last Day at School, Lonesome, Email, Hired Gun, Dusk, Hired Gun 2, Man-at-arms, Hired Gun 3, The Phantom Caller, Street Girl, Free love, The Story of Isabel Claudia
Contact:

Re: Combat

#13 Post by Wright1000 » Mon Apr 25, 2011 4:48 am

I got a headache when I looked at your script. I did not understand anything.

How did you make this game? Who taught you? You are a very good programmer.

And why did you give this game for free instead of selling it?
He who doesn't care about the environment doesn't care about his grandchildren.

ninjagrass
Regular
Posts: 104
Joined: Wed Mar 04, 2009 9:16 am
Projects: To Love Ru Trial Trouble, Bleach Battle Ignition, A new secret project...
Contact:

Re: Combat

#14 Post by ninjagrass » Mon Apr 25, 2011 5:34 am

Wright1000 wrote:I got a headache when I looked at your script. I did not understand anything.

How did you make this game? Who taught you? You are a very good programmer.

And why did you give this game for free instead of selling it?
Yeah, I figured that you won't get it since is quite complex. I self taught myself python and no way am I a good programmer, just a beginner. The main reason why I released the game for free is because I used second hand art from the internet and selling it for money would have breached some laws which could lead to me being locked up. So thats why I decided that my next project will be with original art.... when I decide to start working on it.

I don't mind doing a battle system for someone else's game. Actually I wanted to test something big but I'm quite busy now might put myself up for recruitment after a month or so.

ninjagrass
Regular
Posts: 104
Joined: Wed Mar 04, 2009 9:16 am
Projects: To Love Ru Trial Trouble, Bleach Battle Ignition, A new secret project...
Contact:

Re: Combat

#15 Post by ninjagrass » Mon Apr 25, 2011 5:35 am

Wright1000 wrote:I got a headache when I looked at your script. I did not understand anything.

How did you make this game? Who taught you? You are a very good programmer.

And why did you give this game for free instead of selling it?
Yeah, I figured that you won't get it since is quite complex. I self taught myself python and no way am I a good programmer, just a beginner. The main reason why I released the game for free is because I used second hand art from the internet and selling it for money would have breached some laws which could lead to me being locked up. So thats why I decided that my next project will be with original art.... when I decide to start working on it.

I don't mind doing a battle system for someone else's game. Actually I wanted to test something big but I'm quite busy now might put myself up for recruitment after a month or so.

Post Reply

Who is online

Users browsing this forum: gas, Majestic-12 [Bot]