Hell-o~! So, me is... well I have multiple names yus~!
Anywaa, I downloaded RPG Maker MZ... or MV... well... and I tried to run a challenge of "20 days game" lol...
I went into SUPER COOL idea... of making big RPG Game with combat, building, farming and all~!
I'm a WebDev, and I have my own Game Engine on C++... but I simply wanted to see what I could do in 20 days trial of RPG Maker... and well... I kinda wasted 2 of 20 of my days on doing nothing just because RPG Maker refuses to work as expected and it simply giving me headache so big that well... I dropped the project...
So... I did farming and mining, player can mine ores such as Copper, Iron, Silver, Gold and Adamantium, he can also get Wood and Stone for building... however... right when I wanted to make Plugin for building I run into problem where RPG Maker simply refuses to do what I'm telling him to do...
I did debug everything and...
1) I console log the entire data of the map and it looks correctly...
2) I console log the entire data of the current map and it also look correctly...
3) I run my loop to replace tiles and the data inside the console log looks 100% correct...
The world looks completly Fked up...
Some rows of the world copy properly while some other are garbage, there are random holes and all...
Here is the relevent JS:
Anywaa... I have 0 idea why it's not working...
I really tried everything... promise ~! ( returned )
Here is the YT vid of what I got so far ( keep in mind it could get deleted later cuz I always delete my stuff hyhyhy xD )
Anywaa, I downloaded RPG Maker MZ... or MV... well... and I tried to run a challenge of "20 days game" lol...
I went into SUPER COOL idea... of making big RPG Game with combat, building, farming and all~!
I'm a WebDev, and I have my own Game Engine on C++... but I simply wanted to see what I could do in 20 days trial of RPG Maker... and well... I kinda wasted 2 of 20 of my days on doing nothing just because RPG Maker refuses to work as expected and it simply giving me headache so big that well... I dropped the project...
So... I did farming and mining, player can mine ores such as Copper, Iron, Silver, Gold and Adamantium, he can also get Wood and Stone for building... however... right when I wanted to make Plugin for building I run into problem where RPG Maker simply refuses to do what I'm telling him to do...
I did debug everything and...
1) I console log the entire data of the map and it looks correctly...
2) I console log the entire data of the current map and it also look correctly...
3) I run my loop to replace tiles and the data inside the console log looks 100% correct...
The world looks completly Fked up...
Some rows of the world copy properly while some other are garbage, there are random holes and all...
Here is the relevent JS:
JavaScript:
function qCopyTiles(_Map,_Sx,_Sy,_Tx,_Ty,w,h){
var _MapData=qLoadMapString(_Map); // returns a promise
_MapData.then(function(_FileData){ // When mapData is fetched
console.log( _MapData);
if(_FileData==="failed"){console.log("Map Loading Failed");return;}
try{
console.log("Map Loaded Successfully");
var _Lines = _FileData.split('\n');
var _Line3 = _Lines[2];
var _MapData = _Line3.slice(8, _Line3.length - 2);
var _Array = _MapData.split(',');
_Array = _Array.map(value => parseInt(value.trim(), 10));
console.log(_Array);
console.log($gameMap.data());
// Loaded Map Data
// var _Data = "fu JSon";
// var _Height = 30;
// var _Width = 25;
// Current Map that player is on
var _CMap = $gameMap;
var _CWidth = _CMap.width();
var _CHeight = _CMap.height();
var _CData = _CMap.data();
var _Source = (_Sy * _Width)+_Sx; // Get start index of Source Map
var _Target = (_Ty * _CWidth)+_Tx; // Get start index of Target Map
// replace entire map with other map... how is it still not working...
// ChatGPT could not figure it out either xDD
// O1 either... GG WP I quit...
for(var c=0;c<h;c++){
for(var q=0;q<w;q++){
_CData[_Target++] = _Array[_Source++];
}
_Target+=_CWidth; // move to the next line of target
_Source+= _Width; // move to the next line of source by moving by it's width
}
// Force the game to update the map
// $gamePlayer.requestMapReload(); - apparently those are not needed...
// $gameMap.refresh(); it works same way regardless....
}catch(e){console.error("Error parsing map data:",e);}
console.log($gameMap.data());
});
}
function qLoadMapString(_Map){
const _File=`data/Map${_Map}.json`;
try{
const MapData = fetch(_File)
.then((Response)=>{
if (!Response.ok){
throw new Error(`Failed to load map file: ${_File}`);}
return Response.text();
})
.catch((e)=>{
console.error(e.message);
return "failed";
});
return MapData; // This will return the Promise, not the actual data
}catch(e){
console.error(`Unexpected error while loading map: ${e.message}`);
return "failed";}}
I really tried everything... promise ~! ( returned )
Here is the YT vid of what I got so far ( keep in mind it could get deleted later cuz I always delete my stuff hyhyhy xD )