variable change

  1. G

    Windows Upgrade function issues | Store Variable in Variable

    Hello, I have been working on my second game for a month now and wanted to add a series of upgrade Buttons to give the Player the ability to improve their stats (walking speed, mining speed etc.). I wrote a function that is supposed to be triggered if my button gets pressed. That works perfectly...
  2. W

    Legacy GM Can't stop character movement

    I'm going through my project and trying to make sure my character can't be allowed to move whenever certain things are going on like item menu being shown, or speaking to NPC characters, and for some reason it's only working half the time. For example when I speak to ONE NPC I can't move until...
  3. G

    Legacy GM Instance variable logic problem

    Ok is very simple, I have an object with this in create event: acc_y = -8; and this in the step event: if (acc_y < 12) { acc_y +0,25} y = y + acc_y; Now i thought that the istances of the object didn't share the internal variables. When I spawn one moster his speed will be like +5, but if i...
  4. M

    Changing the values in variables

    Hi everyone, I have a problem with my variables. When I create a new instance for my bullet in the bullet object I have. //create event movespeed = 16; grav = 0; bounce_force = 5; dir = oPlayer.image_xscale; hspd = dir * 4; vspd = 0; image_xscale = oPlayer.image_xscale; // step event hspd +=...
  5. NeZvers

    GML How script can change passed in variable

    I'm working on a button remapping system and since GM:S 1.4 has Joystick system instead all controllers being gamepads + there's no button_check_pressed for joysticks, I need to implement that too. At the moment the solution I see is the second variable for the button to check the previous...
  6. NeZvers

    GML [SOLVED] var instance_create() doesn't change instance variables

    I have a game master object that is creating controller objects and player objects in Room Start event but for some reason, It doesn't change needed variables (they stay as they are defined by default). All I need it to toggle what inputs controllers should respond. I don't get it, I thought...
  7. MIchael PS

    Legacy GM Variable access on Creation (?)

    Hello, I have a small question here. I have an obj_A and an obj_B. Through obj_ A, I create an obj_B, “instance_create(x,y,obj_B)”, and I want to access a variable in obj_B through obj_A, to change it. I don’t want to do it with “obj_B.variable” because I have a lot of obj_Bs and I want to...
  8. M

    How to change values like this?

    Is there any command to make any variable change, for example: hspd = 6 if hspd is a positive value, i want to make it negative,(if hspd = 6, then make it hspd = -6) and vice versa (if hspd = -6, then make it hspd = 6)
  9. J

    GMS 2 Not Recognizing Defined Variable (???)

    Hi there, I'm an intermediate GMS2 coder and have come across a bug that I cannot figure out for the life of me. I've used this technique many times and I have never had this issue. What I'm trying to do is simple: Create an instance from another instance, then set variables for the new instance...
  10. A

    Legacy GM Need help with drawing changing variables (SOLVED]

    I don't know how to explain it, so I got two pictures here: As the variables get larger, the numbers start to go into eachother. I want it so the MAXHP will draw in front of the HP, like this...
  11. A

    GML [SOLVED]Need portrait to change with text, but only when sentence has finished.

    What I'm trying to do is simply: Let the portrait change whenever the sentence has reached its end and I press "Z". Initially when I pressed Z, even before the sentence finished, the portraits would change before the sentence was finished. if keyboard_check_pressed(ord("Z")) { por_current +=...
  12. R

    Legacy GM Affect Single Instance (RESOLVED)

    I have 10 instances that work on an AI that I need variables changed when they hit a specific object but ONLY when they hit the object individually. An example would be I have an enemy that when colliding with a trigger its variables are affected but not the other 9 instances of the enemy. it...
  13. R

    Change a variable by pressing a jpg/png

    I'm new to programming and am currently using GameMaker Studio 2 Drag And Drop. I'm trying to perform a simple task but can't figure it out... I want to alternate between two audio tracks playing simultaneously by pressing a jpg/png (with mouse left). When the variable "CSwitch" is set to 0, the...
  14. A

    Legacy GM [SOLVED]accumulate things to pressed a giant button

    If something falls on a button(player or enemies) it will be pressed, but to pressed a giant button it will require more weight. Every object has a "size" variable that is 1(though I plan to put giant enemies with a bigger number). The problem here is that I can't figure out how to stack/combine...
  15. J

    gamemaker choose variable by button

    Hey guys, I have this RTS Game in which i have workers. I want to choose what the workers are mining, but i want to be able to choose what each individual worker mines. I would like to choose what they mine with buttons that pop up. The only thing that has to occur is that a variable changes...
  16. Image index and global variables[SOLVED]

    I'm have an issue getting variables to add or subtract during a collision. I have the collision check if the image index, of the other object, is equal to global.state and this works fine when it come to destroying the instance however when it is equal it's supposed to add to global.score and...
  17. H

    Legacy GM Object with gravity doesn't pass throw solid objects

    I made a ball that falls in vertical directioin with gravity. In the step event I used the following code:... if (vspeed<6.2) { gravity_direction=270; gravity=0.35; } ... So the vertical speed stops growing before it reaches 6.2. When the ball colllides with a solid block, I made it bounce...
  18. K

    Legacy GM [SOLVED] GUI Updating Trouble

    Hello, I'm trying to beat my head on this problem but can't seem to figure out what's wrong. So I have an object called "GUI" that handles the GUI in the game, but I can't seem to get it to update/display properly. It's code so far is: Information about object: GUI Sprite: Solid: false Visible...
  19. Z

    Resetting Variable problem

    In my game that I am working on you can switch between two characters and also encounter upgrades to improve your characters abilities. However I have ran into a problem were I tried experimenting with a double jump upgrade where a certain character can obtain it and double jump at will...
  20. konkrz

    Animation restart/variable change detection

    So i have run in to a bit of a problem. What i am trying to do is reset the image_index to 0 every time my bad guy changes state The problem is that this line "image_index = 0" needs to be in the step event so it runs on every step and as a result the image_index is always 0 so the animation...
Top