Advertisement
Guest User

Untitled

a guest
Oct 16th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// scr_ai_build()
  2.  
  3. gml_pragma("forceinline")
  4.  
  5. // info list
  6.  
  7. // action type, defined by 'a'
  8. // 0: cat 1 construction
  9. // 1: cat 2 construction
  10. // 2: cat 3 construction
  11. // 3: cat 4 construction
  12.  
  13. var do_it = false
  14. var limit_break = 0
  15. var spaceout = 1
  16. var f = 0
  17. var ran_length = 0
  18. var limit_break_x = 0
  19. var ra_choose = -1
  20. var b = 0
  21. var z = 0
  22. var indi = -1
  23. var a = 0
  24.  
  25. ds_list_clear( ds_compile )
  26.  
  27. seed_temp = seed_apply
  28.  
  29. if 1 = 1
  30.     {
  31.  
  32.     tick_time--
  33.    
  34.     if produce_time[ 0 ] > 0
  35.         produce_time[ 0 ]--
  36.            
  37.     if produce_time[ 1 ] > 0
  38.         produce_time[ 1 ]--
  39.            
  40.     if produce_time[ 2 ] > 0
  41.         produce_time[ 2 ]--
  42.            
  43.     if produce_time[ 3 ] > 0
  44.         produce_time[ 3 ]--
  45.        
  46.     if cheat = true
  47.         {
  48.        
  49.         produce_time[ 0 ] = 0
  50.         produce_time[ 1 ] = 0
  51.         produce_time[ 2 ] = 0
  52.         produce_time[ 3 ] = 0
  53.        
  54.         tick_time = 0
  55.        
  56.         funds = 99999999
  57.        
  58.         }
  59.    
  60.     if tick_time <= 0
  61.         {
  62.        
  63.         if expand >= 32
  64.             expand = 8
  65.        
  66.         find_index = 0
  67.        
  68.         first_index = ""
  69.        
  70.         tick_time = response_time
  71.    
  72.         if produce_id[ 0 ] > 0
  73.         if num_conyard = 0
  74.             {
  75.  
  76.             if instance_exists( temps )
  77.                 temps.player_funds[ slot ] += prod_cost_list[| ds_list_find_index( prod_list , produce_id[ 0 ] ) ]
  78.                
  79.             produce_id[ 0 ] = 0
  80.             produce_time[ 0 ] = 0
  81.            
  82.             }
  83.            
  84.         if produce_id[ 1 ] > 0
  85.         if num_conyard = 0
  86.             {
  87.            
  88.             if instance_exists( temps )
  89.                 temps.player_funds[ slot ] += prod_cost_list[| ds_list_find_index( prod_list , produce_id[ 1 ] ) ]
  90.                
  91.             produce_id[ 1 ] = 0
  92.             produce_time[ 1 ] = 0
  93.            
  94.             }
  95.            
  96.         if produce_id[ 2 ] > 0
  97.         if num_barracks = 0
  98.             {
  99.            
  100.             if instance_exists( temps )
  101.                 temps.player_funds[ slot ] += prod_cost_list[| ds_list_find_index( prod_list , produce_id[ 2 ] ) ]
  102.                
  103.             produce_id[ 2 ] = 0
  104.             produce_time[ 2 ] = 0
  105.            
  106.             }
  107.            
  108.         if produce_id[ 3 ] > 0
  109.         if num_warfac = 0
  110.             {
  111.            
  112.             if instance_exists( temps )
  113.                 temps.player_funds[ slot ] += prod_cost_list[| ds_list_find_index( prod_list , produce_id[ 3 ] ) ]
  114.                
  115.             produce_id[ 3 ] = 0
  116.             produce_time[ 3 ] = 0
  117.            
  118.             }
  119.        
  120.         if produce_id[ 0 ] > 0
  121.         if produce_time[ 0 ] <= 0
  122.             {
  123.            
  124.             prod_limit_list[| ds_list_find_index( prod_list , produce_id[ 0 ] ) ]--
  125.            
  126.             limit_break = 0
  127.            
  128.             limit_break_x = 0
  129.            
  130.             //show_message( seed_apply )
  131.            
  132.             //show_message( global.tickrate2 )
  133.            
  134.             do
  135.                 {
  136.                
  137.                 ran_length = ( real( string_char_at( seed_temp , slot ) + string_char_at( seed_temp , slot + 1 ) ) / 100 ) * expand
  138.                
  139.                 ranreal = ( real( string_char_at( seed_temp , slot ) + string_char_at( seed_temp , slot + 1 ) ) / 100 ) * 359
  140.                
  141.                 do_it = scr_check_grid( ( floor( ( base_cords_x[| 0] / 32 ) + lengthdir_x( ran_length , ranreal ) ) * 32 ) + 16 , ( floor( ( base_cords_y[| 0] / 32 ) + lengthdir_y( ran_length , ranreal ) ) * 32 ) + 16 , prod_w_list[| ds_list_find_index( prod_list , produce_id[ 0 ] ) ] , prod_h_list[| ds_list_find_index( prod_list , produce_id[ 0 ] ) ] , spaceout )
  142.                
  143.                 if do_it = true
  144.                     {
  145.                    
  146.                     limit_break++
  147.                    
  148.                     seed_temp = string( round( real( seed_temp ) * 1.1 ) )
  149.                    
  150.                     if limit_break = 6
  151.                         {
  152.                        
  153.                         limit_break = 0
  154.                        
  155.                         limit_break_x++
  156.                        
  157.                         }
  158.                        
  159.                     if limit_break_x = 1
  160.                         {
  161.                        
  162.                         expand += 2
  163.                        
  164.                         limit_break = 0
  165.                        
  166.                         }
  167.                    
  168.                     }
  169.                
  170.                 }
  171.             until
  172.                 do_it = false || limit_break_x = 1
  173.                
  174.             seed_temp = seed_apply
  175.                
  176.             limit_break = 0
  177.            
  178.             if limit_break_x < 1
  179.                 {
  180.            
  181.                 with instance_create( ( floor( ( base_cords_x[| 0] / 32 ) + lengthdir_x( ran_length , ranreal ) ) * 32 ) + 16 , ( floor( ( base_cords_y[| 0] / 32 ) + lengthdir_y( ran_length , ranreal ) ) * 32 ) + 16 , test_u )
  182.                     {
  183.                    
  184.                     side = other.slot
  185.                     c_c_id = other.produce_id[ 0 ]
  186.                     tickcheck = global.tickrate2
  187.                     str = true
  188.                     c_w = 4
  189.                     c_h = 4
  190.                    
  191.                     event_perform( ev_other , ev_user6 )
  192.                    
  193.                     custard_alarm[ 11 ] = 1
  194.                    
  195.                     }
  196.                
  197.                 if prod_conyard_list[| ds_list_find_index( prod_list , produce_id[ 0 ] ) ] = 1
  198.                     num_conyard++
  199.                    
  200.                 if prod_barracks_list[| ds_list_find_index( prod_list , produce_id[ 0 ] ) ] = 1
  201.                     num_barracks++
  202.                    
  203.                 if prod_warfac_list[| ds_list_find_index( prod_list , produce_id[ 0 ] ) ] = 1
  204.                     num_warfac++
  205.                    
  206.                 if prod_refinery_list[| ds_list_find_index( prod_list , produce_id[ 0 ] ) ] = 1
  207.                     num_refinery++
  208.                    
  209.                 if prod_harvest_list[| ds_list_find_index( prod_list , produce_id[ 0 ] ) ] = 1
  210.                     num_harvester++
  211.                
  212.                 produce_id[ 0 ] = 0
  213.            
  214.                 }
  215.            
  216.             }
  217.            
  218.         if produce_id[ 1 ] > 0
  219.         if produce_time[ 1 ] <= 0
  220.             {
  221.            
  222.             prod_limit_list[| ds_list_find_index( prod_list , produce_id[ 1 ] ) ]--
  223.            
  224.             limit_break = 0
  225.            
  226.             limit_break_x = 0
  227.            
  228.             do
  229.                 {
  230.                
  231.                 ran_length = ( real( string_char_at( seed_temp , slot ) + string_char_at( seed_temp , slot + 1 ) ) / 100 ) * expand
  232.                
  233.                 ranreal = ( real( string_char_at( seed_temp , slot ) + string_char_at( seed_temp , slot + 1 ) ) / 100 ) * 359
  234.                
  235.                 do_it = scr_check_grid( ( floor( ( base_cords_x[| 0] / 32 ) + lengthdir_x( ran_length , ranreal ) ) * 32 ) + 16 , ( floor( ( base_cords_y[| 0] / 32 ) + lengthdir_y( ran_length , ranreal ) ) * 32 ) + 16 , prod_w_list[| ds_list_find_index( prod_list , produce_id[ 1 ] ) ] , prod_h_list[| ds_list_find_index( prod_list , produce_id[ 1 ] ) ] , spaceout )
  236.                
  237.                 if do_it = true
  238.                     {
  239.                    
  240.                     limit_break++
  241.                    
  242.                     seed_temp = string( round( real( seed_temp ) * 1.1 ) )
  243.                    
  244.                     if limit_break = 6
  245.                         {
  246.                        
  247.                         limit_break = 0
  248.                        
  249.                         limit_break_x++
  250.  
  251.                         }
  252.                        
  253.                     if limit_break_x = 1
  254.                         {
  255.                        
  256.                         expand += 2
  257.                        
  258.                         limit_break = 0
  259.                        
  260.                         }
  261.                    
  262.                     }
  263.                
  264.                 }
  265.             until
  266.                 do_it = false || limit_break_x = 1
  267.                
  268.             seed_temp = seed_apply
  269.                
  270.             limit_break = 0
  271.            
  272.             if limit_break_x < 1
  273.                 {
  274.            
  275.                 with instance_create( ( floor( ( base_cords_x[| 0] / 32 ) + lengthdir_x( ran_length , ranreal ) ) * 32 ) + 16 , ( floor( ( base_cords_y[| 0] / 32 ) + lengthdir_y( ran_length , ranreal ) ) * 32 ) + 16 , test_u )
  276.                     {
  277.                    
  278.                     side = other.slot
  279.                     c_c_id = other.produce_id[ 1 ]
  280.                     tickcheck = global.tickrate2
  281.                     str = true
  282.                     c_w = 4
  283.                     c_h = 4
  284.                     isdefence = true
  285.                    
  286.                     spawn_state = 2
  287.                    
  288.                     event_perform( ev_other , ev_user6 )
  289.                    
  290.                     custard_alarm[ 11 ] = 1
  291.                    
  292.                     }
  293.                
  294.                 if prod_conyard_list[| ds_list_find_index( prod_list , produce_id[ 1 ] ) ] = 1
  295.                     num_conyard++
  296.                    
  297.                 if prod_barracks_list[| ds_list_find_index( prod_list , produce_id[ 1 ] ) ] = 1
  298.                     num_barracks++
  299.                    
  300.                 if prod_warfac_list[| ds_list_find_index( prod_list , produce_id[ 1 ] ) ] = 1
  301.                     num_warfac++
  302.                    
  303.                 if prod_refinery_list[| ds_list_find_index( prod_list , produce_id[ 1 ] ) ] = 1
  304.                     num_refinery++
  305.                    
  306.                 if prod_harvest_list[| ds_list_find_index( prod_list , produce_id[ 1 ] ) ] = 1
  307.                     num_harvester++
  308.                    
  309.                 if prod_category_list[| ds_list_find_index( prod_list , produce_id[ 1 ] ) ] = 2
  310.                     num_str_defence++
  311.                
  312.                 produce_id[ 1 ] = 0
  313.            
  314.                 }
  315.            
  316.             }
  317.            
  318.         if produce_id[ 2 ] > 0
  319.         if produce_time[ 2 ] <= 0
  320.             {
  321.            
  322.             prod_limit_list[| ds_list_find_index( prod_list , produce_id[ 2 ] ) ]--
  323.            
  324.             with test_u
  325.                 {
  326.                                        
  327.                 if sidebar.primaries[# 1 , other.slot ] = u_id
  328.                 if sidebar.primaries[# 1 , other.slot ] != 0
  329.                     other.pri_temp = id
  330.                                
  331.                 }
  332.            
  333.             if instance_exists( pri_temp )
  334.                 {
  335.                
  336.                 with pri_temp
  337.                     {
  338.                    
  339.                     other.spawn_at_x = ( ( floor( x / 32 ) * 32 ) + 16 ) + 32
  340.                     other.spawn_at_y = ( ( floor( y / 32 ) * 32 ) + 16 ) + 32
  341.                
  342.                     }
  343.                    
  344.                 if pri_temp.vehicle = true
  345.                     {
  346.                    
  347.                     for ( a = 0 ; a <= pri_temp.height ; a += 32 )
  348.                         {
  349.                        
  350.                         ds_list_add( ingame_sys.part_col , c_white )
  351.                         ds_list_add( ingame_sys.part_x , scr_find_spawn_x( spawn_at_x , spawn_at_y , pri_temp.c_w , pri_temp.c_h ) )
  352.                         ds_list_add( ingame_sys.part_y , scr_find_spawn_y( spawn_at_x , spawn_at_y , pri_temp.c_w , pri_temp.c_h ) )
  353.                         ds_list_add( ingame_sys.part_sprite , spr_tele )
  354.                         ds_list_add( ingame_sys.part_frame , 0 )
  355.                         ds_list_add( ingame_sys.part_frame_var , .5 )
  356.                         ds_list_add( ingame_sys.part_scale_x , 1 )
  357.                         ds_list_add( ingame_sys.part_scale_y , 1 )
  358.                         ds_list_add( ingame_sys.part_scale_x_var , 0.02 )
  359.                         ds_list_add( ingame_sys.part_scale_y_var , 0.05 )
  360.                         ds_list_add( ingame_sys.part_bounce , 0 )
  361.                         ds_list_add( ingame_sys.part_rot , 0 )
  362.                         ds_list_add( ingame_sys.part_rot_var , 0 )
  363.                         ds_list_add( ingame_sys.part_alpha , .5 )
  364.                         ds_list_add( ingame_sys.part_alpha_var , -.01 )
  365.                         ds_list_add( ingame_sys.part_height , a )
  366.                         ds_list_add( ingame_sys.part_x_speed , 0 )
  367.                         ds_list_add( ingame_sys.part_y_speed , 0 )
  368.                         ds_list_add( ingame_sys.part_z_speed , -.5 )
  369.                         ds_list_add( ingame_sys.part_g_speed , 0 )
  370.                         ds_list_add( ingame_sys.part_time , 600 )
  371.                        
  372.                         }
  373.                        
  374.                     queue_sound( 3 , deploy_sfx , 0.5 , iso_x( x , y ) , iso_y( x , y ) , 1024 )
  375.                    
  376.                     }
  377.            
  378.             inst_create = instance_create( scr_find_spawn_x( spawn_at_x , spawn_at_y , pri_temp.c_w , pri_temp.c_h ) , scr_find_spawn_y( spawn_at_x , spawn_at_y , pri_temp.c_w , pri_temp.c_h ) , test_u )
  379.            
  380.                 }
  381.                
  382.             if obj_console.pop_limit != 0
  383.                 ds_list_add( limit_pop , inst_create )
  384.            
  385.             with inst_create
  386.                 {
  387.                
  388.                 side = other.slot
  389.                 c_c_id = other.produce_id[ 2 ]
  390.                 tickcheck = global.tickrate2
  391.                 c_w = 4
  392.                 c_h = 4
  393.                
  394.                 spawn_state = 2
  395.                
  396.                 event_perform( ev_other , ev_user6 )
  397.                
  398.                 custard_alarm[ 11 ] = 1
  399.                
  400.                 }
  401.                
  402.             event_perform( ev_other , ev_user2 )
  403.            
  404.             if prod_conyard_list[| ds_list_find_index( prod_list , produce_id[ 2 ] ) ] = 1
  405.                 num_conyard++
  406.                
  407.             if prod_barracks_list[| ds_list_find_index( prod_list , produce_id[ 2 ] ) ] = 1
  408.                 num_barracks++
  409.                
  410.             if prod_warfac_list[| ds_list_find_index( prod_list , produce_id[ 2 ] ) ] = 1
  411.                 num_warfac++
  412.                
  413.             if prod_refinery_list[| ds_list_find_index( prod_list , produce_id[ 2 ] ) ] = 1
  414.                 num_refinery++
  415.                
  416.             if prod_harvest_list[| ds_list_find_index( prod_list , produce_id[ 2 ] ) ] = 1
  417.                 num_harvester++
  418.                
  419.             produce_id[ 2 ] = 0
  420.            
  421.             }
  422.            
  423.         if produce_id[ 3 ] > 0
  424.         if produce_time[ 3 ] <= 0
  425.             {
  426.            
  427.             prod_limit_list[| ds_list_find_index( prod_list , produce_id[ 3 ] ) ]--
  428.        
  429.             with test_u
  430.                 {
  431.                                        
  432.                 if sidebar.primaries[# 2 , other.slot ] = u_id
  433.                 if sidebar.primaries[# 2 , other.slot ] != 0
  434.                     other.pri_temp = id
  435.                                
  436.                 }
  437.            
  438.             if instance_exists( pri_temp )
  439.                 {
  440.                
  441.                 with pri_temp
  442.                     {
  443.                    
  444.                     other.spawn_at_x = ( ( floor( x / 32 ) * 32 ) + 16 ) + 32
  445.                     other.spawn_at_y = ( ( floor( y / 32 ) * 32 ) + 16 ) + 32
  446.                
  447.                     }
  448.                    
  449.                 if pri_temp.vehicle = true
  450.                     {
  451.                    
  452.                     for ( a = 0 ; a <= pri_temp.height ; a += 32 )
  453.                         {
  454.                        
  455.                         ds_list_add( ingame_sys.part_col , c_white )
  456.                         ds_list_add( ingame_sys.part_x , scr_find_spawn_x( spawn_at_x , spawn_at_y , pri_temp.c_w , pri_temp.c_h ) )
  457.                         ds_list_add( ingame_sys.part_y , scr_find_spawn_y( spawn_at_x , spawn_at_y , pri_temp.c_w , pri_temp.c_h ) )
  458.                         ds_list_add( ingame_sys.part_sprite , spr_tele )
  459.                         ds_list_add( ingame_sys.part_frame , 0 )
  460.                         ds_list_add( ingame_sys.part_frame_var , .5 )
  461.                         ds_list_add( ingame_sys.part_scale_x , 1 )
  462.                         ds_list_add( ingame_sys.part_scale_y , 1 )
  463.                         ds_list_add( ingame_sys.part_scale_x_var , 0.02 )
  464.                         ds_list_add( ingame_sys.part_scale_y_var , 0.05 )
  465.                         ds_list_add( ingame_sys.part_bounce , 0 )
  466.                         ds_list_add( ingame_sys.part_rot , 0 )
  467.                         ds_list_add( ingame_sys.part_rot_var , 0 )
  468.                         ds_list_add( ingame_sys.part_alpha , .5 )
  469.                         ds_list_add( ingame_sys.part_alpha_var , -.01 )
  470.                         ds_list_add( ingame_sys.part_height , a )
  471.                         ds_list_add( ingame_sys.part_x_speed , 0 )
  472.                         ds_list_add( ingame_sys.part_y_speed , 0 )
  473.                         ds_list_add( ingame_sys.part_z_speed , -.5 )
  474.                         ds_list_add( ingame_sys.part_g_speed , 0 )
  475.                         ds_list_add( ingame_sys.part_time , 600 )
  476.                        
  477.                         }
  478.                    
  479.                 queue_sound( 3 , deploy_sfx , 0.5 , iso_x( x , y ) , iso_y( x , y ) , 1024 )
  480.                
  481.                 }
  482.            
  483.             inst_create = instance_create( scr_find_spawn_x( spawn_at_x , spawn_at_y , pri_temp.c_w , pri_temp.c_h ) , scr_find_spawn_y( spawn_at_x , spawn_at_y , pri_temp.c_w , pri_temp.c_h ) , test_u )
  484.            
  485.                 }
  486.                
  487.             if obj_console.pop_limit != 0
  488.                 ds_list_add( limit_pop , inst_create )
  489.            
  490.             with inst_create
  491.                 {
  492.                
  493.                 side = other.slot
  494.                 c_c_id = other.produce_id[ 3 ]
  495.                 tickcheck = global.tickrate2
  496.                 c_w = 4
  497.                 c_h = 4
  498.                 vehicle = true
  499.                
  500.                 spawn_state = 2
  501.                
  502.                 event_perform( ev_other , ev_user6 )
  503.                
  504.                 custard_alarm[ 11 ] = 1
  505.                
  506.                 }
  507.                
  508.             event_perform( ev_other , ev_user2 )
  509.            
  510.             if prod_conyard_list[| ds_list_find_index( prod_list , produce_id[ 3 ] ) ] = 1
  511.                 num_conyard++
  512.                
  513.             if prod_barracks_list[| ds_list_find_index( prod_list , produce_id[ 3 ] ) ] = 1
  514.                 num_barracks++
  515.                
  516.             if prod_warfac_list[| ds_list_find_index( prod_list , produce_id[ 3 ] ) ] = 1
  517.                 num_warfac++
  518.                
  519.             if prod_refinery_list[| ds_list_find_index( prod_list , produce_id[ 3 ] ) ] = 1
  520.                 num_refinery++
  521.                
  522.             if prod_harvest_list[| ds_list_find_index( prod_list , produce_id[ 3 ] ) ] = 1
  523.                 num_harvester++
  524.                
  525.             produce_id[ 3 ] = 0
  526.            
  527.             }
  528.            
  529.         //
  530.        
  531.         for ( var a = 0 ; a <= 3 ; a++ )
  532.             {
  533.            
  534.             ds_list_clear( grab_type )
  535.             ds_list_clear( grab_id )
  536.            
  537.             switch( a )
  538.                 {
  539.                
  540.                 case 0:
  541.                
  542.                     if ai_expand = true
  543.                         {
  544.                
  545.                         if num_conyard > 0
  546.                         if produce_id[ 0 ] = 0
  547.                             {
  548.                                
  549.                             find_index = -1
  550.                                
  551.                             ds_list_clear( grab_type )
  552.                             ds_list_clear( grab_id )
  553.                                
  554.                             if num_barracks <= mins
  555.                             if produce_id[ 0 ] = 0
  556.                                 {
  557.                                
  558.                                 for ( f = 0 ; f < ds_list_size( prod_list ) ; f++ )
  559.                                     {
  560.                                    
  561.                                     if funds < prod_cost_list[| f]
  562.                                     if powerup_money <= 0
  563.                                         {
  564.                                        
  565.                                         powerup_money = 600
  566.                                        
  567.                                         for ( b = 0 ; b < ds_list_size( powerup_list ) ; b++ )
  568.                                             {
  569.                                            
  570.                                             if powerup_list[| b] = 7
  571.                                             if powerup_hide[| b] = 0
  572.                                                 {
  573.                                                
  574.                                                 ds_list_add( ds_compile , powerup_list[| b] )
  575.                                                
  576.                                                 }
  577.                                            
  578.                                             }
  579.                                            
  580.                                         if !ds_list_empty( ds_compile )
  581.                                         if powerup_have > 0
  582.                                             {
  583.                                            
  584.                                             scr_ai_apply_powerup( ds_compile[| ( real( string_char_at( seed_temp , slot ) + string_char_at( seed_temp , slot + 1 ) ) / 100 ) * ds_list_size( ds_compile ) ] )
  585.                                            
  586.                                             }
  587.                                        
  588.                                         }
  589.                                    
  590.                                     if prod_category_list[| f] = 1
  591.                                     if prod_barracks_list[| f] = 1
  592.                                     if funds >= prod_cost_list[| f]
  593.                                     if prod_dont_list[| f] = 0
  594.                                     if prod_limit_list[| f] > 0
  595.                                         {
  596.                                        
  597.                                         ds_list_add( grab_type , prod_list[| f] )
  598.                                         ds_list_add( grab_id , f )
  599.                                        
  600.                                         }
  601.                                    
  602.                                     }
  603.                                
  604.                                 if !ds_list_empty( grab_id )
  605.                                     find_index = grab_id[| round( ( real( string_char_at( seed_apply , slot ) + string_char_at( seed_apply , slot + 1 ) ) / 100 ) * ( ds_list_size( grab_id ) - 1 ) ) ]
  606.                                
  607.                                 if find_index != -1
  608.                                     {
  609.                                            
  610.                                     produce_id[ 0 ] = prod_list[| find_index]
  611.                                            
  612.                                     produce_time[ 0 ] = prod_time_list[| find_index] / ( 1 + ( ( num_conyard - 1 ) * 0.2 ) )
  613.                                            
  614.                                     funds -= prod_cost_list[| find_index]
  615.                                            
  616.                                     if instance_exists( temps )
  617.                                         temps.player_funds[ slot ] -= prod_cost_list[| find_index]
  618.                                        
  619.                                     }
  620.                                
  621.                                 }
  622.                                
  623.                             ds_list_clear( grab_type )
  624.                             ds_list_clear( grab_id )
  625.                            
  626.                             find_index = -1
  627.                                
  628.                             if num_refinery <= mins
  629.                             if produce_id[ 0 ] = 0
  630.                                 {
  631.                                
  632.                                 for ( f = 0 ; f < ds_list_size( prod_list ) ; f++ )
  633.                                     {
  634.                                    
  635.                                     if funds < prod_cost_list[| f]
  636.                                     if powerup_money <= 0
  637.                                         {
  638.                                        
  639.                                         powerup_money = 600
  640.                                        
  641.                                         for ( b = 0 ; b < ds_list_size( powerup_list ) ; b++ )
  642.                                             {
  643.                                            
  644.                                             if powerup_list[| b] = 7
  645.                                             if powerup_hide[| b] = 0
  646.                                                 {
  647.                                                
  648.                                                 ds_list_add( ds_compile , powerup_list[| b] )
  649.                                                
  650.                                                 }
  651.                                            
  652.                                             }
  653.                                            
  654.                                         if !ds_list_empty( ds_compile )
  655.                                         if powerup_have > 0
  656.                                             {
  657.                                            
  658.                                             scr_ai_apply_powerup( ds_compile[| ( real( string_char_at( seed_temp , slot ) + string_char_at( seed_temp , slot + 1 ) ) / 100 ) * ds_list_size( ds_compile ) ] )
  659.                                            
  660.                                             }
  661.                                        
  662.                                         }
  663.                                    
  664.                                     if prod_category_list[| f] = 1
  665.                                     if prod_refinery_list[| f] = 1
  666.                                     if funds >= prod_cost_list[| f]
  667.                                     if prod_dont_list[| f] = 0
  668.                                     if prod_limit_list[| f] > 0
  669.                                         {
  670.                                        
  671.                                         ds_list_add( grab_type , prod_list[| f] )
  672.                                         ds_list_add( grab_id , f )
  673.                                        
  674.                                         }
  675.                                    
  676.                                     }
  677.                                
  678.                                 if !ds_list_empty( grab_id )
  679.                                     find_index = grab_id[| round( ( real( string_char_at( seed_apply , slot ) + string_char_at( seed_apply , slot + 1 ) ) / 100 ) * ( ds_list_size( grab_id ) - 1 ) ) ]
  680.                                
  681.                                 if find_index != -1
  682.                                     {
  683.                                            
  684.                                     produce_id[ 0 ] = prod_list[| find_index]
  685.                                            
  686.                                     produce_time[ 0 ] = prod_time_list[| find_index] / ( 1 + ( ( num_conyard - 1 ) * 0.2 ) )
  687.                                            
  688.                                     funds -= prod_cost_list[| find_index]
  689.                                            
  690.                                     if instance_exists( temps )
  691.                                         temps.player_funds[ slot ] -= prod_cost_list[| find_index]
  692.                                        
  693.                                     }
  694.                                
  695.                                 }
  696.                                
  697.                             find_index = -1
  698.                                
  699.                             ds_list_clear( grab_type )
  700.                             ds_list_clear( grab_id )
  701.                                
  702.                             if num_warfac <= mins
  703.                             if produce_id[ 0 ] = 0
  704.                                 {
  705.                                
  706.                                 for ( f = 0 ; f < ds_list_size( prod_list ) ; f++ )
  707.                                     {
  708.                                    
  709.                                     if funds < prod_cost_list[| f]
  710.                                     if powerup_money <= 0
  711.                                         {
  712.                                        
  713.                                         powerup_money = 600
  714.                                        
  715.                                         for ( b = 0 ; b < ds_list_size( powerup_list ) ; b++ )
  716.                                             {
  717.                                            
  718.                                             if powerup_list[| b] = 7
  719.                                             if powerup_hide[| b] = 0
  720.                                                 {
  721.                                                
  722.                                                 ds_list_add( ds_compile , powerup_list[| b] )
  723.                                                
  724.                                                 }
  725.                                            
  726.                                             }
  727.                                            
  728.                                         if !ds_list_empty( ds_compile )
  729.                                         if powerup_have > 0
  730.                                             {
  731.                                            
  732.                                             scr_ai_apply_powerup( ds_compile[| ( real( string_char_at( seed_temp , slot ) + string_char_at( seed_temp , slot + 1 ) ) / 100 ) * ds_list_size( ds_compile ) ] )
  733.                                            
  734.                                             }
  735.                                        
  736.                                         }
  737.                                    
  738.                                     if prod_category_list[| f] = 1
  739.                                     if prod_warfac_list[| f] = 1
  740.                                     if funds >= prod_cost_list[| f]
  741.                                     if prod_dont_list[| f] = 0
  742.                                     if prod_limit_list[| f] > 0
  743.                                         {
  744.                                        
  745.                                         ds_list_add( grab_type , prod_list[| f] )
  746.                                         ds_list_add( grab_id , f )
  747.                                        
  748.                                         }
  749.                                    
  750.                                     }
  751.                                
  752.                                 if !ds_list_empty( grab_id )
  753.                                     find_index = grab_id[| round( ( real( string_char_at( seed_apply , slot ) + string_char_at( seed_apply , slot + 1 ) ) / 100 ) * ( ds_list_size( grab_id ) - 1 ) ) ]
  754.                                
  755.                                 if find_index != -1
  756.                                     {
  757.                                            
  758.                                     produce_id[ 0 ] = prod_list[| find_index]
  759.                                            
  760.                                     produce_time[ 0 ] = prod_time_list[| find_index] / ( 1 + ( ( num_conyard - 1 ) * 0.2 ) )
  761.                                            
  762.                                     funds -= prod_cost_list[| find_index]
  763.                                            
  764.                                     if instance_exists( temps )
  765.                                         temps.player_funds[ slot ] -= prod_cost_list[| find_index]
  766.                                        
  767.                                     }
  768.                                
  769.                                 }
  770.                                
  771.                             ds_list_clear( grab_type )
  772.                             ds_list_clear( grab_id )
  773.                            
  774.                             find_index = -1
  775.                    
  776.                             if num_conyard <= mins
  777.                             if produce_id[ 0 ] = 0
  778.                                 {
  779.                                
  780.                                 for ( f = 0 ; f < ds_list_size( prod_list ) ; f++ )
  781.                                     {
  782.                                    
  783.                                     if funds < prod_cost_list[| f]
  784.                                     if powerup_money <= 0
  785.                                         {
  786.                                        
  787.                                         powerup_money = 600
  788.                                        
  789.                                         for ( b = 0 ; b < ds_list_size( powerup_list ) ; b++ )
  790.                                             {
  791.                                            
  792.                                             if powerup_list[| b] = 7
  793.                                             if powerup_hide[| b] = 0
  794.                                                 {
  795.                                                
  796.                                                 ds_list_add( ds_compile , powerup_list[| b] )
  797.                                                
  798.                                                 }
  799.                                            
  800.                                             }
  801.                                            
  802.                                         if !ds_list_empty( ds_compile )
  803.                                         if powerup_have > 0
  804.                                             {
  805.                                            
  806.                                             scr_ai_apply_powerup( ds_compile[| ( real( string_char_at( seed_temp , slot ) + string_char_at( seed_temp , slot + 1 ) ) / 100 ) * ds_list_size( ds_compile ) ] )
  807.                                            
  808.                                             }
  809.                                        
  810.                                         }
  811.                                    
  812.                                     if prod_category_list[| f] = 1
  813.                                     if prod_conyard_list[| f] = 1
  814.                                     if funds >= prod_cost_list[| f]
  815.                                     if prod_dont_list[| f] = 0
  816.                                     if prod_limit_list[| f] > 0
  817.                                         {
  818.                                        
  819.                                         ds_list_add( grab_type , prod_list[| f] )
  820.                                         ds_list_add( grab_id , f )
  821.                                        
  822.                                         }
  823.                                    
  824.                                     }
  825.                                
  826.                                 if !ds_list_empty( grab_id )
  827.                                     find_index = grab_id[| round( ( real( string_char_at( seed_apply , slot ) + string_char_at( seed_apply , slot + 1 ) ) / 100 ) * ( ds_list_size( grab_id ) - 1 ) ) ]
  828.                                
  829.                                 if find_index != -1
  830.                                     {
  831.                                            
  832.                                     produce_id[ 0 ] = prod_list[| find_index]
  833.                                            
  834.                                     produce_time[ 0 ] = prod_time_list[| find_index] / ( 1 + ( ( num_conyard - 1 ) * 0.2 ) )
  835.                                            
  836.                                     funds -= prod_cost_list[| find_index]
  837.                                            
  838.                                     if instance_exists( temps )
  839.                                         temps.player_funds[ slot ] -= prod_cost_list[| find_index]
  840.                                        
  841.                                     }
  842.                                
  843.                                 }
  844.                                
  845.                             find_index = -1
  846.                            
  847.                             ds_list_clear( grab_type )
  848.                             ds_list_clear( grab_id )
  849.                            
  850.                             if produce_id[ 0 ] = 0
  851.                                 {
  852.                                
  853.                                 for ( f = 0 ; f < ds_list_size( prod_list ) ; f++ )
  854.                                     {
  855.                                    
  856.                                     if funds < prod_cost_list[| f]
  857.                                     if powerup_money <= 0
  858.                                         {
  859.                                        
  860.                                         powerup_money = 600
  861.                                        
  862.                                         for ( b = 0 ; b < ds_list_size( powerup_list ) ; b++ )
  863.                                             {
  864.                                            
  865.                                             if powerup_list[| b] = 7
  866.                                             if powerup_hide[| b] = 0
  867.                                                 {
  868.                                                
  869.                                                 ds_list_add( ds_compile , powerup_list[| b] )
  870.                                                
  871.                                                 }
  872.                                            
  873.                                             }
  874.                                            
  875.                                         if !ds_list_empty( ds_compile )
  876.                                         if powerup_have > 0
  877.                                             {
  878.                                            
  879.                                             scr_ai_apply_powerup( ds_compile[| ( real( string_char_at( seed_temp , slot ) + string_char_at( seed_temp , slot + 1 ) ) / 100 ) * ds_list_size( ds_compile ) ] )
  880.                                            
  881.                                             }
  882.                                        
  883.                                         }
  884.                                    
  885.                                     if prod_conyard_list[| f] = 0
  886.                                     if prod_refinery_list[| f] = 0
  887.                                     if prod_barracks_list[| f] = 0
  888.                                     if prod_warfac_list[| f] = 0
  889.                                     if prod_category_list[| f] = 1
  890.                                     if funds >= prod_cost_list[| f]
  891.                                     if prod_dont_list[| f] = 0
  892.                                     if prod_limit_list[| f] > 0
  893.                                         {
  894.                                        
  895.                                         ds_list_add( grab_type , prod_list[| f] )
  896.                                         ds_list_add( grab_id , f )
  897.                                        
  898.                                         }
  899.                                    
  900.                                     }
  901.                                
  902.                                 if !ds_list_empty( grab_id )
  903.                                     find_index = grab_id[| round( ( real( string_char_at( seed_apply , slot ) + string_char_at( seed_apply , slot + 1 ) ) / 100 ) * ( ds_list_size( grab_id ) - 1 ) ) ]
  904.                                
  905.                                 if find_index != -1
  906.                                     {
  907.                                            
  908.                                     produce_id[ 0 ] = prod_list[| find_index]
  909.                                            
  910.                                     produce_time[ 0 ] = prod_time_list[| find_index] / ( 1 + ( ( num_conyard - 1 ) * 0.2 ) )
  911.                                            
  912.                                     funds -= prod_cost_list[| find_index]
  913.                                            
  914.                                     if instance_exists( temps )
  915.                                         temps.player_funds[ slot ] -= prod_cost_list[| find_index]
  916.                                        
  917.                                     }
  918.                                
  919.                                 }
  920.                                
  921.                             ds_list_clear( grab_type )
  922.                             ds_list_clear( grab_id )
  923.                            
  924.                             find_index = -1
  925.                            
  926.                             if produce_id[ 0 ] = 0
  927.                                 {
  928.                                
  929.                                 for ( f = 0 ; f < ds_list_size( prod_list ) ; f++ )
  930.                                     {
  931.                                    
  932.                                     if funds < prod_cost_list[| f]
  933.                                     if powerup_money <= 0
  934.                                         {
  935.                                        
  936.                                         powerup_money = 600
  937.                                        
  938.                                         for ( b = 0 ; b < ds_list_size( powerup_list ) ; b++ )
  939.                                             {
  940.                                            
  941.                                             if powerup_list[| b] = 7
  942.                                             if powerup_hide[| b] = 0
  943.                                                 {
  944.                                                
  945.                                                 ds_list_add( ds_compile , powerup_list[| b] )
  946.                                                
  947.                                                 }
  948.                                            
  949.                                             }
  950.                                            
  951.                                         if !ds_list_empty( ds_compile )
  952.                                         if powerup_have > 0
  953.                                             {
  954.                                            
  955.                                             scr_ai_apply_powerup( ds_compile[| ( real( string_char_at( seed_temp , slot ) + string_char_at( seed_temp , slot + 1 ) ) / 100 ) * ds_list_size( ds_compile ) ] )
  956.                                            
  957.                                             }
  958.                                        
  959.                                         }
  960.                                    
  961.                                     if prod_category_list[| f] = 1 // If the AI can't find anything to build by the MINS limit, then just pick *something* to build.
  962.                                     if funds >= prod_cost_list[| f]
  963.                                     if prod_dont_list[| f] = 0
  964.                                     if prod_limit_list[| f] > 0
  965.                                         {
  966.                                        
  967.                                         ds_list_add( grab_type , prod_list[| f] )
  968.                                         ds_list_add( grab_id , f )
  969.                                        
  970.                                         }
  971.                                        
  972.                                     }
  973.                                
  974.                                 if !ds_list_empty( grab_id )
  975.                                     find_index = grab_id[| round( ( real( string_char_at( seed_apply , slot ) + string_char_at( seed_apply , slot + 1 ) ) / 100 ) * ( ds_list_size( grab_id ) - 1 ) ) ]
  976.                                
  977.                                 if find_index != -1
  978.                                     {
  979.                                            
  980.                                     produce_id[ 0 ] = prod_list[| find_index]
  981.                                            
  982.                                     produce_time[ 0 ] = prod_time_list[| find_index] / ( 1 + ( ( num_conyard - 1 ) * 0.2 ) )
  983.                                            
  984.                                     funds -= prod_cost_list[| find_index]
  985.                                            
  986.                                     if instance_exists( temps )
  987.                                         temps.player_funds[ slot ] -= prod_cost_list[| find_index]
  988.                                        
  989.                                     }
  990.                                
  991.                                 }
  992.                                
  993.                             ds_list_clear( grab_type )
  994.                             ds_list_clear( grab_id )
  995.                            
  996.                             find_index = -1
  997.                                
  998.                                 }
  999.                            
  1000.                                 }
  1001.                                
  1002.                         ds_list_clear( grab_type )
  1003.                         ds_list_clear( grab_id )
  1004.                    
  1005.                 break;
  1006.                
  1007.                 // defences
  1008.                
  1009.                 case 1:
  1010.  
  1011.                
  1012.                     if ai_defence = true
  1013.                         {
  1014.                
  1015.                         find_index = -1
  1016.                    
  1017.                         if produce_id[ 1 ] = 0
  1018.                         if num_conyard > 0
  1019.                         if num_str_defence <= mins * 3
  1020.                             {
  1021.                    
  1022.                         for ( f = 0 ; f < ds_list_size( prod_list ) ; f++ )
  1023.                             {
  1024.                            
  1025.                             if funds < prod_cost_list[| f]
  1026.                                     if powerup_money <= 0
  1027.                                         {
  1028.                                        
  1029.                                         powerup_money = 600
  1030.                                        
  1031.                                         for ( b = 0 ; b < ds_list_size( powerup_list ) ; b++ )
  1032.                                             {
  1033.                                            
  1034.                                             if powerup_list[| b] = 7
  1035.                                             if powerup_hide[| b] = 0
  1036.                                                 {
  1037.                                                
  1038.                                                 ds_list_add( ds_compile , powerup_list[| b] )
  1039.                                                
  1040.                                                 }
  1041.                                            
  1042.                                             }
  1043.                                            
  1044.                                         if !ds_list_empty( ds_compile )
  1045.                                         if powerup_have > 0
  1046.                                             {
  1047.                                            
  1048.                                             scr_ai_apply_powerup( ds_compile[| ( real( string_char_at( seed_temp , slot ) + string_char_at( seed_temp , slot + 1 ) ) / 100 ) * ds_list_size( ds_compile ) ] )
  1049.                                            
  1050.                                             }
  1051.                                        
  1052.                                         }
  1053.                            
  1054.                             if prod_category_list[| f] = 2
  1055.                             if prod_can_att_list[| f] = 1
  1056.                             if funds >= prod_cost_list[| f]
  1057.                             if prod_dont_list[| f] = 0
  1058.                             if prod_limit_list[| f] > 0
  1059.                                 {
  1060.                                
  1061.                                 ds_list_add( grab_type , prod_list[| f] )
  1062.                                 ds_list_add( grab_id , f )
  1063.                                
  1064.                                 }
  1065.                            
  1066.                             }
  1067.                            
  1068.                         if !ds_list_empty( grab_id )
  1069.                             find_index = grab_id[| round( ( real( string_char_at( seed_apply , slot ) + string_char_at( seed_apply , slot + 1 ) ) / 100 ) * ( ds_list_size( grab_id ) - 1 ) ) ]
  1070.                        
  1071.                             if find_index != -1
  1072.                                 {
  1073.                                
  1074.                                 produce_id[ 1 ] = prod_list[| find_index]
  1075.                                
  1076.                                 produce_time[ 1 ] = prod_time_list[| find_index] / ( 1 + ( ( num_conyard - 1 ) * 0.2 ) )
  1077.                                
  1078.                                 funds -= prod_cost_list[| find_index]
  1079.                                
  1080.                                 if instance_exists( temps )
  1081.                                     temps.player_funds[ slot ] -= prod_cost_list[| find_index]
  1082.                                
  1083.                                 }
  1084.                                
  1085.                             }
  1086.                            
  1087.                             }
  1088.                            
  1089.                         ds_list_clear( grab_type )
  1090.                         ds_list_clear( grab_id )
  1091.                    
  1092.                 break;
  1093.                
  1094.                 // infantry
  1095.                
  1096.                 case 2:
  1097.                
  1098.                     if ds_list_size( limit_pop ) < obj_console.pop_limit || obj_console.pop_limit = 0
  1099.                         {
  1100.                
  1101.                         if ai_harvester = true
  1102.                             {
  1103.                    
  1104.                             find_index = -1
  1105.                        
  1106.                             if produce_id[ 2 ] = 0
  1107.                             if num_barracks > 0
  1108.                                 {
  1109.                                
  1110.                                 // harvesters
  1111.                                
  1112.                                 find_index = -1
  1113.                                
  1114.                                 if num_harvester <= mins + 5
  1115.                                 if produce_id[ 2 ] = 0
  1116.                                     {
  1117.                                
  1118.                                     for ( f = 0 ; f < ds_list_size( prod_list ) ; f++ )
  1119.                                         {
  1120.                                        
  1121.                                         if funds < prod_cost_list[| f]
  1122.                                         if powerup_money <= 0
  1123.                                             {
  1124.                                        
  1125.                                             powerup_money = 600
  1126.                                            
  1127.                                             for ( b = 0 ; b < ds_list_size( powerup_list ) ; b++ )
  1128.                                                 {
  1129.                                                
  1130.                                                 if powerup_list[| b] = 7
  1131.                                                 if powerup_hide[| b] = 0
  1132.                                                     {
  1133.                                                    
  1134.                                                     ds_list_add( ds_compile , powerup_list[| b] )
  1135.                                                    
  1136.                                                     }
  1137.                                                
  1138.                                                 }
  1139.                                                
  1140.                                             if !ds_list_empty( ds_compile )
  1141.                                             if powerup_have > 0
  1142.                                                 {
  1143.                                                
  1144.                                                 scr_ai_apply_powerup( ds_compile[| ( real( string_char_at( seed_temp , slot ) + string_char_at( seed_temp , slot + 1 ) ) / 100 ) * ds_list_size( ds_compile ) ] )
  1145.                                                
  1146.                                                 }
  1147.                                        
  1148.                                             }
  1149.                                        
  1150.                                         if prod_category_list[| f] = 3
  1151.                                         if prod_harvest_list[| f] = 1
  1152.                                         if funds >= prod_cost_list[| f]
  1153.                                         if prod_dont_list[| f] = 0
  1154.                                         if prod_limit_list[| f] > 0
  1155.                                             {
  1156.                                            
  1157.                                             ds_list_add( grab_type , prod_list[| f] )
  1158.                                             ds_list_add( grab_id , f )
  1159.                                            
  1160.                                             }
  1161.                                        
  1162.                                         }
  1163.                                        
  1164.                                     if !ds_list_empty( grab_id )
  1165.                                         find_index = grab_id[| round( ( real( string_char_at( seed_apply , slot ) + string_char_at( seed_apply , slot + 1 ) ) / 100 ) * ( ds_list_size( grab_id ) - 1 ) ) ]
  1166.                                    
  1167.                                     if find_index != -1
  1168.                                         {
  1169.                                            
  1170.                                         produce_id[ 2 ] = prod_list[| find_index]
  1171.                                                
  1172.                                         produce_time[ 2 ] = prod_time_list[| find_index] / ( 1 + ( ( num_barracks - 1 ) * 0.2 ) )
  1173.                                        
  1174.                                         funds -= prod_cost_list[| find_index]
  1175.                                                
  1176.                                         if instance_exists( temps )
  1177.                                             temps.player_funds[ slot ] -= prod_cost_list[| find_index]
  1178.                                            
  1179.                                         }
  1180.                                    
  1181.                                     }
  1182.                                    
  1183.                                 }
  1184.                                    
  1185.                             }
  1186.                            
  1187.                         ds_list_clear( grab_type )
  1188.                             ds_list_clear( grab_id )
  1189.                    
  1190.                         if ai_army = true
  1191.                             {
  1192.                    
  1193.                             find_index = -1
  1194.                        
  1195.                             if produce_id[ 2 ] = 0
  1196.                             if num_barracks > 0
  1197.                                 {
  1198.                        
  1199.                             for ( f = 0 ; f < ds_list_size( prod_list ) ; f++ )
  1200.                                 {
  1201.                                
  1202.                                     if funds < prod_cost_list[| f]
  1203.                                     if powerup_money <= 0
  1204.                                         {
  1205.                                        
  1206.                                         powerup_money = 600
  1207.                                        
  1208.                                         for ( b = 0 ; b < ds_list_size( powerup_list ) ; b++ )
  1209.                                             {
  1210.                                            
  1211.                                             if powerup_list[| b] = 7
  1212.                                             if powerup_hide[| b] = 0
  1213.                                                 {
  1214.                                                
  1215.                                                 ds_list_add( ds_compile , powerup_list[| b] )
  1216.                                                
  1217.                                                 }
  1218.                                            
  1219.                                             }
  1220.                                            
  1221.                                         if !ds_list_empty( ds_compile )
  1222.                                         if powerup_have > 0
  1223.                                             {
  1224.                                            
  1225.                                             scr_ai_apply_powerup( ds_compile[| ( real( string_char_at( seed_temp , slot ) + string_char_at( seed_temp , slot + 1 ) ) / 100 ) * ds_list_size( ds_compile ) ] )
  1226.                                            
  1227.                                             }
  1228.                                        
  1229.                                         }
  1230.                                
  1231.                                 if prod_category_list[| f] = 3
  1232.                                 if prod_can_att_list[| f] = 1
  1233.                                 if funds >= prod_cost_list[| f]
  1234.                                 if prod_dont_list[| f] = 0
  1235.                                 if prod_limit_list[| f] > 0
  1236.                                     {
  1237.                                    
  1238.                                     ds_list_add( grab_type , prod_list[| f] )
  1239.                                     ds_list_add( grab_id , f )
  1240.                                    
  1241.                                     }
  1242.                                    
  1243.                                 }
  1244.                                
  1245.                             if !ds_list_empty( grab_id )
  1246.                                 find_index = grab_id[| round( ( real( string_char_at( seed_apply , slot ) + string_char_at( seed_apply , slot + 1 ) ) / 100 ) * ( ds_list_size( grab_id ) - 1 ) ) ]
  1247.                            
  1248.                                 if find_index != -1
  1249.                                     {
  1250.                                    
  1251.                                     produce_id[ 2 ] = prod_list[| find_index]
  1252.                                    
  1253.                                     produce_time[ 2 ] = prod_time_list[| find_index] / ( 1 + ( ( num_barracks - 1 ) * 0.2 ) )
  1254.                                    
  1255.                                     funds -= prod_cost_list[| find_index]
  1256.                                    
  1257.                                     if instance_exists( temps )
  1258.                                         temps.player_funds[ slot ] -= prod_cost_list[| find_index]
  1259.                                    
  1260.                                     }
  1261.                                    
  1262.                                 }
  1263.                                
  1264.                                 }
  1265.                                
  1266.                             ds_list_clear( grab_type )
  1267.                             ds_list_clear( grab_id )
  1268.                        
  1269.                         }
  1270.                    
  1271.                 break;
  1272.                
  1273.                 // warfacs
  1274.                
  1275.                 case 3:
  1276.                
  1277.                     if ds_list_size( limit_pop ) < obj_console.pop_limit || obj_console.pop_limit = 0
  1278.                         {
  1279.                
  1280.                         if ai_harvester = true
  1281.                             {
  1282.                    
  1283.                             find_index = -1
  1284.                        
  1285.                             if produce_id[ 3 ] = 0
  1286.                             if num_warfac > 0
  1287.                                 {
  1288.                                
  1289.                                 // harvesters
  1290.                                
  1291.                                 find_index = -1
  1292.                                
  1293.                                 if num_harvester <= mins + 1
  1294.                                 if produce_id[ 3 ] = 0
  1295.                                     {
  1296.                                
  1297.                                     for ( f = 0 ; f < ds_list_size( prod_list ) ; f++ )
  1298.                                         {
  1299.                                        
  1300.                                         if funds < prod_cost_list[| f]
  1301.                                         if powerup_money <= 0
  1302.                                             {
  1303.                                            
  1304.                                             powerup_money = 600
  1305.                                            
  1306.                                             for ( b = 0 ; b < ds_list_size( powerup_list ) ; b++ )
  1307.                                                 {
  1308.                                                
  1309.                                                 if powerup_list[| b] = 7
  1310.                                                 if powerup_hide[| b] = 0
  1311.                                                     {
  1312.                                                    
  1313.                                                     ds_list_add( ds_compile , powerup_list[| b] )
  1314.                                                    
  1315.                                                     }
  1316.                                                
  1317.                                                 }
  1318.                                                
  1319.                                             if !ds_list_empty( ds_compile )
  1320.                                             if powerup_have > 0
  1321.                                                 {
  1322.                                                
  1323.                                                 scr_ai_apply_powerup( ds_compile[| ( real( string_char_at( seed_temp , slot ) + string_char_at( seed_temp , slot + 1 ) ) / 100 ) * ds_list_size( ds_compile ) ] )
  1324.                                                
  1325.                                                 }
  1326.                                            
  1327.                                             }
  1328.                                        
  1329.                                         if prod_category_list[| f] = 4
  1330.                                         if prod_harvest_list[| f] = 1
  1331.                                         if funds >= prod_cost_list[| f]
  1332.                                         if prod_dont_list[| f] = 0
  1333.                                         if prod_limit_list[| f] > 0
  1334.                                             {
  1335.                                            
  1336.                                             ds_list_add( grab_type , prod_list[| f] )
  1337.                                             ds_list_add( grab_id , f )
  1338.                                            
  1339.                                             }
  1340.                                        
  1341.                                         }
  1342.                                        
  1343.                                     if !ds_list_empty( grab_id )
  1344.                                         find_index = grab_id[| round( ( real( string_char_at( seed_apply , slot ) + string_char_at( seed_apply , slot + 1 ) ) / 100 ) * ( ds_list_size( grab_id ) - 1 ) ) ]
  1345.                                    
  1346.                                     if find_index != -1
  1347.                                         {
  1348.                                            
  1349.                                         produce_id[ 3 ] = prod_list[| find_index]
  1350.                                                
  1351.                                         produce_time[ 3 ] = prod_time_list[| find_index] / ( 1 + ( ( num_warfac - 1 ) * 0.2 ) )
  1352.                                        
  1353.                                         funds -= prod_cost_list[| find_index]
  1354.                                                
  1355.                                         if instance_exists( temps )
  1356.                                             temps.player_funds[ slot ] -= prod_cost_list[| find_index]
  1357.                                            
  1358.                                         }
  1359.                                    
  1360.                                     }
  1361.                                    
  1362.                                     }
  1363.                                    
  1364.                                     }
  1365.                                    
  1366.                                     ds_list_clear( grab_type )
  1367.                                     ds_list_clear( grab_id )
  1368.                                    
  1369.                                 //
  1370.                                
  1371.                             if ai_army = true
  1372.                                 {
  1373.                                
  1374.                                 find_index = -1
  1375.                                
  1376.                                 if produce_id[ 3 ] = 0
  1377.                                 if num_warfac > 0
  1378.                                     {
  1379.                        
  1380.                                     for ( f = 0 ; f < ds_list_size( prod_list ) ; f++ )
  1381.                                         {
  1382.                                        
  1383.                                             if funds < prod_cost_list[| f]
  1384.                                             if powerup_money <= 0
  1385.                                             {
  1386.                                            
  1387.                                             powerup_money = 600
  1388.                                            
  1389.                                             for ( b = 0 ; b < ds_list_size( powerup_list ) ; b++ )
  1390.                                                 {
  1391.                                                
  1392.                                                 if powerup_list[| b] = 7
  1393.                                                 if powerup_hide[| b] = 0
  1394.                                                     {
  1395.                                                    
  1396.                                                     ds_list_add( ds_compile , powerup_list[| b] )
  1397.                                                    
  1398.                                                     }
  1399.                                                
  1400.                                                 }
  1401.                                                
  1402.                                             if !ds_list_empty( ds_compile )
  1403.                                             if powerup_have > 0
  1404.                                                 {
  1405.                                                
  1406.                                                 scr_ai_apply_powerup( ds_compile[| ( real( string_char_at( seed_temp , slot ) + string_char_at( seed_temp , slot + 1 ) ) / 100 ) * ds_list_size( ds_compile ) ] )
  1407.                                                
  1408.                                                 }
  1409.                                            
  1410.                                             }
  1411.                                        
  1412.                                         if prod_category_list[| f] = 4
  1413.                                         if funds >= prod_cost_list[| f]
  1414.                                         if prod_dont_list[| f] = 0
  1415.                                         if prod_limit_list[| f] > 0
  1416.                                             {
  1417.                                            
  1418.                                             ds_list_add( grab_type , prod_list[| f] )
  1419.                                             ds_list_add( grab_id , f )
  1420.                                            
  1421.                                             }
  1422.                                        
  1423.                                         }
  1424.                                        
  1425.                                     if !ds_list_empty( grab_id )
  1426.                                         find_index = grab_id[| round( ( real( string_char_at( seed_apply , slot ) + string_char_at( seed_apply , slot + 1 ) ) / 100 ) * ( ds_list_size( grab_id ) - 1 ) ) ]
  1427.                                    
  1428.                                         if find_index != -1
  1429.                                             {
  1430.                                            
  1431.                                             produce_id[ 3 ] = prod_list[| find_index]
  1432.                                            
  1433.                                             produce_time[ 3 ] = prod_time_list[| find_index] / ( 1 + ( ( num_warfac - 1 ) * 0.2 ) )
  1434.                                            
  1435.                                             funds -= prod_cost_list[| find_index]
  1436.                                            
  1437.                                             if instance_exists( temps )
  1438.                                                 temps.player_funds[ slot ] -= prod_cost_list[| find_index]
  1439.                                            
  1440.                                             }
  1441.                                            
  1442.                                         }
  1443.                                        
  1444.                                         }
  1445.                                
  1446.                             ds_list_clear( grab_type )
  1447.                             ds_list_clear( grab_id )
  1448.                            
  1449.                         }
  1450.                    
  1451.                 break;
  1452.                
  1453.                 }
  1454.            
  1455.             }
  1456.        
  1457.         }
  1458.    
  1459.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement