Advertisement
TheHirou

ds_grid problem

Aug 11th, 2022
964
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. enemySelected=beforeSort[# 0, optionEnemy-1]
  2. fighterUsing=beforeSort[# 0, enemyQuant+fighterOrder]
  3.  
  4. prompt="Which action will fighter "+string(fighterOrder)+" execute? ("+string(action[fighterOrder])+")"
  5.  
  6. if keyboard_check_pressed(vk_left){option=0}
  7. if keyboard_check_pressed(vk_right){option=1}
  8.  
  9. if option=0{
  10. if keyboard_check_pressed(vk_up){optionEnemy++}
  11. if keyboard_check_pressed(vk_down){optionEnemy--}
  12. }
  13.  
  14. if fighterOrder<fighterQuant and finished=false{
  15. switch (option) {
  16.     case 0:
  17.             action[fighterOrder]="attack"
  18.             if keyboard_check_pressed(vk_enter){
  19.                 stringLog+="Fighter "+string(fighterUsing)+" will attack the enemy "+string(enemySelected)+"!\n";
  20.                 fighterOrder++;
  21.                 ds_grid_add(checkWhoTo,2,fighterOrder,enemySelected)
  22.                 option=0;
  23.                 if fighterOrder=fighterQuant{finished=true}
  24.                 }
  25.            
  26.         break;
  27.     case 1:
  28.             action[fighterOrder]="defend"
  29.             if keyboard_check_pressed(vk_enter){
  30.                 stringLog+="Fighter "+string(fighterUsing)+" will defend!\n";
  31.                 fighterOrder++
  32.                 ds_grid_add(checkWhoTo,2,fighterOrder,"none")
  33.                 option=0;
  34.                 if fighterOrder=fighterQuant{finished=true}
  35.                 }
  36.            
  37.         break;
  38.     default:
  39.         show_message("Option not added.")
  40.         break;
  41. }
  42. }
  43.  
  44. if finished=true{timer[1]++}
  45. if timer[1]>10 and timer[1]<15
  46. {
  47.     for (var i = fighterOrder; i < allQuant; ++i)
  48.     {
  49.         ds_grid_add(checkWhoTo,2,i,choose("F1","F2","F3","F4")) //6899 Change choose with formula
  50.     }
  51. }
  52.  
  53. if timer[1]>20{ds_grid_sort(checkWhoTo,1,false)}
  54.  
  55. if timer[1]>60
  56. {
  57.     timer[0]++
  58.  
  59.     if timer[0]>=100 and subTurn<allQuant-1
  60.     {
  61.         subTurn++
  62.         var who = subTurnSorter[# 0, subTurn]
  63.         var to = checkWhoTo[# 2, subTurn]
  64.         var howFast = subTurnSorter[# 1, subTurn]
  65.  
  66.         stringLog+=string(who)+" attacked " + string(to) + " with a speed of "+string(howFast)+"\n"
  67.         timer[0]=0
  68.     }
  69.  
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement