Breakable Obstacles triggering other things
Posted: Thu Jul 21, 2016 4:04 pm
Yet another question from me because things don't work quite the way I'd expect
The basic aim here is to have a room full of breakable obstacles (example: terracotta_jars_block) and have the player break them all to open a door (via a counter). I also like elsewhere in my dungeon to have breakable objects that trigger other things when broken.
The initial problem here is that breakable obstacles don't have connectors
My first experiment involved putting the Jars on Floor Triggers - this of course did not work because floor triggers don't detect obstacles / obstacles don't count as Items
So my first thought was to use the Jar's Heath reaching 0 and it seemed simple enough. Note because this was a experiment I wired one directly to the door rather than to a counter.
this however doesn’t work, because (I think) the 'terracotta_jars_block' object is replaced with a 'terracotta_jars_block_damaged' object and eventually a 'terracotta_jars_block_broken_1' - so I get a Nil Value error.
So I decided on a different approach using what I learned about spawning Monsters with connectors
this also gives me a Nil Value error, but this time on the Health Component for reasons I don't understand (according to the scripting reference page the Health Component does have an onDie)
So what next? Do I really need to go about making custom versions of the Breakable Obstacles with added Connectors? (and if so, how? I'm going to need pointing to a good tutorial)
The basic aim here is to have a room full of breakable obstacles (example: terracotta_jars_block) and have the player break them all to open a door (via a counter). I also like elsewhere in my dungeon to have breakable objects that trigger other things when broken.
The initial problem here is that breakable obstacles don't have connectors
My first experiment involved putting the Jars on Floor Triggers - this of course did not work because floor triggers don't detect obstacles / obstacles don't count as Items
So my first thought was to use the Jar's Heath reaching 0 and it seemed simple enough. Note because this was a experiment I wired one directly to the door rather than to a counter.
Code: Select all
if terracotta_jars_block_3.health:getHealth() == 0 then dungeon_secret_door_50.door:open() So I decided on a different approach using what I learned about spawning Monsters with connectors
Code: Select all
spawn("terracotta_jars_block", 8, 14, 17, 1, 0)health:addConnector("onDie", dungeon_secret_door_50.door:open() ) So what next? Do I really need to go about making custom versions of the Breakable Obstacles with added Connectors? (and if so, how? I'm going to need pointing to a good tutorial)