Lemma Soft Forums

Supporting creators of visual novels and story-based games since 2003.


Visit our new games list, blog aggregator, IRC, and wiki.
Activation problem? Email [email protected]
It is currently Thu Jun 20, 2013 5:29 am

All times are UTC - 5 hours [ DST ]


Forum rules


Ask questions about one topic per thread, and use a descriptive subject. "NotImplemented error in script.rpy" is a good subject, "Tom's problems" is not. Remember to include all of traceback.txt or error.txt when reporting a problem, as well as the relevant lines of script. Use the [code] tag to format scripts.



Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Point multiplier
PostPosted: Sat Jun 11, 2011 7:13 pm 
Regular
User avatar

Joined: Fri May 27, 2011 8:23 pm
Posts: 113
I'm wondering if there's a possibility of making a point multiplier thing. If Strength potion is used, all Strength points increase from this point on gets a +10 like that. Like, if normally "going to Gym" option increases 20 strength points, if Strenght potion is used, the "going to Gym" option will always give you 30 points instead. Or will I have to code the "if" for every single menu choice?

Oh, and if possible make the potion be less effective if it's not fresh. Like if you immediately use potion after you receive it, the Strength gets a +10. If you don't use the potion until after a certain point of the game, the strength increase will only get a +8. And it decreases as the game progresses until it finally becomes "stale" and doesn't work anymore.


Top
 Profile Send private message  
 
 Post subject: Re: Point multiplier
PostPosted: Sat Jun 11, 2011 9:00 pm 
Regular
User avatar

Joined: Thu Jun 09, 2011 1:54 am
Posts: 69
Location: butts
Projects: human instrumentality and vocals section
Have a var called strengthMultiplier or something. Whenever a character uses that Strength Potion, add whatever value to that var. Then a workout's total increase is 20 += strengthMultiplier instead (be sure to set it to 0 first in the init)

As for the second part, it depends on how you code your items and objects. Normally you have 'freshness' or something as a part of the item's class, and to decrease freshness you simply change that value (normally through a loop or something). I can't think of how you'd do it based on game time played, however, other than setting your own restriction to decrease it every X screens, or having set days in your work that decreases the value at transition between them.

_________________
i have no signature and i must obscure game reference


Top
 Profile Send private message  
 
 Post subject: Re: Point multiplier
PostPosted: Sun Jun 12, 2011 5:35 am 
Regular
User avatar

Joined: Fri May 27, 2011 8:23 pm
Posts: 113
Er... Can you show me a sample of the exact code to add that variation? Oh, The Potion is supposed to have a permanent effect on the stat increase, so would the code be different?

Mmm, it's not based on real-time. It's more like "if potion not used until scene XXX, it will lose so and so amount of effectiveness". I was thinking of separating the scenes based on whether or not POtion is used ("use potion" --> Jump to "used potion", "save potion for later" --> jump to "not use potion"). Would it work better that way?


Top
 Profile Send private message  
 
 Post subject: Re: Point multiplier
PostPosted: Sun Jun 19, 2011 9:56 pm 
Regular
User avatar

Joined: Fri May 27, 2011 8:23 pm
Posts: 113
Er... So, how do I go about doing this? Anyone?


Top
 Profile Send private message  
 
 Post subject: Re: Point multiplier
PostPosted: Sun Jun 19, 2011 10:18 pm 
Eileen-Class Veteran
User avatar

Joined: Sat Apr 23, 2011 2:43 pm
Posts: 1091
Completed: Ristorante Amore, The Elevator, SPLENDIDEST OTOGE
Projects: Break Chance Memento, Swan Grimoire
Organization: Cyanide Tea
I don't really get what you're saying about the potion freshness or whatever, but based on what Sexo said, here's some code for the first part:

Code:
init:
    $ strengthMultiplier = 0
    $ strengthPoints = 0

label start:
   "Going to the gym~"
    $ strengthPoints += 20 + strengthMultiplier
    # since strengthMultiplier is 0, this means 20 points are added to strengthPoints
    "Using a Strength potion now!"
    $ strengthMultiplier += 10
    "And now going to the gym again..."
    $ strengthPoints += 20 + strengthMultiplier
    # since strengthMultiplier is now 10, this means 30 points are added to strengthPoints


I haven't tested it myself, but it should be something like that.

Edit; Thinking about the potion freshness, you should probably just make a variable for the age of the potion. For every scene that passes without the potion being used, add +1 to the potion's age. Then if the potion is more than 4 or 5 days old, have it add less to strengthMultiplier once it's used. (via if statements)

_________________
1/2 of Cyanide Tea | BCM | Ristorante Amore | The Elevator | @Twitter
I'm extremely busy as of late, so I'm not around here very much. If you need me, Twitter's probably the quickest way to get my attention if you don't have me on Skype already.


Top
 Profile Send private message  
 
 Post subject: Re: Point multiplier
PostPosted: Tue Jun 28, 2011 3:44 pm 
Regular
User avatar

Joined: Fri May 27, 2011 8:23 pm
Posts: 113
THANKS A LOT!!! Where do I put the "if statements"? In the init or the label? *is total n00b*


Top
 Profile Send private message  
 
 Post subject: Re: Point multiplier
PostPosted: Tue Jun 28, 2011 5:02 pm 
Eileen-Class Veteran
User avatar

