• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Topic closed no need to enter here

N

NizarPlayz

Guest
Hello i'm new to maker forums so the problem is that i have a MAZE game so like i wanted to make a folder
for my game like folder name is themes and people can create their own sprites and put in the folder and open in
game how can i make like that? sorry for bad english and i use game maker 8.0 PRO btw
 

jo-thijs

Member
Hi and welcome to the GMC!

Use sprite_add for this.
To find every file in the folder, use the find_file_* functions.
 
N

NizarPlayz

Guest
But i don't know how to code for example i want to do like this there is a folder where my game is located and the person opens game it automatically generates a new folder called themes where the person can modify the game like changing sprites if my player is blue in the game and a person creates image 32x32 full red and put it in themes folder then it replaces the blue player with red player so can you give me codes so i could copy them
 
N

NizarPlayz

Guest
also i created an object named folder added an event called other game start and executed a code file but i don't know what to do in it now? be sure to reply fast :/
 

jo-thijs

Member
In that case, I advise you to learn to code, it's quite fun!

Anyway, to create a directory, you do this:
Code:
if directory_exists(working_directory + "\themes")
    directory_create(working_directory + "\themes");
For other things, I lack information to help you.
For example, what images should be picked from the folder to be used for what?
 
N

NizarPlayz

Guest
Like my player looks like smiley face with a cap in game and in themes folder if i put a crying player image then in game the player should look like the crying face too
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Hi there! Okay, two things... Adding "Reply fast" to a topic title isn't really very nice. Everyone that posts here wants to get their problems solved as soon as possible, so trying to insist that we help you before anyone else isn't really very respectful to the rest of the users. Their problems are equally as important as yours. ;)

Second, for anyone to help you, we need to know exactly what you want to do, and also what you have done so far. Just posting to tell us what you'd like doesn't tell us how to help you achieve that, and I get the feeling you are just looking for a quick cut-and-paste answer. That's not how things work, I'm afraid. You should probably start by learning how to use the file functions before looking at adding anything into your game, so read up on them, then try and do what you want yourself and then post to show us what you have done if it doesn't work and we can then help you as we'll have a base to start from.
 
N

NizarPlayz

Guest
for example if i put an image called skin.png in the themes folder it will replace the other player image in-game and also i created object folder and added event create and executed code with
if directory_exists(working_directory + "\themes")
directory_create(working_directory + "\themes");
and i putted the object in main menu so when i loaded the game it didn't create any folder where my game is located
 
N

NizarPlayz

Guest
Hi there! Okay, two things... Adding "Reply fast" to a topic title isn't really very nice. Everyone that posts here wants to get their problems solved as soon as possible, so trying to insist that we help you before anyone else isn't really very respectful to the rest of the users. Their problems are equally as important as yours. ;)

Second, for anyone to help you, we need to know exactly what you want to do, and also what you have done so far. Just posting to tell us what you'd like doesn't tell us how to help you achieve that, and I get the feeling you are just looking for a quick cut-and-paste answer. That's not how things work, I'm afraid. You should probably start by learning how to use the file functions before looking at adding anything into your game, so read up on them, then try and do what you want yourself and then post to show us what you have done if it doesn't work and we can then help you as we'll have a base to start from.
ok sorry for being hurry :/ but i was so excited if i could modify my game
 
N

NizarPlayz

Guest
and i saw a post like that if you see this you will know everything




IsmoLaitela 6 points 7 months ago

Yes it is! My game has "theme" folder, where players can put their own custom sprites and open it in-game. I'm also planning to include small settings.ini as well, to allow players customize things even further. Yet, it's only affecting to cosmetic stuff.

Players can create their own levels and playlists easily using in-game editor! They can then share them with the world using in-game level uploader or creating bigger packages, zipping them up and uploading/sending somewhere.

If you are thinking code-wise, that's possible too. There used to be (correct if I'm wrong) string_execute() way before GM:studio came out. Nowdays, it's obsolete, so you need to create your own system! One good example I can think of is LieroXtreme/OpenLiero. Ways to create your own weapons is quite easy, but it still allows you to create complex weapon systems. It uses normal .ini-files and you just hit it with different variables.

So, yeah. Adding a mod support is possible.
This is what i want to do replacing textures modifying the game etc..
 

jo-thijs

Member
I'm a bit confused as to what exactly you're trying to do.

You want the player to costumize sprites and include that in some package that can be shared with other players?
Don't you think that would lead to name conflicts?
 
N

NizarPlayz

Guest
Yeah thats what i wanted the player can customize sprites by putting a customized image in the themes folder and in game it will show your own customized sprite now finally you get to know wohoo so excited to code for the first time umm.. wait i don't know how to code lol
 

jo-thijs

Member
Name conflicts? You ignored that part.

Anyway, you can check if a file exists by using:
Code:
if file_exists(working_directory + "\themes\SpriteName.png")
    // do something here if the file exists
You can replace an existing sprite by using the function sprite_replace:
Code:
sprite_replace(SpriteName, working_directory + "\themes\SpriteName.png", true, false, 0, 0);
 
N

NizarPlayz

Guest
I'm uploading a video on youtube of the concept when its done i will send the link to video and you can see what i wanted
 

jo-thijs

