Page 1 of 1

[Bug] Editor crash when placing item on pressure plate

Posted: Sun Sep 16, 2012 12:22 pm
by Ixnatifual
If you place an item on a pressure plate in the editor, it crashes. I discovered it by placing a Peasan't Cap on level 1 of my dungeon (using the dungeon tileset). I placed a few other items on some of the other plates in the level and got the same result.

Code: Select all

[string "Pit.lua"]:0: attempt to index field 'animController' (a nil value)
stack traceback:
	[string "Pit.lua"]: in function 'open'
	[string "Pit.lua"]: in main chunk
	[string "MessageSystem.lua"]: in function 'sendMessageToEntity'
	[string "TriggerEvents.lua"]: in function 'fire'
	[string "PressurePlate.lua"]: in function 'pressed'
	[string "PressurePlate.lua"]: in function 'updateState'
	[string "PressurePlate.lua"]: in main chunk
	[string "MessageSystem.lua"]: in function 'sendMessage'
	[string "Map.lua"]: in function 'addEntity'
	[string "Item.lua"]: in function 'spawn'
	[string "Arch.lua"]: in function 'spawn'
	[string "DungeonEditor.lua"]: in function 'addObjectTool'
	[string "DungeonEditor.lua"]: in function 'mapView'
	[string "DungeonEditor.lua"]: in function 'update'
	[string "Grimrock.lua"]: in main chunk

OS Version 6.1

OEM ID: 0
Number of processors: 8
Page size: 4096
Processor type: 586

Total memory: 4078 MB
Free memory: 1104 MB

Display device 0:
  Device name: \\.\DISPLAY1
  Device string: NVIDIA GeForce GTX 560 
  State flags: 00000005

Display device 1:
  Device name: \\.\DISPLAY2
  Device string: NVIDIA GeForce GTX 560 
  State flags: 00000000

Display device 2:
  Device name: \\.\DISPLAYV1
  Device string: RDPDD Chained DD
  State flags: 00000008

Display device 3:
  Device name: \\.\DISPLAYV2
  Device string: RDP Encoder Mirror Driver
  State flags: 00200008

Display device 4:
  Device name: \\.\DISPLAYV3
  Device string: RDP Reflector Display Driver
  State flags: 00200008
Possibly one could place an item there with a script as a workaround, but I haven't tried.

Example dungeon:
http://www22.zippyshare.com/v/16114734/file.html

Re: [Bug] Editor crash when placing item on pressure plate

Posted: Sun Sep 16, 2012 12:32 pm
by Magus
I don't know how you guys do this. I can place items on pressure plate without getting any error :D

EDIT: can you upload the dungeon.lua so i can test it?

Re: [Bug] Editor crash when placing item on pressure plate

Posted: Sun Sep 16, 2012 12:42 pm
by Ixnatifual
Where do you want me to upload it?

Re: [Bug] Editor crash when placing item on pressure plate

Posted: Sun Sep 16, 2012 12:43 pm
by Magus
uh dunno, maybe pastebin or so

Re: [Bug] Editor crash when placing item on pressure plate

Posted: Sun Sep 16, 2012 1:00 pm
by Magus
Okay now I get it to crash, I guess you need to use a script entity with the code

Code: Select all

spawn("peasant_cap", LEVEL, X, Y, 1, "peasant_cap1")
and insert the level and (X,Y) coordinates

and delete your old peasant_cap in the dungeon.lua

Re: [Bug] Editor crash when placing item on pressure plate

Posted: Sun Sep 16, 2012 1:02 pm
by Ixnatifual
I found something called Zippyshare and uploaded it there: http://www22.zippyshare.com/v/16114734/file.html

Re: [Bug] Editor crash when placing item on pressure plate

Posted: Sun Sep 16, 2012 1:06 pm
by Ixnatifual
Magus wrote:Okay now I get it to crash, I guess you need to use a script entity with the code

Code: Select all

spawn("peasant_cap", LEVEL, X, Y, 1, "peasant_cap1")
and insert the level and (X,Y) coordinates

and delete your old peasant_cap in the dungeon.lua
Your script is a solid workaround, no doubt about it.

Re: [Bug] Editor crash when placing item on pressure plate

Posted: Sun Sep 16, 2012 1:08 pm
by spectre900
I made one type of work around for that by placing an item in an unused square and place a teleporter over it so it get teleported to the pressure plate when the game starts.

don't know how to use scripts yet so that way works best for me.

Re: [Bug] Editor crash when placing item on pressure plate

Posted: Sun Sep 16, 2012 1:28 pm
by Komag
placing that script is much better than using an empty room with a teleporter. All you need to do is:

- create the item "script_entity" (looks like a little "Lua") anywhere in your map
- select the "Lua" and in the Inspector window, below the line, type in:

Code: Select all

spawn("peasant_cap", LEVEL, X, Y, 1, "peasant_cap1")
(you change the LEVEL and X and Y, such as 1, 23, 17, so that line would read:

Code: Select all

spawn("peasant_cap", 1, 23, 17, 1, "peasant_cap1")
That's it! It will run the script when the map starts, instantly spawning the peasant cap to the coordinates you chose

Here is the note again from the scripting reference document:
spawn(object, level, x, y, facing, [id])
Spawns a new object at given position on a dungeon level where x and y specify the x- and y-coordinates on the map and level is a level index. facing must be a number between 0 and 3 and it indicates the following directions: 0=north, 1=east, 2=south, 3=west. id parameter is optional. If given it must be an unique id in the context of the dungeon. If not given an unique id is automatically generated.