Is it correct to use DSE for affection points?

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
roankun
Regular
Posts: 94
Joined: Fri Jun 11, 2010 4:01 am
Projects: RHS
Contact:

Is it correct to use DSE for affection points?

#1 Post by roankun » Mon Jun 14, 2010 9:43 am

I'm trying to make a normal visual novel, not a Dating Sim.

Anyway, it's like this. When MC (main character) talks to someone, you can sometimes make choices about what to talk about or who to talk with. I want each and every choice to affect how much affection points those people have for MC.

BTW, affection points is a system I have where the person with the most affection points will end up with MC. But I'm not sure I can use DSE... It's got a lot of these... stuff that I can't understand.

I haven't studied python extensively yet (my only experience is with renpy), so please explain in a manner I can understand and ask question about. ^^
I don't have any kind words to spare to someone who already has all the reason in the world to feel good about himself.
http://roankun.wordpress.com/

User avatar
Chansel
Veteran
Posts: 249
Joined: Sat May 01, 2010 6:11 pm
Projects: School's Out! -- A GxB or GxG VN/Dating Sim
Location: The Netherlands, Noord-Brabant
Contact:

Re: Is it correct to use DSE for affection points?

#2 Post by Chansel » Mon Jun 14, 2010 10:07 am

Well, perhaps it's easier to just use a variable for something like that.
Here's a small example:

Code: Select all

init:
    $ characterA_affection = 0  #This sets the affection points for Character A to a default of 0 

label start:
"You just picked an option which increases your affection points with Character A!"
$ characterA_affection += 5   # This adds 5 points to character A's affection
"You picked the wrong option!"
$ characterA_affection -= 5    # This subtracts 5 points from character A's affection
So, basically you create a variable in your init block and set it to whatever you want the player to start with. Then, during your game, you can increase and decrease that value whenever you like.
Small hint though, make the variable's name shorter :P Since you're probably going to use it quite often.
Hope this helps :)
Image ~ A GxB or GxG Visual Novel/Dating Sim

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: Is it correct to use DSE for affection points?

#3 Post by Aleema » Mon Jun 14, 2010 10:08 am

PYTHONPYTHONGPYTNDSEPYTHONDSEDSEPOINTSPYTHON.
Oh, I'm sorry. You don't know Python? Let me try a different way to explain it then ...

All you need to do is record points in a variable. Initialize all your variables in an init block, like this:

Code: Select all

init:
    k_love = 0
    l_love = 0
When you do something that the K character likes, say:

Code: Select all

$ k_love += 1
And if they don't like it:

Code: Select all

$ k_love -= 1
Where 1 can be any number of points. At the end, you would just compare the points for all characters, and whoever has the most, wins! I mean, you go out with them.

This will only be a problem if you need there to be a maximum and minimum amount of points for the characters. Otherwise, go crazy, kid!

p.s.: "-=" and "+=" are the short way to say "the same variable plus/minus whatever is after this" (meaning "k_love += 1" is "k_love = k_love+ 1").

Edit: CHANSEL! THUNDER STEALER! >=[
Just kidding. :lol:

User avatar
Chansel
Veteran
Posts: 249
Joined: Sat May 01, 2010 6:11 pm
Projects: School's Out! -- A GxB or GxG VN/Dating Sim
Location: The Netherlands, Noord-Brabant
Contact:

Re: Is it correct to use DSE for affection points?

#4 Post by Chansel » Mon Jun 14, 2010 10:09 am

Haha, lolz XD I posted, what, 2 seconds before you.
Mwahahaa
Your explanation is better though...
Image ~ A GxB or GxG Visual Novel/Dating Sim

User avatar
Taroku
Regular
Posts: 74
Joined: Tue Mar 17, 2009 5:22 pm
Projects: Eh? Get off my back!
Location: Denmark
Contact:

Re: Is it correct to use DSE for affection points?

#5 Post by Taroku » Mon Jun 14, 2010 10:12 am

If I understand your question right, all you need are some simple variables:

Code: Select all

Label meeting:
    
    g "Hello."

    menu:
        "Say 'Hello'":
            girl_1 += 5

            g "Wanna walk together?"

        "Say nothing":
            girl_1 -= 1

            g "You could at least say hello..."

    if girl_1 >= 5:
        g "How about we visit a café?"
        [Your code]

    else:
        g "You're such a pain..."
        [Your code]
...Something like that. I recommend you practice this, as it can help you tremendously in the future. :)


Before post Edit: Whaaaa?! You guys beat me to it! :!:

After post Edit: Though you should definitely do what they said, and write it in 'init' first.
|| DA Page || twitter || Taroku ||

Checking... Nope, still a wannabe.

number473
Regular
Posts: 195
Joined: Tue Dec 15, 2009 4:20 am
Projects: The Duke's Daughter
Location: Cape Town
Contact:

Re: Is it correct to use DSE for affection points?

#6 Post by number473 » Mon Jun 14, 2010 10:20 am

Aleema wrote:Where 1 can be any number of points.
T^T

The code is, of course, correct, but the explanation above makes Mathematics cry ;_;
Mental weather report: Cloudy with a possibility of brain storms.

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: Is it correct to use DSE for affection points?

#7 Post by Aleema » Mon Jun 14, 2010 10:21 am

number473 wrote: T^T

The code is, of course, correct, but the explanation above makes Mathematics cry ;_;
T^T Random troll posts make me cry.

number473
Regular
Posts: 195
Joined: Tue Dec 15, 2009 4:20 am
Projects: The Duke's Daughter
Location: Cape Town
Contact:

Re: Is it correct to use DSE for affection points?

