instance_destroy

  1. JAG

    SOLVED Destroyed object running Step event?

    Like the title says, I'm getting a crash where an object that is no longer valid after destruction (or at least marked for destruction) is running its step event and is crashing. I'm passing id into a function, and that function is trying to access the object's bbox_left. Can anyone explain to...
  2. M

    GML Instance_destroy() not working.

    Hi all, I have seen this has been posted a few times, but it seems everyone else has a fix that doesn't work for me. So now its my turn :) Quick background: my game is built on a massive 2d array. I use this array to create/destroy ground objects in a Terraria like fashion. I have the...
  3. Philip Wallin

    GameMaker [Help] Changing a variable for the closest object

    Hello dear gamemakers, im in a bit of a pickle. Im working on a platformer where you can pick up melon seeds (They're basically the games coins). I want this mechanic where you can pick up special seeds, the yellow ones which are worth more, then the closest "Normal" seed becommes a yellow one...
  4. Masstertron

    instance_destroy() doesn't work on parent objects

    Hi everyone! (GMS 2.3) I've noticed that using instance_destroy() doesn't work for children objects. For example, when I use instance_destroy(obj_enemy), my expectation is that all enemies, including child-object enemies (eg: obj_enemy_bird, obj_enemy_fish) are destroyed. What happens is no...
  5. If Programable_Matter

    How to destroy instance in specific room in GMS 1.4.9999

    Is there any particular way in which I can destroy an object in a specified room while being in a different room. There is only one instance of an object I would like to destroy in a particular room while I'm in another room. Any help would be greatly appreciated
  6. B

    GML Instance_destroy destroys the wrong instance

    So I'm working on this game where you use a crossbow as your main weapon. If a bolt is fired into a wall, it will get stuck and remain in the wall instead of just dissapearing. But I made a limit to the amount of bolts exsisting, so if it reaches it's limit it will destroy the first bolt. But...
  7. H

    GameMaker Alternatives to instance_destroy()

    Hey all, I've been using instance_destroy() to clean things up after a object dies in game, but multiple other objects are referencing the object that was killed, so I get errors when they try to call for something that doesn't exist. What are some ways I can clean up easy? Thanks!!!
  8. P

    GameMaker [SOLVED] Instance running code serveral times or old instances not destroyed properly

    Hi! I'm building a game where at one part you build a wood cutter, that goes collecting wood. This works fine, the problem is the next woodworker instance is running code twice. The third wood worker is running code three times and so on. This shouldnt be happening as when the wood worker...
  9. C

    Legacy GM Permanent/Global Instance Destroy

    Hey guys, I've a question. How can I let an instance destroy forever / permanent? It'd be very helpful for me. I'm a beginner and I'm not so good with GML (I'm doing about 65% with D&D), but I'm trying a few things with GML. global.instance_destroy doesn't works.
  10. F

    Legacy GM [SOLVED] instance_exists still detects destroyed objects?

    I'm using instance_exists(obj_player) (where obj_player is the name of the player's object resource) to see if there's an instance of the player in the room so I know when to respawn them, but it seems to be returning true even when I've called instance_destroy and removed the player from the...
  11. D

    Problems with Instance_create and Instance_destroy

    Hi all, I am having problems with the following code in as much that using the x and y coordinates of the main object then when the condition is met delete the relevant objects. well the program deletes the twao objects to the right of the main object but not the main object! ( The 2 to the...
  12. Z

    The instance_destroy() function

    is it possible to add a check in the function that doesnt require me writing the check manually, wether an instance of the specific object exists or not. currently you either have to use WITH or ask if instance exists function before using instance destroy with a specified instance. otherwise if...
  13. N

    Compile error for instance_destroy

    Using Android/Fire YYC I updated the software today and I am getting a compile error for every object that has instance_destroy () in any event, and either inside or outside of a with () statement. The error in the log claims that 4 arguments are being passed which is a mystery to me since...
  14. N

    Legacy GM instance_destroy() or instance_deactivate_object()?

    Hey guys! I made main menu in which when you press play and If there is saved game question is displayed. (Are you sure you want to start new game?) First I made it with instance_deactivate_object (In this case instance_deactivate_all(true); ) and than two new objects are created (Yes and No...
  15. C

    PathFinder Error when collision with ennemie

    Hi, I am a newb. I am still learning what all the functions and variables are. This is my error. ___________________________________________ ############################################################################################ FATAL ERROR in action number 1 of Step Event0 for object...
  16. cdgamedev

    GameMaker [SOLVED] Instance Not Destroying

    Hi, I'm trying to prototype gameplay for a game I'm making for my Computer Science lesson. Only problem is that 4 instances are created but for some reason they won't destroy. I've tried everything and they just won't destroy. Clearly this shows that the instances are destroying but the red...
  17. D

    help with alarms

    when i run this code it instantly destroys the instance :/ alarm 0 is set to 40 and alarm 1 is set to 120 even tried 340 :bash: if alarm_get(1) < 30 {instance_destroy()} if (global.hp > 0) {if alarm_get(0) <30 {global.hp -= 20} }
  18. P

    Regarding room_restart();

    My game is a 2D platformer with multiple rooms, you hit a door to progress to the next room. I made an empy object I named obj_roomcontrol with an Alarm event with the command room_restart(): Next I placed the spriteless object in all the rooms. Whenever my character died, an amount of time...
  19. K

    GML Destroy enemy and bullet on collision [GMS 1.4]

    TL;DR: Bullet doesn't get destroyed, even though instance_destroy(); is being called upon it via the enemy (red rectangle). Solution: In the enemy event of collision with the bullet, use the following code: bullet = instance_place(floor(x), floor(y), Bullet_Obj); if (bullet) { with (bullet){...
  20. F

    Legacy GM A problem with destroying objects

    I have 2 objects. obj_a and obj_b. They are the best of friends. obj_a has a variable called terminate_target. It is set to nothing. Zero. (terminate_target = 0; ) obj_b wants obj_a to destroy a target. When certain conditions are met, obj_a will destroy the target. The plot twist: obj_b...
Top