Chromanin books spawn at wrong location
Describe the bug The Chromanin books spawn at the wrong location when they are read in another location than the overworld.
Expected behavior to be defined
Additional context Bug provided by Blubbler.
I see two possible solutions:
- If possible, spawn them at the right location in the overworld.
- If [1] is not possible, prevent the player from reading one of the books in every other location.
The first one will not be possible. Second might seem like the way to go.
For each book, analyze the bytecode of the item's on_state function to find the waypoint referred to by a call to Wld_InsertItem (second argument). Hook the on_state function to check if that waypoint exists. If not, immediately return from the on_state function, possibly with a voice line like this one (needs to be check for existence):
https://github.com/AmProsius/gothic-1-community-patch/blob/a867f2db6a820eb1980527f31d62fdceddd1f968/scriptbase/_work/Data/Scripts/Content/Story/SVM.d#L2148