Well, my script is rather short with big intention. It's also very specific to the entities I've made so it might be difficult for me to explain, but I'll give it a go. It's only about half way done at the moment though, but I can't finish it before I fix this issue. Prepare yourself for a long explanation! :O
I'm making a puzzle that requires the player to find small slates represeting paths. Here's an example of how a horizontal slate looks like:
Spoiler below!
This entity also has a body with the name of "west_east" This comes in play later.
I also have slates representing vertical paths, turns and combinations. The body names of all these include the directions they face: "north_south" "south_east" "north_west_south" are examples.
These slates can be placed with sticky areas into the slots of a big frame in the floor. This frame has 5x5 slots with a few built-in slates that can't be moved. It looks like this (the empty slots have the Ankh symbol):
Spoiler below!
This frame is also located inside a maze of sorts. The map consists of 5x5 rooms with doors in between them. The setup for this whole room is like this:
Spoiler below!
This system works in the way that each room has their own co-ordinate. The room in the middle is named x3y3. This is also the room with the cross slate as well as where the big frame is located.
The idea is to place a slate in the slot next to another used slot in order to open the door in between the represented rooms, as long as the slates connect with each other. For example placing the horizontal slate in x4y3 will open the door connecting room x3y3 and room x4y3. The naming system I'm using for the doors (they are MoveObjects btw) is "move_room1_room2. The door mentioned above is named "move_x3y3_x4y3" This is the best system I could come up with to make it organized. The first room is always the north or west room, the second room is always the south (if first is north) or east (if first is west).
The remaining things to mention within the map are just the different slates as well as the sticky areas. The slates do not use any naming system other than the body names mentioned way up, but they all include "slate" in their name. The sticky areas are named "area_co-ord" similar to the doors, except they only have 1 co-ord for the room and not the 2 connecting rooms. These areas accept entities with "slate" in their name to connect with. Upon connecting, they call the script function "AttachSlate."
So far in the script, I have not implemented the connecting slates part. So far it only opens a door leading to the room represented by the area the slate was placed in. This is where the problem occurs. Only sometimes, the game freezes up, just like what happened to you, the moment the slate connects with the area. I'm unsure why this happens. It seems to work fine with the horizontal slate in all slots (though only on the "west" side). Whenever I take a "north_east" slate, it freezes. It also freezes (randomly) if I enable the script for closing the doors again within a "DetachSlate" function, which is similar to the attach one. I have excluded it because I don't need to close the doors before I can properly open them.
Do you understand what's going on here? Any ideas?