P
Pandemicsnowman
Guest
Hello! It's pleasure to be a part of the GMC. I'm new to GMS2 but am familiar with game design and programming in general. I'm running into a strange problem I was hoping to get some help on from some of the GMS vets out there.
TL;DR
Basically the issue is there is a specific script that is running every tick (as if from a step event) that I can't for the life of me figure out what is triggering it. Please read on for the full details:
ISSUE:
I have an empty default room named rm_mapView with a single object instance placed in it. The object, called obj_dungeonController has no parents or inheritance. It is set to visible, but no other settings are set to it. It has only one event:
* Create - sets up some instance variables, and then executes a script called "scr_generateDungeonData" at the end.
The scr_generateDungeonData script is a 580 line script that generates a dungeon. It runs a secondary script at the end of it, called scr_setDungeonData which loops through and randomizes certain data elements.
When I run the game, this is what happens, in order.
Here is the code error message:
The error makes it seems like this collision_multiple script is being called from the scr_setDungeonData script, but there's not a single reference to it. What is very interesting though, is if I comment out the first script execution (scr_generateDungeonData) from the Create Step code, the problem goes away. Commenting out the execution of scr_setDungeonData on like 580 of scr_generateDungeonData does not however.
Here's the code for the Create Step for the dungeon controller:
I'm also not sure how this collision_multiple script is running every tick. Unless I'm missing something fundamental, isn't all of this script code running under the Create Event of the object? I thought the Create Step occurs only once per object. Any ideas on what I should look at next?
Other Notes:
* The collision_multiple script is an included asset with engine I purchased. It is required to make the main game engine work properly without fatal errors. The main game engine works fine on its own.
* I suspected this script was possibly being run from a persistent object, but the only object that has any persistence at all is an object called objControl, an included asset. However, all it really does is handle keyboard and Xbox360 inputs. No collision steps, or even any script executions.
* There are a bunch of parent objects and entity objects with code that does collision checks. However, these are completely unrelated to the obj_dungeonController.
* Collision_multiple runs every tick after the Create Event "finishes". I verified this by commenting out all code in the script and just showing a show_message dialog at top of it.
Any help is greatly appreciated! Thanks guys.
TL;DR
Basically the issue is there is a specific script that is running every tick (as if from a step event) that I can't for the life of me figure out what is triggering it. Please read on for the full details:
ISSUE:
I have an empty default room named rm_mapView with a single object instance placed in it. The object, called obj_dungeonController has no parents or inheritance. It is set to visible, but no other settings are set to it. It has only one event:
* Create - sets up some instance variables, and then executes a script called "scr_generateDungeonData" at the end.
The scr_generateDungeonData script is a 580 line script that generates a dungeon. It runs a secondary script at the end of it, called scr_setDungeonData which loops through and randomizes certain data elements.
When I run the game, this is what happens, in order.
- The Main Menu is loaded, awaiting user input
- I click the test button that runs room_goto(rm_mapView);
- The room rm_mapView is loaded.
- The Create Event of the Dungeon Controller is executed successfully.
- scr_generateDungeonData is executed, and then runs scr_setDungeonData on the last line.
- scr_setDungeonData is executed successfully.
- After the last line of code for the scr_setDungeonData, the game then attempts to run a non-referenced script called "collision_multiple" every tick. This causes a fatal error because that script is expecting arguments that are undefined when called.
Here is the code error message:
Code:
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Create Event
for object object94:
instance_place argument 3 incorrect type (undefined) expecting a Number (YYGI32)
at gml_Script_collision_multiple (line 16) - var hit = instance_place(x1, y1, obj);
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_collision_multiple (line 16)
called from - gml_Script_scr_generateDungeonData (line 580) - script_execute(scr_setDungeonData())
called from - gml_Object_object94_Create_0 (line 36) - script_execute(scr_generateDungeonData()) ;
Here's the code for the Create Step for the dungeon controller:
Code:
// run at the start of each dungeon level.
// ------------------------------------------------------------------------------------------------------------------------------------
//
// GENERATION SETTINGS
//
//------------------------------------------------------------------------------------------------------------------------------------
maxDungeonX = 22 ;
maxDungeonY = 14 ;
dungeonX = 22 ;
dungeonY = 14 ;
roomSeedMax = 3 ;
var baseRoomCount = 38 ;
var extraRoomCount = 12 ;
global.stage = 0;
// ------------------------------------------------------------------------------------------------------------------------------------
randomize() ;
global.stage++ ;
maxRooms = baseRoomCount + irandom( extraRoomCount ) + (global.stage*4)
roomList = ds_list_create() ;
dungeonData = ds_grid_create(dungeonX, dungeonY) ;
ds_grid_clear(dungeonData, -1) ; // the grid will store indices of speicific rooms ds_maps. Clear all cells with -1
generateDungeon = true ;
script_execute(scr_generateDungeonData()) ; // commenting this line out stops the collision check from happening. Why?
I'm also not sure how this collision_multiple script is running every tick. Unless I'm missing something fundamental, isn't all of this script code running under the Create Event of the object? I thought the Create Step occurs only once per object. Any ideas on what I should look at next?
Other Notes:
* The collision_multiple script is an included asset with engine I purchased. It is required to make the main game engine work properly without fatal errors. The main game engine works fine on its own.
* I suspected this script was possibly being run from a persistent object, but the only object that has any persistence at all is an object called objControl, an included asset. However, all it really does is handle keyboard and Xbox360 inputs. No collision steps, or even any script executions.
* There are a bunch of parent objects and entity objects with code that does collision checks. However, these are completely unrelated to the obj_dungeonController.
* Collision_multiple runs every tick after the Create Event "finishes". I verified this by commenting out all code in the script and just showing a show_message dialog at top of it.
Any help is greatly appreciated! Thanks guys.