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

variable

  1. L

    What is the point of targets on certain functions (e.g. random number) and what does the value of a variable do?

    Hello, I'm very new to programming so forgive me for being naive, but I'm confused regarding to importance of targets and variable values in GML. How exactly do these work? Thank you.
  2. RadarTruck

    Feather Issue - GM1013: not been previously declared

    I got over five hundred error messages after turning on "strict type-checking" in 2022.8, most of them were about instance variables, which feather told me were "not been previously declared". But as far as I can remember, instance variables are not declared explicitly, they are declared...
  3. thrownaway9k

    GML Variable not being changed through collision OR step event for no reason

    I have a trap object in an auto scroller set to slow down the players movement speed variables once they touch it. Here's the code that plays when the player collides with the trap: if(other.sprite_index = sGoop && other.activeGoop = true) { other.activeGoop = false; playerGooped =...
  4. S

    Using methods in object variables

    Is it possible to use a method for an object variable? Whenever I try doing something like below, it says "undefined variable 'function' referenced":
  5. O

    Basic Inventory

    Hi, I'm using inventory from COFFEE-BREAK TUTORIALS: SIMPLE INVENTORY my question is -how to do when I click on a key, for example, that a variable or global variable changes to 1? (global variable "1" means the door will open) but when I throw the key out of the inventory so that the variable...
  6. C

    SOLVED Checking if Variable with name of Value, is a Value.

    Ok, this is phrased semi-terribly but let me give an example, //State player level PlayerLevel = 1 //Define the level up skills LevelUpPool = { Level1 : "None" Level2 : "Fireball" Level3 : "None" Level4 : "Lightning" } //What I need to do if LevelUpPool.PlayerLevel != "None" {...
  7. R

    SOLVED Help. Destroy instance when the variable reaches 0.

    Hello, I have an issue in my game where I need to destroy an enemy object when the variable hp reaches 0. Whenever the variable changes, even if it isn't 0, the object is destroyed. I have run the game in debug mode and concluded that the object is destroyed. Also, when I remove the destroy...
  8. AnnoyingDoggoX

    SOLVED How to change variables in a struct

    function electric_jell() : actor() constructor{ name = "Electric Jell"; //base stats // life max_hp = 60; hp = 60; // vitality juice = 90; max_juice = 90; // speed spd = 2; // Strength/Power dmg = 15; //Resistance def = 5; //Emotion...
  9. M

    (Beginner) Cannot use function/script name for a variable.

    after going through the Space Mods - GML - Enemy Factions (2/3) - GameMaker Studio 2 tutorial on YouTube by Gamemaker. I've came into some trouble with testing the game. My compile error goes like this: Script:create_bullet at line 6; cannot use function/script name for a variable, using "_dir"...
  10. R

    SOLVED orbital system

    Hi guys, I'm having trouble developing the code for my game. Well, to be very direct: I want to make an object rotate around the player, I have a code already made for that, I'll put it here to better understand what I want //CREATE EVENT follow = obj_player orbitar_len = 20; orbitar_place = 0...
  11. B

    How to check if a variable and a randomized string occur at the same time

    To explain, I have a customer coming up and ordering. The ordering process is randomized so, for example, they might say either "Black Coffee" or "Latte". I want the player to be able to make the item the customer is requesting (already programmed) and then give it to the customer. I'm trying to...
  12. Telorr

    SOLVED Only Executing the Last Increments in For Looping

    Sorry, newbie here I have a bug in my code. //Collison Event with oEnemies if (attack == 1) { attack = -1; var target = instance_place_list(x, y, oEnemies, hit_list, true); for (var i = 0; i < target; i++) { show_message(string(ds_list_find_value(hit_list, i))); //This...
  13. shui.bdr

    changing variables of an instance

    so i need to make a moving platform, normally i'd create two objects with different directions, one for the platform that moves in the y axis and the other for the x axis, but i thought that there could be a way to change a variable of 1 single object and then in code say that for example if...
  14. Totofer77

    SOLVED How can I play the game despite having unused Variables?

    Well, I don't know if I'm the only one to complain about a problem like that, but the game won't load all because I have unused Variables Here is the Output : "cmd" /c subst Z: "C:\Users\totop\AppData\Roaming\GameMakerStudio2\Cache\GMS2CACHE" elapsed time 00:00:00.0759998s for command "cmd"...
  15. Rippley

    Interact with object with specific variable

    I want to make a portal, and what I did was make portal_1 and portal_2 and in each one put the variable "portal" that would be defined manually. And with that, I want to make that when the player collided with portal_1, it would go to portal_2 with the same variable. Ex: Portal_1 with the...
  16. D

    (SOLVED) Need help with warping the player through rooms.

    So I know how to make the object that warps the player through the different rooms because I have a separate game that I was working on and it worked out fine (that game was transferred over from gm 1.4 to gm2), here's the code of that original object: obj_player_1.x = target_x; obj_player_1.y...
  17. T

    [Solved] Argument not able to be set

    Hi everyone, I am having trouble with a script I created that uses functions from csanyk's iMprOVE_WRAP extension. The purpose of the script is to return some traits in an array of the nearest object from the calling instance. I use this so enemies know the location of the player. To get the...
  18. S

    Having an error pop up.

    So when i try to run my game after adding some scripts from a tutorial i get this error ___________________________________________ ############################################################################################ ERROR in action number 1 of PreCreate Event for object o_entity...
  19. JelleB

    global hp?

    Is there a way to have an hp variable that can be accessed anywhere in the game? I want the variable to stay the same until i change it. I'm pretty sure you use global variables?
  20. FoxyOfJungle

    SOLVED Passing global variables to variable definitions?

    Hi, Is there no way to pass global variables using "Variable definitions" of an object? I defined particle_system_index and particle_index: I put the variable here but it doesn't seem to recognize it... I've tried switching to all types there in the selection but it doesn't work. When...
Top