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

function

  1. Staral

    SOLVED Passing an object to a function turns it into an ID

    Long story short, I need an object (like the physical object in a room) to be given to another object, this holder object is created during a function. The problem is that for whatever reason, I can't give the object or the Id to my holder object. // All of these turn it into an id (as in...
  2. JesusOnExtasy

    SOLVED Function - constructor not working 🤔

    Good afternoon everyone. I'm writing a function for a database of all skills, and I'm faced with the following problem... why doesn't the function work? // o_Skills_info // Create : Ski[ID] = noone; visible = false; Index = "Passive"; Sprit = s_Passives; Effec = "Increaces"...
  3. N

    GML How do I make arguments from an external function visible in a nested function?

    function return_function(_func, _args) { return function(){ return _function(_args); } } I want to make a return_func function that takes the _func function as the first argument and all the _func arguments as the next arguments. Our return_func function should return a...
  4. clee2005

    GameMaker Dynamic function execution

    Ok feeling pretty silly here not understanding exactly what's going on but thought maybe it's confusing for others too : I'm using : Create Event : rewardFunction = noone; User Function 1 : if (rewardFunction <> noone) rewardFunction(); And then in some other object I'm setting the...
  5. JesusOnExtasy

    Craft system : Resources and Equipment [ Actual topic ]

    Good afternoon, I have already solved the problem with the inventory, thanks to the kind people who are on the forum. Now I'm trying to write a system for crafting resources and equipment for a character. Who has already done this and what is the best way to do it ? Here's what's included in...
  6. EL0FBRENO

    GML How to check collision between two lines

    Is there any line_in_line function out there, like rectangle_in_rectangle? Because I searched for it and I wasn't successful at all. In short, I just want to check the intersection between two lines. If someone comes up with something, I would be greatfull!
  7. G

    GML How to store a function WITHOUT running it within an array?

    Hello. I am currently making an RPG, and am working on turn-based battles. As a part of this, my enemies and all their related data are stored as Structs within the main battle object when battle begins. Their 'actions' are determined through an array of functions (as shown in the image) and are...
  8. B

    SOLVED [SOLVED] Help implementing function keyword in scripts

    Hi everyone, I'm following FC's farming RPG tutorial on YT and am stuck on the 21st lesson (creating dialogue/text boxes). I'm a total newbie at coding, so the problem is throwing me for a loop, but I really don't want to give up after all this progress! After looking into it, I'm pretty sure...
  9. M

    GameMaker Is there a function to speed up music/sound

    Hey I am making a game where the music sometimes needs to switch from "slow" to "fast" and from fast to slow. Is there a function for this? If not, how can I do this? Do I need to make 2 different audios one slow and one fast?
  10. Null-Z

    GML State Machines, enum vs script functions question.

    what are both the advantages and disadvantages of using either for a state machine?
  11. Dimsum Cart Studio

    GameMaker How to Disable Middle Mouse Button Function Link to Manual

    As the title suggests: The feature where clicking a function with the middle mouse button jumps to the Manual page often troubles me. This issue arises when I'm trying to drag items in the operation area and accidentally release my middle button on a function, which causes a web page to pop up...
  12. DrStupid87

    GML Any advice for creating complex isometric hills?

    Hi all, So in my project, I have an isometric map that has its tiles mostly randomly generated. Each of the tiles has information about it stored in a ds_grid. These things are accessed by an enum: enum TILE { SPRITE, //sprite a tile should use Z, //tiles height SUBIMAGE...
  13. JAG

    SOLVED Destroyed object running Step event?

    Like the title says, I'm getting a crash where an object that is no longer valid after destruction (or at least marked for destruction) is running its step event and is crashing. I'm passing id into a function, and that function is trying to access the object's bbox_left. Can anyone explain to...
  14. Y

    Missing Object Index

    Hi, I am a new program who changed from Unity to Gamemaker Studio because of you know why. And I am currently stuck on something that I've been trying to fix all day. I followed this tutorial online (), but every time I try to get a button to do something this shows up. ERROR in action number 1...
  15. Red Needle

    SOLVED Capture temporary variables by value in function object

    Hello. I have the following scenario: function init_ent(_ent) { add_listener(EVENT_ID.DAMAGE, function() { _ent.hp -= get_combat_context().damage_value; }); } When init_ent is called, it creates a function object that contains a reference to the temporary variable _ent. This...
  16. GamerXP

    GameMaker Check if function is a constructor

    As title says. Is there a way to check if given function is a constructor or a normal function before calling it? Why I need it? I wanted to allow my state system to accept constructors as states when necessary, but I couldn't find a way to distinct between 2 in the docs. Am I missing something...
  17. Simon Gust

    GML When should I use a method? How does it work? How do I write it?

    Hey, I'm doing a bit of code restructure. Previously I've had all functionality in one object and it's getting a bit messy so I decided to split some functionality into other objects. I don't want to go full OOP but I just wondered... Is there any reason, beyond just following OOP guidelines...
  18. Jasuke

    Random not working

    for some reason the code doesnt create by random, it is always the same //step if (Slime_blue.x == x && Slime_blue.y == y) { if(place_empty(x + 32,y)== true) { instance_create_layer(x + 32,y,"Tile_layer",scr_grass()) } if(place_empty(x - 32,y)== true)...
  19. David Lorenz

    SOLVED Using a Script's arguments in a method it contains.

    Hello everyone! I just tried to write a script that contains a Time Source and it seems like I can't use the Script's arguments inside the method I want to call with it. (The following code is just an example) function...
  20. samspade

    GML Bound methods can access deactivated instances

    I have a pubsub system which instances subscribe to with a method that is bound to them. For example: pubsub_subscribe("ButtonSelected", function(_name) { position = _name; }); function pubsub_subscribe(_event, _func) { global.pubsub_manager.subscribe(id, _event, _func); } The...
Top