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

variables

  1. MartinK12

    GML [SOLVED] Multiple show_debug_message but show each only once?

    Currently I have this and it’s working fine. In create event: debug_msg_1 = true; debug_msg_2 = true; ... debug_msg_n = true; In any other event, ie. step event I use this: //do some stuff if (debug_msg_1) { show_debug_message(“whatever”); debug_msg_1 = false; } //do some stuff if...
  2. S

    Creating from, picking random and adding to ds_map

    Let me explain my problem in this example. i have variables for each object objvar1 = 1 obj1disable = false objvar2 = 1 obj2disable = true objvar3 = 3 obj3disable = false objvar4 = 1 obj4disable = false one empty ds_map and i have 4 objects...
  3. N

    Need help with a variable

    So I have a variable (global.coins) and I want it to be the same value as before i restarted the game. I have a initialization room that sets the global.coins value to 0. How to fix this?
  4. NotTayyy

    GML Does it matter where I Create and update variables?

    So I Made an persistent inventory manager object and Inside it created a Data structure with all my Characters stats, Like the name, gold, Def, atk, Equipment slots, exp Etc... Then i want to make a Variable for each one so i can update them but i dont know where i should put them. So I Was...
  5. B

    Legacy GM [SOLVED] It's possible to leave a variable with no initial value?

    Is it possible to leave a worthless variable until a certain point in the game, even if its value grants a sprite_index a room-specific object? Or at least leave it with a default value that can later be changed by other values still in room_start? Well, whenever I start the game, I leave this...
  6. C

    GameMaker Animation playing AFTER the sound file

    This is the most bizarre situation. I have an animation I want to play as long as a certain sound file is playing. Let me see if I can explain my programming in D&D. Create Event: Assign Variable: radio_channel = 0 Set Animation Speed = 0 Set Sprite: anim_radio = 1 Step Event: If audio is...
  7. E

    Passing multiplayer gamepad variables to another object.

    I currently am working on a multi-player game, which has numerous special weapons. Player one and two both function fine and can enable special weapons independently. However, disabling a special weapon is not working correctly. For example, when shield is activated, it will remain active...
  8. D

    GameMaker [SOLVED] Variables not applying!?

    Hi, So, recently I almost fixed my door problem, and ran into another problem: the variables set up in the instance are not working: they're going back to the object defaults. For example, when I change dest_x and dest_y to 671 and 828 respectively, they are still act like their default...
  9. 2

    Asset - Scripts Asset Sale: Quick Debug, Show Variable Set Pages

    Have you ever had trouble visualizing what your variables are doing? Do you wish you could have watched the values of them to catch an error that you searched a long time for? Then this asset is for you, and it's deeply discounted for the time being. It allows you to watch variables over time...
  10. F

    electric current sent by player through metal crates

    so what I am trying to accomplish is when the player is touching a metal crate it becomes electrified then all metal crates touching it become electrified basically frying enemies touching electrified metal until the player is no longer touching the metal crate. This is an example of how i want...
  11. X

    Asset - Extension ActiveVars - Trigger Scripts on Value-Changes

    ActiveVars Marketplace: https://marketplace.yoyogames.com/assets/8286/activevars Category: Extensions Price: Free Description: ActiveVars allows you to link scripts and variables, so that when the variable changes the script is called. Common uses may include: * Settings (resolution changes...
  12. R

    *SOLVED*mutli-switch locked door, need pointers!

    EDIT: FOR CLARIFICATION: IM USING GAME MAKER 1.4 PRO Hey all! Im making a re-imagining for a beloved PS1/Sega Saturn/3DO classic, "CASPER", and I have most everything figured out and working already (Item pickups, health, teleporting, basic switch and door functions, chests, locked key doors...
  13. M

    GameMaker Getting Object Variables?

    Getting the value of instance variables is easy. You can just say myNumber = obj_OtherObject.myNumber or something like that and it will work. You can also get the value of certain variables. object_get_sprite will get the sprite index of an object. object_get_parent will get the index of the...
  14. Zahk

    GameMaker Keeping variables between rooms - only Global Variables and Persistent Objects?

    I'm trying to do something very simple - I want to talk to an NPC, and then have them say something else after you talk to them the first time, even after you leave and return to the room they're in. Now I know I can keep track of the variable that changes this with a Global Variable or by...
  15. A

    Maximum variable amount

    I have a health variable which deducts minus 1 for every enemy collision - i also have health box pickups which add +50 to the overall health (see code below), trouble is if the enemy deducts -10 points and I pickup a health box it goes beyond my default health range of 200. Is there is way to...
  16. L

    Trying To Get Power Cables And Batterys To Work

    So im trying to get power cables to work like transfer power from a generator to lets say a battery iv gotten most of it working but how i have it set up its triggering all the cables so if i have a cable connected to a generator to a battery and another separate cable (not connected to a...
  17. H

    (SOLVED) Camouflage sprite with tile- Is there a tile color variable?

    Hello! New to programming/gamemaker and I'm using DND. I am trying to match the color of my roof collision sprite to the color of the tile it's on. So no matter which room it spawns in, it is visually invisible. I was thinking to do this by: Create: set sprite color to (tile_color) but...
  18. T

    (GML2) How do I access my parent's variable?

    In the parent object (create), I have: var AC = 10; In the Child Object (create), I have: event_inherited(); show_message(string(AC)); But I get an error, saying that the variable "not set before reading it." It doesn't matter where I put that line of code (in the create event, or Keypress...
  19. Dr_Nomz

    GML [SOLVED] Having trouble with scripts... (creating AMMO variable in inventory / Array)

    RIGHT so, I recently discovered the ease of creating custom items and such with an inventory, but I'm still learning. For example, I managed to make the inventory have equipment slots for using weapons! Yay! Problem, they have infinite ammo. Now there are ways of using global variables and...
  20. N

    Need Code Help

    Hello GMC, could anybody please help me with something. How do you create an object with variable set to that object say for example if the code below existed: key press Z instance_create_var(x,y,item,var1 = 0 | var2 = 0 | var3= 0) This is the best way I can think to explain it sorry :) Please...
Top