variable

  1. Smenkare

    ds_map question

    I have equipment system written in ds_map. When i click in inventory some piece of armor i have code similar to this. with(oPlayer) { oPlayer.sprite_index = ds_map_find_value(armory[0],"spriteIdle"); oPlayer.equiped = ds_map_find_value(armory[0],"attackSprite")...
  2. I

    GMS 2 How to set variables for clones of the same object?

    So I am working on a fighting game, and in it (of course) I want to have two players to fight against eachother. The problem is that I have 2 instances of the same object and they both use the same controls. How do I make them have separate "moves"? (I would give some code but I have no clue on...
  3. FacesOfMu

    GMS 2 How to find where/when a variable changes?

    Hi all, I've got an object that seems to change it's layer to -1 at some point and I can't find out where this happens. I've tried searching all uses of the word "layer" in my code to see what each line does, and nothing seems to indicate where the change is happening. I've even added a debug...
  4. X

    GMS 2 enemy code isn't a constant?

    i'm trying to make enemy code (i'm using Shawn spalding's tutorial for melee attacks) but when i try to star the game it says the enemy state should be constant. but i can't make it constant because i'm confused. switch (state) { case ENEMYSTATE.FREE: EnemyState_Free(); break; case...
  5. Pfap

    variable argument scripts

    I have been over the manual sections about scripts and passing arrays to scripts. Maybe I missed something, but I'm making this posting not because I'm having trouble finding a solution I already know of several work arounds. I'm making this posting, because I want to finally figure out how to...
  6. J

    Question - Code Changing the speed of an object also changes the x coordinate

    In a game that I am making I made a flamethrower that spews out little flame objects, but while testing the game I found out that some were getting spawned slightly to the right of where they should be spawning. After I looked through my code I was confused by the fact that nothing should be...
  7. D

    GMS 2 Fatal error in collision between player and bullet

    So i have decided to give my boss bullets so he could damage and annoy the player. It was all working right until one of my colleagues decided to test it. Everything was going ok until he boosted against one of the bullets which prompted the error I thought at first it had to deal with the...
  8. P

    Could use some help with variable

    Hello guys. I been watching some of the tutorials in yoyo games, the one that you have to destroy meteorites. It work perfect but now i want to improve some mechanics. I tougth i could give the bigger meteorites more life than the small ones but the things is i dont know how i can assign...
  9. B

    Comparing a list of enums and a single variable

    in short i have a list of enums i save for different monsters, for a combat i have a number get randomly generated and assigned to a variable called enemy1, enemy2 etc and that determines what appears, what is the best way to check which monster in the list of enums can be compared to the number...
  10. D

    (Fixed) Enemy pushback different from given value

    When i first programmed the collisions with the enemies, it worked exactly how I wanted. But, it recently derailed and now it is fixed on (-)5 and not (-)10 . I thought it could be about the speed limits i put but all of them are (-)10 or above. I changed the values on the collision but it still...
  11. H

    GMS 2 (SOLVED)Issue with setting local variable to (global variable value - amount)

    Hello, I keep getting the following error: when trying to do the following code: new_total_coins = old_total_coins - global.costume_price if(draw_coin_amount > new_total_coins) { switch(draw_coin_amount) { case 0: draw_coin_amount= global.coins_totalcollected...
  12. I

    GML [SOLVED]Variable changes back to old value

    I have score variable(well the variable is actually named scr) which i want to add one point to itself when another variable(called fallen) is equal to true. The problem is that when the variable goes back to being false my score variable also goes back to its old value (aka zero). Why is that...
  13. L

    Need help with transition between rooms

    Hi!, excuse the poor english. I dont know if anyone is following friendlycosmonaut tutorial in how to make a farming rpg, my question comes from there: For tje transition between rooms she uses an enumerator for declaring directions, (90 is right, 180 is down, 270 left, 0 up). Then she creates...
  14. D

    GMS 2 *Title Change* Character not dashing when in the air

    So I am trying to make a variable to save me time when i call the letter 'Z' var zkey = keyboard_check(ord('z')) From my current knowledge, i know for ord() to work it needs to be in a argument which it is not in the code I wrote. However, writing if keyboard_check(ord('Z')) = true { do...
  15. Robzoid

    [Solved] Odd Behavior With Trig Function

    So, in an object's step event, I've got the following: rad=rad + 0.1; increment=(cos(rad)); blahTest=(increment); When I put increment and blahTest into show_debug_message, I see that their values are different. show_debug_message(blahTest); show_debug_message("")...
  16. M

    Check the value of a variable in a specific instance

    Hi there! After reading a lot of thread about similar problem I still can't figure it out how can I check a value of a specific instance and do an action. That's my code. It works but it's always goes to Option room and never in Atrio room. if mouse_check_button_pressed(mb_left) {...
  17. G

    Camera Object Won't Read Variables (SOLVED)

    (TL;DR version - I'm having trouble with the codes shown in the image. The game acts like the "view_w_half" and "view_h_half" variables don't exist on the step event page, and only uses the data they stand for if I put the data itself into that place)...
  18. O

    Instance_create no longer accepts variables

    The code is essentially: (during attack frame) { var damage = instance_create(x,y,obj_damage) damage.creator = id; damage.attack = 5; } (in the damage objects create event) z = creator.z; The game crashes and gives me "<unknown object> <unknown variable> "creator" "z" error
  19. Q

    Variables change with change of a room DnD

    So, is there a way to make a variable not change while i change rooms? I am creating a simple clicker game, but whenever you change room from main room to the shop the score variable just resets. It's worth mentioning that I am using DnD too.
  20. V

    That's a lot of questions

    Hello everyone, I'm new at GMS, and i'm trying to make a 3D puzzle horror game based on I'M SCARED and DO NOT BELIEVE IN HIS LIES. i'm seeing that is really challenging, specially because its 3D and GMS its made specially for 2D games, so i have some questions and i think you guys can solve...
Top