Advice on Having Multiple NVL Mode Text Positions (solved)
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.
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.
- noeinan
- Eileen-Class Veteran
- Posts: 1153
- Joined: Sun Apr 04, 2010 10:10 pm
- Projects: Ren'Py QuickStart, Crimson Rue
- Organization: Statistically Unlikely Games
- Deviantart: noeinan
- Github: noeinan
- Location: Washington State, USA
- Contact:
Advice on Having Multiple NVL Mode Text Positions (solved)
My game primarily uses nvl mode, but I would like the text position and nvl textbox image to change during certain parts of gameplay. Specifically, the textbox is centered when the player is walking around the map, but when they are in combat the textbox is on the right side, so centered text would clash with the GUI I put on the left.
I have been thinking about how I could implement this, like duplicating the nvl screen and changing the name to combat_nvl, but then I wasn't sure how I would make that screen show up (do I need to make a new character and somehow attach the new "mode" I created to said character?)
So before I messed around with this too heavily, I wanted to ask around and see if anyone has done anything similar or has ideas on a more elegant way to get this done? Thank you in advance!
I have been thinking about how I could implement this, like duplicating the nvl screen and changing the name to combat_nvl, but then I wasn't sure how I would make that screen show up (do I need to make a new character and somehow attach the new "mode" I created to said character?)
So before I messed around with this too heavily, I wanted to ask around and see if anyone has done anything similar or has ideas on a more elegant way to get this done? Thank you in advance!
Last edited by noeinan on Wed Dec 09, 2020 6:20 pm, edited 1 time in total.
- noeinan
- Eileen-Class Veteran
- Posts: 1153
- Joined: Sun Apr 04, 2010 10:10 pm
- Projects: Ren'Py QuickStart, Crimson Rue
- Organization: Statistically Unlikely Games
- Deviantart: noeinan
- Github: noeinan
- Location: Washington State, USA
- Contact:
Re: Advice on Having Multiple NVL Mode Text Positions
I tried copying the entire code for nvl mode in screen.rpy and gui.rpy, then changing it to grapple mode, then making a new "character" that speaks in grapple mode, but I got an undefined error when I tried to add that mode to the character. I suspect characters won't accept new modes I've created, as that part of the code is hidden somewhere else...
I also tried just changing the variable that sets the text position when I start and end grapple, but it did nothing.
I also tried just changing the variable that sets the text position when I start and end grapple, but it did nothing.
Code: Select all
hide screen basic_overlay
hide screen map_base
hide screen map_screen
$ gui.nvl_thought_xpos = 940
show screen grapple_overlay(npc=npc_dict["npc1"])
Re: Advice on Having Multiple NVL Mode Text Positions
Hi, noeinan,
I think you may use a variable, let's say variable in_combat = True when in combat and False otherwise. So, you can use this variable in nvl/nvl_dialogue screen for different positioning.
I think you may use a variable, let's say variable in_combat = True when in combat and False otherwise. So, you can use this variable in nvl/nvl_dialogue screen for different positioning.
- noeinan
- Eileen-Class Veteran
- Posts: 1153
- Joined: Sun Apr 04, 2010 10:10 pm
- Projects: Ren'Py QuickStart, Crimson Rue
- Organization: Statistically Unlikely Games
- Deviantart: noeinan
- Github: noeinan
- Location: Washington State, USA
- Contact:
Re: Advice on Having Multiple NVL Mode Text Positions
Thanks for the idea! I tried this:
But I got an error message.
Code: Select all
screen nvl_dialogue(dialogue):
layer "textwindow"
if grapple_textbox == True:
gui.nvl_thought_xpos = 940
else:
$ gui.nvl_thought_xpos = 620
for d in dialogue:
window:
id d.window_id
fixed:
yfit gui.nvl_height is None
if d.who is not None:
text d.who:
id d.who_id
text d.what:
id d.what_id
Code: Select all
I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.
File "game/code/base-system/screens.rpy", line 1906: u'gui' is not a keyword argument or valid child for the screen statement.
gui.nvl_thought_xpos = 940
^
Ren'Py Version: Ren'Py 7.3.5.606
Wed Dec 09 09:48:38 2020
- noeinan
- Eileen-Class Veteran
- Posts: 1153
- Joined: Sun Apr 04, 2010 10:10 pm
- Projects: Ren'Py QuickStart, Crimson Rue
- Organization: Statistically Unlikely Games
- Deviantart: noeinan
- Github: noeinan
- Location: Washington State, USA
- Contact:
Re: Advice on Having Multiple NVL Mode Text Positions
So, I tried another method, which is setting the text position to a variable and then changing said variable, but even if I define the variable in the line right before the gui. definition, it refuses to accept it...
Code: Select all
## The position, width, and alignment of nvl_thought text (the text said by the
## nvl_narrator character.)
define nvl_text_postion = 620
define gui.nvl_thought_xpos = nvl_text_position #change this to move nvl mode text
define gui.nvl_thought_ypos = 0
define gui.nvl_thought_width = 950
define gui.nvl_thought_xalign = 0.0
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/code/base-system/screens.rpy", line 2017, in script
define gui.nvl_thought_xpos = nvl_text_position #change this to move nvl mode text
File "game/code/base-system/screens.rpy", line 2017, in <module>
define gui.nvl_thought_xpos = nvl_text_position #change this to move nvl mode text
NameError: name 'nvl_text_position' is not defined
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/code/base-system/screens.rpy", line 2017, in script
define gui.nvl_thought_xpos = nvl_text_position #change this to move nvl mode text
File "E:\_RenPy\renpy-7.3.5-sdk\renpy\ast.py", line 2108, in execute
value = renpy.python.py_eval_bytecode(self.code.bytecode)
File "E:\_RenPy\renpy-7.3.5-sdk\renpy\python.py", line 2052, in py_eval_bytecode
return eval(bytecode, globals, locals)
File "game/code/base-system/screens.rpy", line 2017, in <module>
define gui.nvl_thought_xpos = nvl_text_position #change this to move nvl mode text
NameError: name 'nvl_text_position' is not defined
Windows-8-6.2.9200
Ren'Py 7.3.5.606
Wed Dec 09 09:58:32 2020
- RicharDann
- Veteran
- Posts: 286
- Joined: Thu Aug 31, 2017 11:47 am
- Contact:
Re: Advice on Having Multiple NVL Mode Text Positions
You have a typo in your code.
In the previous comment:
Should be:
But if you want to move both the textbox and the nvl background, you would need to change the xpos of the window in nvl screen, the text inside should automatically adjust to the new position.
In the previous comment:
Code: Select all
define nvl_text_postion = 620
Code: Select all
define nvl_text_position = 620
Code: Select all
screen nvl(dialogue, items=None):
window:
style "nvl_window"
if grapple_mode:
xpos 100
else:
xpos 0
The most important step is always the next one.
- noeinan
- Eileen-Class Veteran
- Posts: 1153
- Joined: Sun Apr 04, 2010 10:10 pm
- Projects: Ren'Py QuickStart, Crimson Rue
- Organization: Statistically Unlikely Games
- Deviantart: noeinan
- Github: noeinan
- Location: Washington State, USA
- Contact:
Re: Advice on Having Multiple NVL Mode Text Positions
Oof! Thanks for catching that typo. After fixing the typo I no longer get the error message, but it also does not move the text.
At your suggestion, I tried this:
And it works! Thank you so much, this problem was really frustrating me.
At your suggestion, I tried this:
Code: Select all
screen nvl(dialogue, items=None):
layer "textwindow"
window:
style "nvl_window"
if grapple_textbox == True:
xpos 356
else:
xpos 0
Who is online
Users browsing this forum: Bing [Bot], giorgi1111, Google [Bot], neometalero