Member
Sure, so have you tried what I suggested and put this in the game start event or something like that?
Code:
if file_exists(working_directory + "\themes\playerskin.png")
    sprite_replace(playerskin, working_directory + "\themes\playerskin.png", true, false, 0, 0);
 
N

NizarPlayz

Guest
but how will that work if i open the game it generates the themes folder
 
N

NizarPlayz

Guest
i will try that too once i get the code to generate themes folder too
 
N

NizarPlayz

Guest
but when i will create the object which event should i add? and where should i place the object? in Main menu,Levels where?
 

jo-thijs

Member
i'm lazy to learn coding :/
Pls, learn coding fast.

but when i will create the object which event should i add? and where should i place the object? in Main menu,Levels where?
What object? I can't remember anything being said about an object.

If you're asking where my suggested code should be executed,
it doesn't matter as long as it is executed only once at the start of your game.
 
N

NizarPlayz

Guest
Pls, learn coding fast.


What object? I can't remember anything being said about an object.

If you're asking where my suggested code should be executed,
it doesn't matter as long as it is executed only once at the start of your game.
Ok i will learn coding as soon as possible and also object i created called test and event i added create and the code i executed is

if file_exists(working_directory + "\themes\playerskin.png") sprite_replace(playerskin, working_directory + "\themes\playerskin.png", true, false, 0, 0);
 
N

NizarPlayz

Guest
Oh oh you gotta see this error
___________________________________________
FATAL ERROR in
action number 1
of Other Event: Game Start
for object test:

COMPILATION ERROR in code action
Error in code at line 2:
sprite_replace(,default_skin working_directory + "\themes\playerskin.png", true, false, 0, 0);
^
at position 21: Unexpected symbol in expression.
 

jo-thijs

Member
Ok i will learn coding as soon as possible and also object i created called test and event i added create and the code i executed is
That was actually meant as a joke, but I do recommend learning to code.
It's lots of fun and it makes these kind of things so much easier.

if file_exists(working_directory + "\themes\playerskin.png") sprite_replace(playerskin, working_directory + "\themes\playerskin.png", true, false, 0, 0);
Ok, so what did it do?

Oh oh you gotta see this error
___________________________________________
FATAL ERROR in
action number 1
of Other Event: Game Start
for object test:

COMPILATION ERROR in code action
Error in code at line 2:
sprite_replace(,default_skin working_directory + "\themes\playerskin.png", true, false, 0, 0);
^
at position 21: Unexpected symbol in expression.
You switched a comma , from its place.
This: sprite_replace(,default_skin working_directory
should be this: sprite_replace(default_skin, working_directory
 
N

NizarPlayz

Guest
ERROR at line 2 pos 96:Wrong number of arguments of function or script thats what i get when i type the code
 

jo-thijs

Member
Ok, that one's my bad.
Try this instead:
Code:
if file_exists(working_directory + "\themes\playerskin.png") sprite_replace(playerskin, working_directory + "\themes\playerskin.png", 1, true, false, 0, 0);
 
N

NizarPlayz

Guest
OMG YES IT FINALLY WORKS THANK YOU SO MUCH FOR YOUR HELP HOW CAN I SAY THANKS TO YOU THANKS SO MUCH
but 1 problem its glitching out my skin see this it should have black glasses
 
N

NizarPlayz

Guest
here watch this video my glasses change to the background color watch this
 

jo-thijs

Member
You're welcome!

The reason the black glasses are gone is because of the "true" in my code.
That bit tells to remove a certain color from your sprite (the color you're using in the top left corner I believe).
Try changing it to "false" and see what happens.

Also, yes, I saw it, but you just bumped your topic by asking that, which is against the rules.
 
N

NizarPlayz

Guest
___________________________________________
ERROR in
action number 1
of Other Event: Game Start
for object playerskin:

Trying to replace non-existing sprite.
what now?
 
N

NizarPlayz

Guest
i do have a sprite called playerskin and my player object name is obj_player should i rename it to playerskin too?
 
N

NizarPlayz

Guest
I'm sorry but this is absolutely ridiculous. We can't pamper you. If you don't want to learn how to code, that's too bad. Coding is part of making a game. We really shouldn't be telling you how to make systems in your game without first seeing you put forth the effort to make it yourself. We shouldn't have to tell you that you added a comma where it shouldn't be. If you can't even copy and paste code correctly, then that's all we can do. This is a programming forum. There should be rules against posts like this.
Guess what when 2 elders are talking small people don't talk jk don't take it srsly
 
N

NizarPlayz

Guest
Thanks it worked i know i have bothered you alot by replying and replying again sorry for all this stuff i will never forget this what you have done for me thanks soooooo much
 

jo-thijs

Member
I just told you not to.
The error message is saying you already called an object playerskin.

Also, I have no idea what you're trying to say here:
Guess what when 2 elders are talking small people don't talk jk don't take it srsly
EDIT:
It solved it?
I'm guessing this is going to cause trouble in the future.

But for now, I'm glad your issue got fixed!
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Guess what when 2 elders are talking small people don't talk jk don't take it srsly
Guess what, when kids start trying to talk back to their elders they get slapped. ;)

Be polite and please follow the rules when posting, including the no bumping rule which says you should use the EDIT button to edit a previous post if less than 48 hours have passed.
 
N

NizarPlayz

Guest
You guys have really helped me a lot next tiime i'll code myself so i don't bother you guys :)
 
Top