• Hey! Guest! The 40th (!!!) GMC Jam will take place between February 25th, 12:00 UTC to March 1st 12:00 UTC. Why not join in this very special anniversary jam! Click here to find out more!

instance

  1. MarceloP

     Set object's draw order on "instance_create_layer"

    Hello guys! I'm working on a prototype and I've reached a moment where I'd like to create some objects on a Instance Layer. I called "instance_create_layer" and got what I wanted. But since I have more than one thing that will be "dynamically instantiated" I ran into a problem. When calling...
  2. I

    Legacy GM [SOLVED] Random enemy movement in turn-based game

    Hey guys, so I have a state machine of sorts. When the player character moves from one 48 pixel cell to another, global var EnemyTurn turns from 0 to 1 and makes the enemy randomly move a cell with this script: ob_enemy.dirr = choose(0, 48, -48) ob_enemy.dirr2 = choose(0, 48, -48) with...
  3. S

    GMS 2 Change Variables Of Specific Instances

    I want to edit each instances variables depending on factors. I would also like a way to identify them so I can delete specific instances. Anyone know how to do this?
  4. T

    Game pause with sliders

    Hello everyone! I made pause system, everything works well. I have sliders (for game options) as individual objects and when I create them with instance_create I don't see any sliders. Without pause sliders created well. Is there way to create active object when game is paused (I use...
  5. L

    GML Instance room editor id aka name

    Hey, is there any way how to get that instance name from the room editor? "inst_something" by default. I'm trying to edit some things in game - for visual aid, save them to a file and load back once game is restarted. Now I can't store instance's id as this may vary between game runs so the...
  6. FlamingYeti

    GML Accessing instance stored in array returns invalid object (-4)

    Hello, In my game, I initialise 9 markers using instance_create(), and store them in an array. Later, this array is accessed by another object in order to retrieve a random object from the array, but the game crashes, and returns the following error: Pop :: Execution Error - Variable...
  7. DarklinkFighter

    [SOLVED] Changing depth and using instance_deactivate_layer?

    Hi, I encountered an issue with my game after I tried to change the way my pausing works... Previously I created a screenshot sprite and deactivated all Instances but reactivated some controller objects... Now I tried to implement an Inventory and for that I refactored it to...
  8. K

    GMS 2 Discrepancy of instance_number and actual count caused by instance_change?

    In my game i have a certain hierarchy built for more objects. "obj_interact" is my main parent and has the children "obj_tower" and "obj_rock". "obj_tower" also has a few children During the game your create instances of "obj_tower" and then choose one to keep. Here it can happen that an...
  9. J

    Create New instance, check all other of same instance, combine into new instance

    I have been fighting this for days now and its time I find some help... there are 10 stores. It falls into a inventory kind of thing. Basically, you pick the store (global.store) the item (global.item) rather its going in or out, (global.in_out) and quantity (global.qty1). After you pick all...
  10. T

    GMS 2 Getting Object Variable With No Instance

    I'm wanting to use an object's variables, not an instance's. I have a build system setup to reference an object and then build the referenced object. After selecting the object to build from the inventory I'm getting an obvious error that there is no instance to pull in data from the...
  11. A

    Storing items with lot of properties in an inventory

    Hi, I began GML a week ago, I'm starting a top-down RPG and my items have a lot of stats (bonus hp, defense, magic-fin, durability, quality, rarity, type, price, name, attack speed...), that I need to carry on easily each time I move items (picking them up, storing them in inventory or stash...
  12. A

    GML How to change layer of all instances of a specific object?

    I'm a beginner in Game Maker Studio 2 and I am trying to add a special feature to my game, but I just can't make it work fully, due to that the instances created by "room_instance_add" appear above every other instance in my room and I can't fix it completely with function "layer_add_instance"...
  13. T

    GMS 2 Assign several instances of an object to different paths

    Hej everyone. As the title already states, i would like to assign several instances of an object to different paths i set. Lets say i have an "enemy" object which has a specific behaviour: It follows a defined patrol path. If the player comes near the enemy, the enemy starts chasing the player...
  14. XirmiX

    GML with() doesn't recognise the other object that executes it?!

    The "with" statement is supposed to take an instance/object and make changes to that instance/object as if it's written within that instance/object, but the object that executes the statement can be called within the statement through "other", right? Well, I have had this work well until now...
  15. XirmiX

    GML [Solved] Iterations problem

    100 - 15 = -140 ? Well, that's what game maker thinks anyway. I have a game where a projectile is colliding with the tank that launched it (the player). The projectile bounces off the wall and hits the tank after being shot in a way that lines it up with the player's tank. I have a variable...
  16. jobjorgos

    Legacy GM why cant I add a marge to instance_activate_region?

    instance_activate_region(view_xview[0], view_yview[0], view_wview[0], view_hview[0], true); Works fine, it is just a little too small. Now I cant add a marge, whatever values I put it, I keep seeing objects dissappear at the edges. instance_activate_region(view_xview[0] - 264, view_yview[0] -...
  17. 2

    Characters taking damage from own bullets

    Im trying to make a "Super smash brothers" type of game. The problem Im having is that the characters can take damage from own bullets and destroy the bullet inside of itself. Its hard to explain but I hope you understand. What I was thinking of is that you can check if the object is created by...
  18. Nathan

    Mac OSX Room Editor : Replace/Swap objects?

    I am curious if there is a way to swap out objects that are placed in a room. For example, if I put 7 floor piece objects in a room and then wish to switch 4 of them with a spiked floor object, can I select an instance and swap it to a different object? For any video editors a perfect example...
  19. Dagoba

    Legacy GM with(furthest_object)

    Hello! I am trying to do something like this: - Get an ID of an object that is the furthest from goal.x and goal.y - The object must have a certain variable being a certain string, like "Blue" or "Yellow" How to do this? This is inside a script, you use it like this: scr_upgrade_item("Blue")...
  20. Ferrettomato

    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...
Top