Not-so Permanent NVL-to-ADV switch

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.
Post Reply
Message
Author
Law.
Newbie
Posts: 6
Joined: Fri Jul 29, 2016 12:06 am
Projects: TBA
Contact:

Not-so Permanent NVL-to-ADV switch

#1 Post by Law. »

What I'm attempting to do is find a way to set the visual novel to dedicate itself either NVL or ADV mode without having to split the script into 2 separate scripts (i.e. defining two different characters for each character, 1 adv and the other nvl, and then having a separate copy of the script where they use either mode.)
I wanted to do this just out of ambition.

Currently what I've done is:
  • Tried defining the characters after the start label in separated scripts (scripts >jump> nvlmode or advmode >jump> dialogue script): That didn't work since renpy sweeps through the whole thing to find definitions, "last" one taking priority.
  • I tried using kind="[nstyle]" and then chaining "$ nstyle = nvl" to the script after start in a menu option: didn't work either. Error about only taking 3 arguements, 4 given.
  • I tried using kind=mode, then $ define mode = nvl, which half worked up until this point. The issue ended up being it would ignore the $ mode = adv code completely.
Another idea I had was attaching attributes to the characters after start during the game, but I don't know python well enough to write that piece of code on my own and get it to work.

My last resort is just accepting defeat and splitting the script after everything is proofread at the end, and swapping out the adv kind attributes names in the dialogue script with the nvl ones, which I WILL do if I can't find an alternate solution.

This is a very outrageous request, but I would sincerely appreciate any help.

philat
Eileen-Class Veteran
Posts: 1926
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Not-so Permanent NVL-to-ADV switch

#2 Post by philat »

I'm not very familiar with the innards of Ren'py, but Character objects don't take very kindly to being modified in-game, iirc. Probably the simplest thing is to create two definitions and alias them with a normal variable.

Code: Select all

define testchar_adv = Character("Test", kind=adv)
define testchar_nvl = Character("Test", kind=nvl)

default testchar = testchar_adv # note that testchar is a defaulted variable which can be changed and saved normally while the Character objects are defined and would not change

label start:

    testchar "1"
    testchar "2"
    $ testchar = testchar_nvl # the UI and mechanics of switching this for all characters being up to you, but seems relatively simple
    testchar "3"
    testchar "4"

Law.
Newbie
Posts: 6
Joined: Fri Jul 29, 2016 12:06 am
Projects: TBA
Contact:

Re: Not-so Permanent NVL-to-ADV switch

#3 Post by Law. »

philat wrote: Thu Apr 29, 2021 3:31 am I'm not very familiar with the innards of Ren'py, but Character objects don't take very kindly to being modified in-game, iirc. Probably the simplest thing is to create two definitions and alias them with a normal variable.

Code: Select all

define testchar_adv = Character("Test", kind=adv)
define testchar_nvl = Character("Test", kind=nvl)

default testchar = testchar_adv # note that testchar is a defaulted variable which can be changed and saved normally while the Character objects are defined and would not change

label start:

    testchar "1"
    testchar "2"
    $ testchar = testchar_nvl # the UI and mechanics of switching this for all characters being up to you, but seems relatively simple
    testchar "3"
    testchar "4"
I can't believe the answer was so simple, lol.

This worked marvelously. Thank you so much!

User avatar
Morhighan
Miko-Class Veteran
Posts: 975
Joined: Sun Jun 27, 2010 12:54 pm
Completed: AIdol, When Our Journey Ends, Forgotten Not Lost
Organization: MysteryCorgi
Tumblr: MysteryCorgi
Deviantart: MysteryCorgi
Soundcloud: MysteryCorgi
itch: MysteryCorgi
Location: USA
Contact:

Re: Not-so Permanent NVL-to-ADV switch

#4 Post by Morhighan »

I've used something similar to the above method and it's worked well. Specifically I used ADV for dialogue and NVL for narrative.
Just remember to add the "nvl clear" command after the nvl lines (if not every line, then whenever you switch to ADV, at your discretion.)

Post Reply

Who is online

Users browsing this forum: No registered users