The fact that you showed a 2nd, more complex item to save took this tutorial from being just another basic RUclips tutorial to being a really strong foundation for a lot us beginner devs to build off of. Thanks so much.
I have moved to Unity since subscribing to you but I don't want to unsub because you seem like a dope person and your tutorials are both fun and informative. Keep up the good work homie.
Odin, Izanagi and every other badass deity bless this channel - I have never encountered more helpful tutorials than yours, Peyton! Not just game coding, but in general! Somehow answering all my questions specifically, concisely, and making the videos ENJOYABLE to boot! Looking forward to more tutorials :))
Why on earth are you not using a with() statement at 13:52? You can use with to target all instances and just count a local var up each time to use as the array accessor
For anyone wondering the code can be simplified further by having instance_find be a parent object to all saveable objects, and having a variable within the room structure data array set to _inst.object_index, then calling it as the object when reloading the room! As seen in the video, this can also be used to save the state of the objects in the room as well, like if you want corpses or parts or whatever still left over! Also HP, effects, anything as long as its within the parent object!
Very informative! This was super helpful and even had a little bit of humor which I appreciated. Can't wait to watch more tutorials! I noticed in my recommended that you also have a tutorial for menuing which is something I've been wanting to do!
23:48 I don't understand why we set the image speed to 0 in the alarm instead of doing it in the create event, when i put image_speed = 0 in the alarm, by the time the speed gets set to zero , the sprite image_index becomes 1.5 and the code in the alarm which checks for the image_index to be == to 1 doesn't work. Setting the image speed to 0 in the create event fixes this problem but I would like to understand why this works in your case.
Oh good point and good question! Pretty sure I also have the image speed set to 0 in the actual sprite as well, so it wasn't animating in the first place and I just overlooked that fact. adding the "image_speed = 0" was just kind of a logical clean up to me but actually i dont think it makes much sense lmao!! Generally I would just set image speed to 0 in the sprite editor, but you could also set it in the create. OR you could do it the same way as in the video but instead of checking like "if image_index == 1" you could check "if floor(image_index) == 1" and it would work fine. Good catch!
Great tutorial, and it works for my coin system, but I cannot for the life of me get it to work with the inventory system from your previous tutorial. Does anyone know how to implement it?
I feel there's a way to automate it even further when it comes to the rooms, perhaps a means of setting it so that if the instance is greater than 0 within a certain room it automatically adds that room to the _roomStruct, I shall experiment and return in the future with my findings.
You don't have to type out the name of every single room to include it in the struct. Here's what I did in my SaveLoad object Create event: global.LEVEL_DATA = {
Hey Peyton, Nice video! However I am having a problem with using this system with the inventory system you made a few months ago. I have the load and save set to check for the item= but the game crashes with an error saying the argument is an array. I would appreciate help because my brain is fizzled.
Hey, pretty sure I was having the same issue. Try switching "global.item_item_list = array_create(0);" to "oItemManager.item_item_list = array_create(0);" in the create event for oSaveLoad. Your names are probably different than mine, but you get the idea
@@peytonburnham4316 ayyyyyyy epicc it'd be cool if u could show how todo battle systems that aren jus "attack, u lose health, u win" instead like makin stuff like Mario & Luigi or Undertale for example
You could make use of state machines and irandom_range(1,(whatever different types of attacks you want)) like If enemyturn{ Var Emoveused = irandom_range(1,3) switch emoveused { case 1: do whatever break; case 2: do something else break; case 3: big scary attack break; } } And have those random moves be something the player can interact with like undertale by having a “player_move_in_enemy_state” where it could be a smaller timing based mini game or something. Hope this helps!
so, ive gotten this all to work so far... except for the item image saving. i used your previous tutorial videos, and the way you made the item and had it set the sprite doesnt work with this video's method of saving the sprite. and the way you have the item calling its sprite is different enough that idk what else you did ( complete beginner). so could you either explain the newer item method or a different way to save the item image?
upon changing rooms, the instance creation code for setting what the overworld object is, seems to be being ignored, and only the creation code's item = global.item_list.small_potion; seems to be accepted by the step event's sprite_index = item.menu_sprite; i would like to have some of my ground items be able to animate, so i dont want to throw them all in 1 sprite
Thank you for the video, very helpful. Although I think I will need to automate the roomStruct stuff instead of manually writing in each room name for dozens of rooms Edit: did so using struct set and struct get: //save struct_set(global.levelData, room_get_name(room) + "Data", _roomData); //load _roomData = struct_get(global.levelData, room_get_name(room) + "Data"); also nice because struct set creates the new variable if it doesn't already exist. So you don't need to list all room names in the levelData struct
I know this may be a little late, but i've followed your video on how to create an inventory system. The thing is, i can't get this method to work with the "overworld item" that we created in that video. there is no error at all, the items just reappear when i go back when their not supposed to. Can you perchance help me or give me a hint on how i can possibly solve this issue?
How can I fix the following error? I32 argument is array at gml_Object_obj_item_overworld_Create_0 (line 3) - item = global.item_list.vegMegaBurger;//; ############################################################################################ gml_Object_obj_item_overworld_Create_0 (line 3)
19:25 what if you just put it on the layer it's supposed to be? Like if you know coins just go on the Coin layer, couldn't you just say to put it on "Coins" instead of layer?
i followed this tutorial step by step but somehow the save function doens't save a struct, when the load fuction is performed it immediately exit it (because the _roomStruct isn't a struct),, what am I doing wrong?
I tried making my own system from scratch with buffers but it had some erros and i couldnt find a way to save room data but i did make it fully automatic and as many save slots as i want
Question: How would one setup an automatic room save system where you don't have to assign every single room consecutively? Rather using an array of some kind. While I really appreciate the help the video has given, I do feel the room system isn't very practical
What about if you have gates with certain instance ID's. I'm working with the Heroes Trail tutorial to learn. Everything works besides the gates opening when I load.
Is there any way to bypass persistent instances when loading rooms? I've tried to solve this for a while but haven't come up with anything that works well
so, im starting a game and i would like to know, should i make the save and loading feature at the start of development or near the end or development?
Hey there, Peyton! I've seen your RPG videos, and they are real helpful! However, I want my character to go to a SAVEPOINT and save the game from that. How can I do it?
create an obj_savepoint and then stick some save code into it that brings up a menu when you interact with it. or an if statement that allows you to open your menu and access the save function when touching obj savepoint.
I wanted to give it a try but I ended up getting so many issues and it's virtually impossible to troubleshoot since you don't get any error messages when it crashes. If you know of any solutions please let me know. i really like this format of save/load room/game, id appreciate the help
same error here ############################################################################################ ERROR in action number 1 of Step Event0 for object _ob_saveload: I32 argument is array at gml_Script_load_room (line 54) -
A Local variable is a variable that can only be called in the object/script that you created it in. It looks like this: var _thisIsALocalVariable = 9+10; A GLOBAL variable is a variable that can be called anywhere, reguardless of where it was created. However, these kinds of variables are harder to run for your machine and can cause conflicts if they overlap, so use them sparingly. They look like this: global.ThisIsAGlobalVariable = 21; You can also call variables that you've created in other objects (like your player's hp) like this: if oPlayer.hp == 0 { instance_destroy(); }
so I've been getting this error and I've tried fixing it but nothing works. Any ideas? " Variable saves.obj_coin(100056, -2147483648) not set before reading it. at gml_Script_save_room (line 264) - var _coinNum = instance_number(obj_coin); " I've gone through the video 4 times and as far as I'm concerned, I've written everything exactly as shown in the video. What am I doing wrong?
20:43 in Room Start event there was an error it was typed load_game(); then at 20:53 it shows load_room(); it should be load_room, not sure if this has anything to do with your issue just noticed it.
The fact that you showed a 2nd, more complex item to save took this tutorial from being just another basic RUclips tutorial to being a really strong foundation for a lot us beginner devs to build off of. Thanks so much.
3:37 End of Intro/Demonstration
you sir are a godsend, you restored all my previous knowledge on GML from years ago, in a much better way too. great work, and thank you!
You’re welcome and thanks!
the sigh in the beginning felt too relatable
I have moved to Unity since subscribing to you but I don't want to unsub because you seem like a dope person and your tutorials are both fun and informative. Keep up the good work homie.
Thanks haha! That’s super nice of you! Good luck with everything you’re working on!
Amazing as usual, so useful !! Can't wait for the next and hopefully someday a battle system tutorial, it would be amazing :)
Will do for sure! It'll be a long video to make so I have to have a bit of free time!
Odin, Izanagi and every other badass deity bless this channel - I have never encountered more helpful tutorials than yours, Peyton! Not just game coding, but in general! Somehow answering all my questions specifically, concisely, and making the videos ENJOYABLE to boot! Looking forward to more tutorials :))
Thanks so much that means the world to me!! Glad i could help out!!
Persona 5
Why on earth are you not using a with() statement at 13:52?
You can use with to target all instances and just count a local var up each time to use as the array accessor
For anyone wondering the code can be simplified further by having instance_find be a parent object to all saveable objects, and having a variable within the room structure data array set to _inst.object_index, then calling it as the object when reloading the room! As seen in the video, this can also be used to save the state of the objects in the room as well, like if you want corpses or parts or whatever still left over! Also HP, effects, anything as long as its within the parent object!
Very informative! This was super helpful and even had a little bit of humor which I appreciated. Can't wait to watch more tutorials! I noticed in my recommended that you also have a tutorial for menuing which is something I've been wanting to do!
23:48 I don't understand why we set the image speed to 0 in the alarm instead of doing it in the create event, when i put image_speed = 0 in the alarm, by the time the speed gets set to zero , the sprite image_index becomes 1.5 and the code in the alarm which checks for the image_index to be == to 1 doesn't work. Setting the image speed to 0 in the create event fixes this problem but I would like to understand why this works in your case.
Oh good point and good question! Pretty sure I also have the image speed set to 0 in the actual sprite as well, so it wasn't animating in the first place and I just overlooked that fact. adding the "image_speed = 0" was just kind of a logical clean up to me but actually i dont think it makes much sense lmao!!
Generally I would just set image speed to 0 in the sprite editor, but you could also set it in the create. OR you could do it the same way as in the video but instead of checking like "if image_index == 1" you could check "if floor(image_index) == 1" and it would work fine.
Good catch!
Great tutorial, and it works for my coin system, but I cannot for the life of me get it to work with the inventory system from your previous tutorial. Does anyone know how to implement it?
Were you able to save the items with the old method?
this is exactly mu issue! been trying to fix it for days now, and i'm empty handed :o
oh my god he's BACK BABY!
First time on your channel, just an amazing videos, I literally never comment a video nor like, but u deserve it. Thank you.
I feel there's a way to automate it even further when it comes to the rooms, perhaps a means of setting it so that if the instance is greater than 0 within a certain room it automatically adds that room to the _roomStruct, I shall experiment and return in the future with my findings.
Have you returned with your findings yet?
You don't have to type out the name of every single room to include it in the struct. Here's what I did in my SaveLoad object Create event:
global.LEVEL_DATA =
{
}
for (var i = room_first; i
The applause at 22:35 killed me btw lmao, great tutorial, thanks for this
and in the functions script what I do? (im dumb
Hey Peyton, Nice video! However I am having a problem with using this system with the inventory system you made a few months ago. I have the load and save set to check for the item= but the game crashes with an error saying the argument is an array. I would appreciate help because my brain is fizzled.
Hey, pretty sure I was having the same issue.
Try switching "global.item_item_list = array_create(0);"
to "oItemManager.item_item_list = array_create(0);" in the create event for oSaveLoad.
Your names are probably different than mine, but you get the idea
@@jamesbb4448 Thanks! I tried it and it worked like a charm. I'm really glad people like you are always here to help!
You have such great videos 🙂 why is it that you use curly brackets after if statements?
Damn, just one week after I build my own multi save system, this drops. Would have saved me some brain ache!
eppiiic, tho when are ya guna make a battle system tutoriaall
Battle systems are a pretty tall order so it'll be a little while, but I'll definitely do one!
@@peytonburnham4316 ayyyyyyy epicc it'd be cool if u could show how todo battle systems that aren jus "attack, u lose health, u win" instead like makin stuff like Mario & Luigi or Undertale for example
You could make use of state machines and irandom_range(1,(whatever different types of attacks you want)) like
If enemyturn{
Var Emoveused = irandom_range(1,3)
switch emoveused {
case 1:
do whatever
break;
case 2:
do something else
break;
case 3:
big scary attack
break;
}
}
And have those random moves be something the player can interact with like undertale by having a “player_move_in_enemy_state” where it could be a smaller timing based mini game or something. Hope this helps!
so, ive gotten this all to work so far... except for the item image saving. i used your previous tutorial videos, and the way you made the item and had it set the sprite doesnt work with this video's method of saving the sprite. and the way you have the item calling its sprite is different enough that idk what else you did ( complete beginner). so could you either explain the newer item method or a different way to save the item image?
upon changing rooms, the instance creation code for setting what the overworld object is, seems to be being ignored, and only the creation code's
item = global.item_list.small_potion;
seems to be accepted by the step event's
sprite_index = item.menu_sprite;
i would like to have some of my ground items be able to animate, so i dont want to throw them all in 1 sprite
@@lloyd011721Were you able to save the items with the old method?
@@gassashadow1930 what old method?
How would I save the array that is my item inventory from the other video?
Thank you for the video, very helpful. Although I think I will need to automate the roomStruct stuff instead of manually writing in each room name for dozens of rooms
Edit: did so using struct set and struct get:
//save
struct_set(global.levelData, room_get_name(room) + "Data", _roomData);
//load
_roomData = struct_get(global.levelData, room_get_name(room) + "Data");
also nice because struct set creates the new variable if it doesn't already exist. So you don't need to list all room names in the
levelData struct
I have to do something in the create event?
what is your _roomData?
Great video! I’ll take on the next one sometime soon
I know this may be a little late, but i've followed your video on how to create an inventory system. The thing is, i can't get this method to work with the "overworld item" that we created in that video. there is no error at all, the items just reappear when i go back when their not supposed to. Can you perchance help me or give me a hint on how i can possibly solve this issue?
Great tutorial, this worked so well!! thanks so much for running through it :)
How can I fix the following error?
I32 argument is array
at gml_Object_obj_item_overworld_Create_0 (line 3) - item = global.item_list.vegMegaBurger;//;
############################################################################################
gml_Object_obj_item_overworld_Create_0 (line 3)
Ah!!! Perfect Timing!
19:25 what if you just put it on the layer it's supposed to be? Like if you know coins just go on the Coin layer, couldn't you just say to put it on "Coins" instead of layer?
Thanks so much for this tutorial! You really made this easy and understandable! I really appreciate this. Thanks again!
i followed this tutorial step by step but somehow the save function doens't save a struct, when the load fuction is performed it immediately exit it (because the _roomStruct isn't a struct),, what am I doing wrong?
This video helped me a lot! Thank you very much!
I tried making my own system from scratch with buffers but it had some erros and i couldnt find a way to save room data but i did make it fully automatic and as many save slots as i want
Question: How would one setup an automatic room save system where you don't have to assign every single room consecutively? Rather using an array of some kind. While I really appreciate the help the video has given, I do feel the room system isn't very practical
What about if you have gates with certain instance ID's. I'm working with the Heroes Trail tutorial to learn. Everything works besides the gates opening when I load.
Whats in the step event of obj_item?
timestamp for me:
12:46
could u make a tutorial on manipulating variables in order to get different endings in a game?
I followed this to the T but with enemies instead of coins, and for some reason it’s not working at all?
Is there any way to bypass persistent instances when loading rooms? I've tried to solve this for a while but haven't come up with anything that works well
Hey how are we about going on altering this code for our own projects that we release. Like how do you want to be credited.
so, im starting a game and i would like to know, should i make the save and loading feature at the start of development or near the end or development?
Would anyone happen to know on how to reset these structs and arrays. Like a room reset.
how can I access the left coin number in a room?
LETS GOOO PEYTONN!!!
Hey there, Peyton! I've seen your RPG videos, and they are real helpful! However, I want my character to go to a SAVEPOINT and save the game from that. How can I do it?
create an obj_savepoint and then stick some save code into it that brings up a menu when you interact with it. or an if statement that allows you to open your menu and access the save function when touching obj savepoint.
@@lloyd011721 thanks
Could anyone help me on what tutorial to do first? Because this seems.... weird.
You should start with his How to Make an RPG series
Very important question. If I were to port this to html5, I would need to use ini. files instead right. How would I be able to do that?
I wanted to give it a try but I ended up getting so many issues and it's virtually impossible to troubleshoot since you don't get any error messages when it crashes. If you know of any solutions please let me know. i really like this format of save/load room/game, id appreciate the help
THANK YOUU!!
How to make a character following you?
And i love your video❤
Oh my god
Thanks!
same error here
############################################################################################
ERROR in
action number 1
of Step Event0
for object _ob_saveload:
I32 argument is array
at gml_Script_load_room (line 54) -
epic yes
thank you !
14:12
at least can you provide the source code?
you can get the source code for any tutorial from Peyton's partreon. It's in the video's description
ou hello!
What does “var” mean?
variable.
In GameMaker you use it to set local variables
A Local variable is a variable that can only be called in the object/script that you created it in.
It looks like this:
var _thisIsALocalVariable = 9+10;
A GLOBAL variable is a variable that can be called anywhere, reguardless of where it was created. However, these kinds of variables are harder to run for your machine and can cause conflicts if they overlap, so use them sparingly.
They look like this:
global.ThisIsAGlobalVariable = 21;
You can also call variables that you've created in other objects (like your player's hp) like this:
if oPlayer.hp == 0 { instance_destroy(); }
Bump the Algorithm !
innit
promosm
EXPLAIN IT BETTER
DONT WORKS
a 2 minute long intro, i already know the rest of the video is not worth watching!!!
so I've been getting this error and I've tried fixing it but nothing works. Any ideas?
" Variable saves.obj_coin(100056, -2147483648) not set before reading it.
at gml_Script_save_room (line 264) - var _coinNum = instance_number(obj_coin); "
I've gone through the video 4 times and as far as I'm concerned, I've written everything exactly as shown in the video.
What am I doing wrong?
20:43 in Room Start event there was an error it was typed load_game(); then at 20:53 it shows load_room();
it should be load_room, not sure if this has anything to do with your issue just noticed it.