• 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!

make an object never appear again

S

Scissors

Guest
I just would like to know if there's a way for the player to get an item an make it never appear again in the game
 
S

Scissors

Guest
Sorry but I don't understand completely what you mean, isn't there a variable that just makes it never appear? I'm kind of a beginner tho
 

CloseRange

Member
what do you mean by "never appear again"?
i'm going on a limb and assume you mean that you want the object to just go away?
Code:
instance_destroy();
this will destroy the object that it's called in.
however if anywhere else you say to create another one of those objects then it wills till be made.
in that sense the object WILL appear again but only if you say to create a new on.
 

Vishnya

Member
Create a list of all objects and shuffle it with ds_list_shuffle. When you create a new object, just get the first item in the list and delete it
 
F

Frozen Stick

Guest
You can't make it NEVER APPEAR IN THE GAME AGAIN unless you never create the object in the game.
Also as @CloseRange said,you can destroy the object with the piece of code he wrote.
 
S

Scissors

Guest
Yes, I knew that. What I mean is if for example there's a level with a certain item you can get once but if you enter the level again it won't appear never again
 
D

drowned

Guest
just store the state of the item in a variable.
Code:
global.SwordAlreadyPickedUp = true/false;
objInventoryManager.SwordAlreadyPickedUp = true/false
Then in your room start code, or the create event of some room controller object, check that variable and delete or add the item as necessary
 

Joe Ellis

Member
I would store a small text file or simple data file storing whether that item has been picked up or not, then at the start of the room or level make the item check the file
 

Dupletor

Member
isn't there a variable that just makes it never appear?
No, and you just solved your problem. Create this variable. Then save it to a file. Before you call for the object's creation, verify this variable, and don't create it.

Create a list of all objects and shuffle it with ds_list_shuffle. When you create a new object, just get the first item in the list and delete it
Not only this is not related to the problem, but you also inject a new one: Controlling the existence of all the items in the entire game at the same time.
Both problems are solved the same way: Save the game.
By the way, though this is a very bad system, it's as close as one can get to unhackable. I use a system like this in my project, and basically if a hacker hacks a weapon into a room, by leaving the room it disappears because it was not acquired. xD

You can't make it NEVER APPEAR IN THE GAME AGAIN unless you never create the object in the game.
Wrong, you can create an object only once. Just like you can get to any event only once.
 
Top