Hello, I'm trying to make a plugin that allows players to download actordata from a remote server.
I have set up
a function to revrieve the data sent to the server as a JSON string
Send it to a variable and the apply it to a actorID 9.
It sort of works, but when I check the actorID with F8 it's not properly set up, it looks like this
And as soon as I add the character to the party the game crashes.
I've been walking in circles all night trying fix it, but I haven't managed to.
I followed the code written here, it works when i store the data offline and push it to a actor but not online.
Thanks in advance for the help.
I have set up
a function to revrieve the data sent to the server as a JSON string
JavaScript:
HP_SoulsLikeSummon.RetrieveData = function(){
console.log('Retrieving data from server'); //log if the function is running
fetch(HP_SoulsLikeSummon.ServerUrl + '/get-json')
.then(response => response.json())
.then(data => {
var actorData = data.system.variables._data;
$gameVariables.setValue(HP_SoulsLikeSummon.Download, actorData);
$gameActors._data[HP_SoulsLikeSummon.ReplacePlayerID] = $gameVariables.value(HP_SoulsLikeSummon.Download);
console.log('Success:', data.system.variables._data); //log the outcome
})
.catch((error) => console.error('Error:', error)); // error display
}
Send it to a variable and the apply it to a actorID 9.
It sort of works, but when I check the actorID with F8 it's not properly set up, it looks like this
And as soon as I add the character to the party the game crashes.
I've been walking in circles all night trying fix it, but I haven't managed to.
I followed the code written here, it works when i store the data offline and push it to a actor but not online.
Thanks in advance for the help.