Joined: Sat Apr 23, 2011 2:43 pm
Posts: 1091
Completed: Ristorante Amore, The Elevator, SPLENDIDEST OTOGE
Projects: Break Chance Memento, Swan Grimoire
Organization: Cyanide Tea
The if statements should be in the label wherever they're needed.

_________________
1/2 of Cyanide Tea | BCM | Ristorante Amore | The Elevator | @Twitter
I'm extremely busy as of late, so I'm not around here very much. If you need me, Twitter's probably the quickest way to get my attention if you don't have me on Skype already.


Top
 Profile Send private message  
 
 Post subject: Re: Point multiplier
PostPosted: Wed Jul 13, 2011 10:04 am 
Regular
User avatar

Joined: Fri May 27, 2011 8:23 pm
Posts: 113
I have another question. Suppose the potion is a love potion. If used, all attraction points +20. How do you code that? Will I have to code the "+ attractionmultiplier" every time there's attraction point involved?


Top
 Profile Send private message  
 
 Post subject: Re: Point multiplier
PostPosted: Wed Jul 13, 2011 11:23 am 
Regular
User avatar

Joined: Thu Jun 16, 2011 9:17 am
Posts: 79
It's better to just define some functions. For example:

Code:
def add_attraction (amount):
    attraction += (amount + attractionmultiplier)


and then use the function to modify attraction, never accessing it directly.

There is also a more sophisticated use based on Python subclassing, which I recommend you don't use unless you know EXACTLY what the following bit of code does and does not do:
Code:
# with this method, you would need to define one class (and instantiate one instance of said class)
# per type of point counter.. Attraction, Strength, etc.
#
# then you could add and subtract from that instance normally like "attraction += 4"
class Attraction(int):
    def __add__ (self, amount):
        return Attraction(int.__add__ (self, amount + attraction_multiplier))
    def __sub__ (self, amount):
        return Attraction(int.__sub__ (self, amount - attraction_multiplier))


(BTW, it's bizarre to call something which you add, a 'multiplier')


Top
 Profile Send private message  
 
 Post subject: Re: Point multiplier
PostPosted: Wed Jul 13, 2011 5:18 pm 
Regular
User avatar

Joined: Fri May 27, 2011 8:23 pm
Posts: 113
I used to want to have the potion multiply the points, but I thought it'd be easier if the potion just adds to it.

So where do you put the code? Python or init? And what do you do in the label?

attraction point += add_attractionpoint?

Oh, What I want is a bit complicated... If you use potion, attraction + 20. If potion not used, it goes into "inventory" and the effectiveness decreases for every extra scene it's not used. Like this:

Label 1: You have love potion! Use --> Attraction +20. Not use --> Attraction +0
Label 2: If have not used love potion in Scene 1, Use now --> Attraction +18.
Label 3: If still have not used love potion, Use now --> Attraction + 16
(continue to decrease 2 until it reaches zero and the potion is basically dead and can't be used anymore)


Top
 Profile Send private message  
 
 Post subject: Re: Point multiplier
PostPosted: Wed Jul 13, 2011 6:49 pm 
Miko-Class Veteran
User avatar

Joined: Sun Dec 20, 2009 10:15 am
Posts: 642
Completed: The Loop
Projects: The Madness, In Orbit
Organization: Gliese Productions
One question, from a gameplay point of view:
Would it not be pointless to add a defeneration feature, if there are no benefits for the player choosing not to use the potion yet? (If you say the effect is permanent)

Anyways.
Code:
init python:
    # Make a function for each stat.
    def add_attraction (amount):
       attraction += (amount + attractionmultiplier)
    def add_strength (amount):
       strength += (amount + strengthmultiplier)
   
    # And for each potion.
    def love_potion_use():
        attractionmultiplier += love_potion_value
    def strength_potion_use():
        strengthmultiplier += strength_potion_value

    # This decays all your potions at the point you call it.
    def decay(amount):
        love_potion_value -= amount
        strength_potion_value -= amount
       
init:
$ attraction = 0
$ love_potion_value = 20
$ strength_potion_value = 20
$ attractionmultiplier = 0
$ strengthmultiplier = 0

label start:

Scene 1
mc "You're awesome!"
$ add_attraction(10)

Scene 2
$ decay(2)

Scene 3
$ decay(2)
mc "Time to use my strength potion!"
$ strength_potion_use()

Scene 4
"Five days later"
# You can use a higher value for decay if your story skips ahead of time.
$ decay(10)
mc "Going to the gym."
$ add_strength(10)
# By now, your mc's strength value will be 20.

_________________
Coming Soon: The Madness
You will need therapy.
Gliese Productions
Facebook | Twitter


Top
 Profile Send private message  
 
 Post subject: Re: Point multiplier
PostPosted: Thu Jul 14, 2011 8:39 pm 
Regular
User avatar

Joined: Fri May 27, 2011 8:23 pm
Posts: 113
Thanks for the code!

Not using the love potion immediately would give you less attraction point in total and you won't be able to get certain scenes that leads to the endings that requires very high attraction points. Suppose you don't want to get those endings, you really have to avoid using the potion. until certain points of the game. I'm a bit over-zealous with my point system. Slight difference in the total points accumulated leads to different things. Less than 1000 points, say, gets you ending A. Between 900-1000, ending B, etc etc etc.


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Protected by Anti-Spam ACP
Powered by phpBB® Forum Software © phpBB Group