TheGreatCthulhu
Member
Posts: 213
Threads: 10
Joined: Oct 2010
Reputation:
32
|
RE: Need script help asap! extremely difficult script!
But then you would have to check for each press which button was pressed, and keep track of if the sequence is good or not. This can be done, but then (especially if the sequence is long) you can get lost in lots and lots of lines of if-statements, which can be a nightmare to deal with if there's an error (especially a logical error - where everything runs, but something funky happens, and it doesn't work anyway).
Another benefit of obtaining the actual number is that you can then, for example, generate the secret code at random. You can make it different and random each time the player enters the level, and the pass code checking script would still work (it's independent of the actual sequence).
Of course, even a 3 digit random code is not so easy for the player to guess. But, if the digits in a 3-digit code are not allowed to repeat, then there's only 6 combinations:
123
132
213
231
312
321
This can be randomly generated by using an int array, and doing a few random swaps of the elements.
|
|
12-19-2012, 11:20 PM |
|