I have been trying to use the 'dungeon_wall_open" entity in my mod allowing the player to look into another lower area.
This entity does not have an obstacle component so I tried to script one for it using the following...
dungeon_wall_open_1:createComponent("Obstacle")
dungeon_wall_open_1.obstacle:setBlockParty(true)
dungeon_wall_open_1.obstacle:enable()
Of course it does not work. Can anyone tell me why?
Component Creation
- Zo Kath Ra
- Posts: 944
- Joined: Sat Apr 21, 2012 9:57 am
- Location: Germany
Re: Component Creation
viewtopic.php?f=22&t=7897&start=10#p102392RayB wrote: ↑Sat Mar 21, 2020 4:13 pm I have been trying to use the 'dungeon_wall_open" entity in my mod allowing the player to look into another lower area.
This entity does not have an obstacle component so I tried to script one for it using the following...
dungeon_wall_open_1:createComponent("Obstacle")
dungeon_wall_open_1.obstacle:setBlockParty(true)
dungeon_wall_open_1.obstacle:enable()
Of course it does not work. Can anyone tell me why?
Doesn't explain why adding an obstacle component dynamically doesn't work, though.
I suppose if you wanted the obstacle component to work, you'd have to add it in the object definition.
Re: Component Creation
ObstacleComponent doesn't work when created dynamically, you'll have to put it in the object definition instead.
A couple other things to consider here:
1. dungeon_wall_open has minimalSaveState, so your created Component will not be preserved across save/load, breaking your dungeon.
2. dungeon_wall_open has "wall" placement, but ObstacleComponent blocks an entire square. This may or may not be a problem depending on where you're using it; if it is a problem, use DoorComponent instead.
A couple other things to consider here:
1. dungeon_wall_open has minimalSaveState, so your created Component will not be preserved across save/load, breaking your dungeon.
2. dungeon_wall_open has "wall" placement, but ObstacleComponent blocks an entire square. This may or may not be a problem depending on where you're using it; if it is a problem, use DoorComponent instead.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Component Creation
Yes
I will give the door component a try.
I will give the door component a try.
