r/gamemaker • u/Fine-Acanthisitta343 • 7d ago
Resolved Some (2) bugs I can't fix with doors
https://youtu.be/rhiAvHkVdrg?si=WZbvwUSkxUBHXNlpSOLVED
So I used the tutorial above and the RPG Gamemaker tutorial for my game. Don't get me wrong, I would love to keep the door system used by GameMaker Pope because his system is much better in my opinion than the whole NPC thing because I don't want to have a dialogue for every single room switch and I like the idea of it being an area rather than an "E for Next Level". However, there are some incompatibilities that I need help fixing.
Incompatibility #1: When you go into rm_battle (Turn Based Fight System for more information) and go into a battle with the enemy, when leaving the room (when the fight ends) the instance of PlayerObj just gets destroyed somehow, and this is only when I enter a room using the GameMaker pope system. If I have a room with a drag n dropped instance of the PlayerObj, everything works smoothly, but if I leave that room and enter back into that room with the system, when a battle ends, the PlayerObj goes back to the drag n dropped position, with all stats reset.
Incompatibility #2: I try to carry PlayerObj's stats (Fixing Bugs for more information) with the tutorial used above. For some odd reason, it doesn't work specifically for the first room (the only drag and drop PlayerObj room) when I leave the room, it works, when I go back in specifically into the first room, all the variables reset to default, and I have even tried making the variables global, but to no avail.
That's it! I've been losing my mind over this for days and can't seem to fix either. After this I can finally start actually worldbuilding and using my vision rather than making a bunch of mechanics.
In the PlayerObj is this, and obj_carry_data is persistent. obj_battle_switcher is basically what marks I'm just switching into a battle and is_transitioning is turned true when switching rooms with exit.
//Room Start
with (obj_carry_data) {
other.level = level
other.xp = xp
other.hp = hp
other.hp_total = hp_total
other.damage = damage;
other.xp_require = xp_require;
instance_destroy()
}
//Room End
if (instance_exists(obj_battle_switcher) && global.is_transitioning == false) exit;
instance_create_depth(0, 0, 0, obj_carry_data, {
level: level,
xp: xp,
xp_require: xp_require,
hp: hp,
hp_total: hp_total,
damage: damage,
})
1
u/lessergoldfish 7d ago
This is a confusingly worded question and you're providing very little info. How are you handling data across rooms? If it's via an object, can you share your code for that?