#8 Post by number473 » Mon Jun 14, 2010 10:23 am

Yeah, I know it was irrelavant, but you'd answered the question already so I didn't have anything useful to add.
Mental weather report: Cloudy with a possibility of brain storms.

User avatar
Showsni
Miko-Class Veteran
Posts: 563
Joined: Tue Jul 24, 2007 12:58 pm
Contact:

Re: Is it correct to use DSE for affection points?

#9 Post by Showsni » Mon Jun 14, 2010 5:38 pm

Um, if you initialise it in the init block, it'll reset it to that value every time you run the programme, won't it? Which would be a bad thing. Instead, initialise it after the start label. Like:

Code: Select all

label start:
    $ Alovepoints = 0
    $ Blovepoints = 0

    e "Hello! You've started a new game!"

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

Re: Is it correct to use DSE for affection points?

#10 Post by Jake » Mon Jun 14, 2010 5:55 pm

Showsni wrote:Um, if you initialise it in the init block, it'll reset it to that value every time you run the programme, won't it?
I don't think it's quite so simple. IIRC, any variable which is assigned to directly after the start of the game will be saved, so:

Code: Select all

init:
  loveLovePoints = 0

start:
  loveLovePoints = 5

  "Dialogue"
- if you save at 'Dialogue' and reload, loveLovePoints should be 5.

The problem comes when assigning to attributes of classes, in particular, because you're not actually assigning to the variable itself, and the variable has the same literal data - the same reference to the same class instance - at the time of save as it does in the init block. So you have trouble with things like lists:

Code: Select all

init:
  loveList = ['kittens', 'apples']
start:
  $ loveList.append('shirley')

  "Dialogue"
I think that the problem you'd see is that because loveList was assigned to only in the init block, it doesn't get saved if all you've done is called methods on it since then, so saving and reloading at 'Dialogue', you'd get a loveList that just had kittens and apples in.




Of course, just because you can probably get away with assigning to your points variables in the init block and modifying them in script doesn't mean you necessarily should - ultimately you're right, it's safest to set up all your game-state stuff just after the 'start' label, just to be on the safe side!
Server error: user 'Jake' not found

User avatar
Sheru-chan
Regular
Posts: 89
Joined: Sun Jun 13, 2010 1:23 am
Location: Cavite, Philippines
Contact:

Re: Is it correct to use DSE for affection points?

#11 Post by Sheru-chan » Tue Jun 15, 2010 7:07 pm

Ermm... I'm just curious...

If, i need to branch the story by whom the OC has more affection, how can i do it? (I'm still reading the tut but maybe asking here is more easier) I just hope it would be explained in a manner for the noobs....
Currently working on:
Lock On! ~Sins and Atonement~ in hiatus
GXB game.
---------------------------------------
Imouto Complex is active.

User avatar
Showsni
Miko-Class Veteran
Posts: 563
Joined: Tue Jul 24, 2007 12:58 pm
Contact:

Re: Is it correct to use DSE for affection points?

#12 Post by Showsni » Tue Jun 15, 2010 8:09 pm

Something like

Code: Select all

if apoints > bpoints:
     jump apath

User avatar
roankun
Regular
Posts: 94
Joined: Fri Jun 11, 2010 4:01 am
Projects: RHS
Contact:

Re: Is it correct to use DSE for affection points?

#13 Post by roankun » Wed Jun 16, 2010 6:28 am

Oh, okay. Thanks for all the help, and sorry for the late reply. ^^

Hmmm... Just one more thing. I have to make a status page (which accessible from the game at all times) and that's where you can see their affection points. However, I don't want it to be numbers like
agirl = 5

I actually also want to include images (the girl's faces) instead of names, and hearts (instead of numbers.) The hearts will change in color and size depending on the number of affection points... How can I do this?

P.S. How do I make the status page and how do I make it accessible from the game? Should I use call or jump or something else?

P.P.S. Regarding what Jake brought up... Does that mean if you save the game and then load it, you won't have the same number of affection points you saved with?
I don't have any kind words to spare to someone who already has all the reason in the world to feel good about himself.
http://roankun.wordpress.com/

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

Re: Is it correct to use DSE for affection points?

#14 Post by Jake » Wed Jun 16, 2010 7:02 am

roankun wrote: P.P.S. Regarding what Jake brought up... Does that mean if you save the game and then load it, you won't have the same number of affection points you saved with?
It means that if you don't set the affection points in an init block, and instead set them to the default values after the start: label, you don't have anything to worry about.

There are some conditions under which you can have your points reset when you save and then load, but they all revolve around initially setting up the points in an init: block.
Server error: user 'Jake' not found

User avatar
BlueRoseMaidenAras
Regular
Posts: 56
Joined: Wed Feb 03, 2010 10:04 pm
Location: ~Somewhere Around the World~
Contact:

Re: Is it correct to use DSE for affection points?

#15 Post by BlueRoseMaidenAras » Thu Jun 24, 2010 6:31 am

I understand some things... So you DON'T need to download anything? Or anything like that...? Is it already in the renpy engine?
please join! <3

http://erigot-academy.deviantart.com/

Arasettie+ Jaden= Jadettie
Arasettie + Atticus= Attisettie
Arasettie+ Christopher= Chrisettie
Arasettie+ Gale= Galettie
Christopher+ Elaine= Christaine
Atticus+ Vanessa= Attissa
Emile+ Arasettie= Emisettie
Christopher+ Ariana= Christiana
Atticus+ Eris= Attis
Jaden+ Valentia= Jalentia
Gale+ Nami= Gami
Gale+ Iruzu= Garuzu

Post Reply

Who is online

Users browsing this forum: No registered users