This is outrageous! I was replaying The Witcher 3, and when I got to the A Hallowed Horn quest, I remembered that last time, Mithias got annoyed at me for killing the thieves. So this time, when I got to the thieves, and already knew that the horn was in a chest, rather than any of the thieves inventories, so I didn't actually have to kill them, I took care to not kill any of the thieves, while still retrieving the horn - which was a difficult job, as I couldn't loot the chest while the thieves were nearby, so I had to lure the thieves away from the chest, then circle back, and in the extremely narrow time window between when the battle music stops, and when the thieves return to the chest - as they start to return immediately once the battle music stops, loot the chest - made even more difficult by the game's janky input mechanics, where it seems to treat all inputs as a queue (moving, pressing 'e' to loot, etc), so I had to make sure not to queue up too much movement so I could quickly loot the chest before the thieves returned - anyway, I did it, after a lot of effort and time, and the cheek! Geralt still said that he killed the thieves when talking to Mithias, as if all that effort to not harm a single hair on their heads was for nothing!
They would lose any magical powers they may have had in the book, but anything they are, rather than can do, will stay. For example people from the His Dark Materials world would keep their daemons. You can take them out at any time in the story's plot, but for all other people consuming the media, it will be shown that the character suddenly disappears, with the rest of the plot being affected accordingly. People will notice this happening. The character is not under any sort of control by you once you have taken them out of the story, although they will appear next to you to start with.
I saw people going on about how great BG3 is on this site, so I thought I'd check out a let's play to see what all the fuss was about. I immediately fell in love with the graphics and the mechanics, such as the classes, races, spells, dice etc, but I disliked the emphasis on gore/horror in the game, and I know I wouldn't enjoy playing a game with that whole brain horror thing going on. Not to mention the price and storage requirements being excessive. (150GB!)
So, bearing in mind that, is there a game that would match my criteria, and if not, what do you think comes closest?
Intended output: { children: { Display: { children: { ... value: 2 } } } }
Real output: { children: {}, Display: {}, ... value: 2 }
Code:
// Load default settings
let defaultSettings;
load("/assets/json/default-settings.json", 'json', function(defset) {
defaultSettings = defset;
// Create custom settings
if(!Object.keys(localStorage).includes('settings')) {
setLs('settings', JSON.stringify({}));
};
customiseSetting('Display/UI/Distance', 2)
});
function settingURL(url) {
return('children/' + url.split('/').join('/children/') + '/value');
}
function customiseSetting(url, value) {
url = settingURL(url);
// Split the string by '/' and use reduce to access the nested properties
const newSettings = url.split('/').reduce(function(accumulator, val, index, array) {
// If the object does not have the current component as a property, create an empty object for it
// If the current component is the last one, assign the value
if (index == array.length - 1) {
accumulator[val] = value;
} else if (!accumulator.hasOwnProperty(val)) {
accumulator[val] = {}; // update the accumulator object
}
log([accumulator, val, index, array])
// Return the updated object
return(accumulator);
}, JSON.parse(ls('settings')));
log(newSettings);
setLs('settings', JSON.stringify(newSettings));
}
I've been trying unsuccessfully for several days to fix to what must be a simple error. I've looked over it myself, but I can't find the cause of the bug. I asked Bing, which usually helps, but it was unhelpful. So I'm sorry to be bothering you, but if you could help me solve this problem, I would really appreciate it.
EDIT: I fixed my code by using a recursive function as follows:
function customiseSetting(url, value) {
url = settingURL(url).split('/');
let newSettings;
function recursiveSet(object, list, index, setTo) {
// If the current component is the last one, assign the value
if(index == list.length - 1) {
object[list[index]] = setTo;
return(object);
} else {
// Check if it already contains the value
if(object.hasOwnProperty(list[index])) {
object[list[index]] = recursiveSet(object[list[index]], list, index + 1, setTo);
} else {
object[list[index]] = recursiveSet({}, list, index + 1, setTo);
}
return(object);
}
};
newSettings = recursiveSet(JSON.parse(ls('settings')), url, 0, value);
log(newSettings);
setLs('settings', JSON.stringify(newSettings));
}
@JackGreenEarth
@lemm.ee