Navigation and Map - DRincs-Productions/NQTR-System GitHub Wiki

Navigation and Map

INFO: Navigation is based on Constants:

  • What this means is that it cannot be changed while the game is running
  • The benefit is not having to worry about rescues coming from different versions

Navigation

The navigation system is designed in the following way:

  • The player is placed in a room
  • To be reachable, each room must be connected to a location and a map
  • The player, from the current room, can move to another room at the same location.
  • For move in another location the player need to use the map.

Usage

INFO: For don't create problems if you not implement this in your project, the rooms, locations and maps are not defined by default empty. BUT, if you use the dict without initializing it, the system not save the changes.

For implement this you need to add this in your project:

init python:
    from pythonpackages.nqtr.navigation import Room
    from pythonpackages.nqtr.navigation import Location
    from pythonpackages.nqtr.navigation import Map

# Wiki: https://github.com/DRincs-Productions/NQTR-toolkit/wiki/Navigation-and-Map#room
define rooms = [
]

# Wiki: https://github.com/DRincs-Productions/NQTR-toolkit/wiki/Navigation-and-Map#location
define locations = [
]

# Wiki: https://github.com/DRincs-Productions/NQTR-toolkit/wiki/Navigation-and-Map#map
define maps = {
}

Room

The Room class is a class for create a room.

This class extend ( have all properties and methods of ) Button class, is very important read the NQTR Button wiki.

Add a Room in list

(code-snippets: DR_RoomAdd_in_list)

define rooms = [
        Room(id="room_id", location_id="house", name=_("My room"), button_icon="icon myroom", background ="bg myroom", action_ids = []),
        Room(id="my_room", location_id="house", name=_("MC room"), button_icon="icon myroom", background ="bg myroom", action_ids = ["sleep","nap",]), 
        Room(id="bathroom", location_id="house", name=_("Bathroom"), button_icon="icon bathroom", background ="bg bathroom"), 
        Room(id="lounge", location_id="house", name=_("Lounge"), button_icon="icon lounge", background ="bg lounge"), 
        Room(id="terrace", location_id="house", name=_("Terrace"), button_icon="icon terrace", background ="bg terrace"), 
    ]

Change Room

INFO: changing the info will also change the current location

(code-snippets: DR_ChangeRoom)

label start:
    call change_room(room_id = "my_room")

Go Previous room

IMPORTANT: the chronology of rooms is only one, so be careful in using it

call go_previous_room

Room with Picture in background

Screenshot 2023-10-21 115715

With to the "Picture in Background" option you can add rooms not on the right but in an x, y position of your preference. Read more here: Picture in Background

Location

The Location class is a class for create a location.

This class extend ( have all properties and methods of ) Button class, is very important read the NQTR Button wiki.

Add a Location in list

(code-snippets: DR_LocationAdd_in_list)

When the player click on the location button, the player will be moved to the external_room_id and close the map.

define locations = [
        Location(id = "house_id", key_map="map", name=_("My house"), picture_in_background="icon map home", external_room_id="house_id_external_room", xalign=0.5, yalign=0.5),
]

Change Location

( it is not recommended to use it, it makes more sense to use Change Room )

call change_location(location_id = "my_location")

Map

The Map class is a class for create a map.

This class extend ( have all properties and methods of ) Button class, is very important read the NQTR Button wiki.

Screenshot 2023-10-21 120422

Add a Map in dict

There is the possibility to add more maps and connect them with map_id_north, map_id_south, map_id_west and map_id_east.

(code-snippets: DR_MapAdd_in_dict)

define maps = {
    "map": Map(
        name = _("Map"), background = "bg map",
        map_id_north = "nightcity",
        map_id_south = None,
        map_id_west = None,
        map_id_east = None,
    ),
    "nightcity": Map(
        name = _("Night City"), background = "bg nightcity",
        map_id_north = None,
        map_id_south = "map",
        map_id_west = None,
        map_id_east = None,
    ),
}

Block Map

For block the map you need to add the flag goout.

Read more about Flags

For Example:

# https://github.com/DRincs-Productions/renpy-utility-lib/wiki/Flags
define flag_keys = [
    # Map Block
    "goout",
]

Check Go Out

Please note that to check whether the map can be used I used check_goout in open_map:

define block_goout_dialogue = _("Now is not the time to go outside")
label check_goout:
    if(not get_flags("goout")):
        "[block_goout_dialogue]"
        call screen room_navigation
    return

Unlock the map:

python:
    set_flags("goout", True)

Best sites for creating map images

Closed Room

( in progress )

is closed room

( in progress )

Add event when room is closed

( in progress )