Xyphon Posted January 21, 2009 Share Posted January 21, 2009 How would you make it so that a move has a cool down? Like, after you use a move it takes a certain ammount of turns to use it again. How would I go about doing this? Link to comment https://forums.phpfreaks.com/topic/141837-cool-downs-with-php/ Share on other sites More sharing options...
npsari Posted January 21, 2009 Share Posted January 21, 2009 Are you talking about a while loop You mean how can it pass some turns then do something Link to comment https://forums.phpfreaks.com/topic/141837-cool-downs-with-php/#findComment-742744 Share on other sites More sharing options...
Xyphon Posted January 21, 2009 Author Share Posted January 21, 2009 Kind of, but I don't mean you use it, wait turns, and then it does something. I mean you use it, and it does something on the turn you use it. And then, you have to wait like 3 turns for example until you can use it again. Link to comment https://forums.phpfreaks.com/topic/141837-cool-downs-with-php/#findComment-742776 Share on other sites More sharing options...
The Little Guy Posted January 21, 2009 Share Posted January 21, 2009 a database? Link to comment https://forums.phpfreaks.com/topic/141837-cool-downs-with-php/#findComment-742779 Share on other sites More sharing options...
Prismatic Posted January 22, 2009 Share Posted January 22, 2009 Record the total number of moves made Then when a move is made that you wish to have locked out for a certain number of moves, save it along with the current total number of moves, then do something similar to below <?php $total_moves = 1234; $locked_move = 1231; $move_diff = $total_moves - $locked_move; if($move_diff < 3) { echo "Sorry, you need to make 3 moves before you can use this move"; } else { echo "Using move"; } ?> Link to comment https://forums.phpfreaks.com/topic/141837-cool-downs-with-php/#findComment-742914 Share on other sites More sharing options...
haku Posted January 22, 2009 Share Posted January 22, 2009 You are going to need a database where you can store counters. Increment the counter on each turn. Link to comment https://forums.phpfreaks.com/topic/141837-cool-downs-with-php/#findComment-742917 Share on other sites More sharing options...
revraz Posted January 22, 2009 Share Posted January 22, 2009 I think you want to use Javascript for this, because I assume you want it to be active when the timer expires and not have to reload. Link to comment https://forums.phpfreaks.com/topic/141837-cool-downs-with-php/#findComment-742926 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.