Page 1 of 1
Component Creation
Posted: Sat Mar 21, 2020 4:13 pm
by RayB
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?
Re: Component Creation
Posted: Sat Mar 21, 2020 7:04 pm
by Zo Kath Ra
RayB 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?
viewtopic.php?f=22&t=7897&start=10#p102392
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
Posted: Sat Mar 21, 2020 7:14 pm
by minmay
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.
Re: Component Creation
Posted: Sat Mar 21, 2020 11:33 pm
by Isaac
RayB wrote: ↑Sat Mar 21, 2020 4:13 pm
...allowing the player to look into another lower area.
Is this intended to allow the player to view a lower area from above, with a wall or Bannister?
Similar to this?

Re: Component Creation
Posted: Sun Mar 29, 2020 7:00 pm
by RayB
Yes
I will give the door component a try.