Adding script/conditional to 'Switch on/turn on'?

NecroDeath
18 Sept 2016, 18:15

How do I set a conditional on the verb switch on/turn on? - I have a machine that I only want the player to be able to switch on if they have a coin/particular item.

I could get around this by 'use coin on machine' but seems inelegant


Jay Nabonne
18 Sept 2016, 18:47

Start with "what should the player see?" What is shown on screen if they have the coin when they try to turn on the machine? What should be shown on screen as a response if they don't have the coin? Come up with those first. Work out your use cases.

Then in your "turn on machine" verb handing, have an "if (coin.parent = player)" to see if the player has the coin. (Or substitute game.pov for player if you wish.) Then handle one case or the other.