Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// scr_ai_build()
- gml_pragma("forceinline")
- // info list
- // action type, defined by 'a'
- // 0: cat 1 construction
- // 1: cat 2 construction
- // 2: cat 3 construction
- // 3: cat 4 construction
- var do_it = false
- var limit_break = 0
- var spaceout = 1
- var f = 0
- var ran_length = 0
- var limit_break_x = 0
- var ra_choose = -1
- var b = 0
- var z = 0
- var indi = -1
- var a = 0
- ds_list_clear( ds_compile )
- seed_temp = seed_apply
- if 1 = 1
- {
- tick_time--
- if produce_time[ 0 ] > 0
- produce_time[ 0 ]--
- if produce_time[ 1 ] > 0
- produce_time[ 1 ]--
- if produce_time[ 2 ] > 0
- produce_time[ 2 ]--
- if produce_time[ 3 ] > 0
- produce_time[ 3 ]--
- if cheat = true
- {
- produce_time[ 0 ] = 0
- produce_time[ 1 ] = 0
- produce_time[ 2 ] = 0
- produce_time[ 3 ] = 0
- tick_time = 0
- funds = 99999999
- }
- if tick_time <= 0
- {
- if expand >= 32
- expand = 8
- find_index = 0
- first_index = ""
- tick_time = response_time
- if produce_id[ 0 ] > 0
- if num_conyard = 0
- {
- if instance_exists( temps )
- temps.player_funds[ slot ] += prod_cost_list[| ds_list_find_index( prod_list , produce_id[ 0 ] ) ]
- produce_id[ 0 ] = 0
- produce_time[ 0 ] = 0
- }
- if produce_id[ 1 ] > 0
- if num_conyard = 0
- {
- if instance_exists( temps )
- temps.player_funds[ slot ] += prod_cost_list[| ds_list_find_index( prod_list , produce_id[ 1 ] ) ]
- produce_id[ 1 ] = 0
- produce_time[ 1 ] = 0
- }
- if produce_id[ 2 ] > 0
- if num_barracks = 0
- {
- if instance_exists( temps )
- temps.player_funds[ slot ] += prod_cost_list[| ds_list_find_index( prod_list , produce_id[ 2 ] ) ]
- produce_id[ 2 ] = 0
- produce_time[ 2 ] = 0
- }
- if produce_id[ 3 ] > 0
- if num_warfac = 0
- {
- if instance_exists( temps )
- temps.player_funds[ slot ] += prod_cost_list[| ds_list_find_index( prod_list , produce_id[ 3 ] ) ]
- produce_id[ 3 ] = 0
- produce_time[ 3 ] = 0
- }
- if produce_id[ 0 ] > 0
- if produce_time[ 0 ] <= 0
- {
- prod_limit_list[| ds_list_find_index( prod_list , produce_id[ 0 ] ) ]--
- limit_break = 0
- limit_break_x = 0
- //show_message( seed_apply )
- //show_message( global.tickrate2 )
- do
- {
- ran_length = ( real( string_char_at( seed_temp , slot ) + string_char_at( seed_temp , slot + 1 ) ) / 100 ) * expand
- ranreal = ( real( string_char_at( seed_temp , slot ) + string_char_at( seed_temp , slot + 1 ) ) / 100 ) * 359
- 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 )
- if do_it = true
- {
- limit_break++
- seed_temp = string( round( real( seed_temp ) * 1.1 ) )
- if limit_break = 6
- {
- limit_break = 0
- limit_break_x++
- }
- if limit_break_x = 1
- {
- expand += 2
- limit_break = 0
- }
- }
- }
- until
- do_it = false || limit_break_x = 1
- seed_temp = seed_apply
- limit_break = 0
- if limit_break_x < 1
- {
- 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 )
- {
- side = other.slot
- c_c_id = other.produce_id[ 0 ]
- tickcheck = global.tickrate2
- str = true
- c_w = 4
- c_h = 4
- event_perform( ev_other , ev_user6 )
- custard_alarm[ 11 ] = 1
- }
- if prod_conyard_list[| ds_list_find_index( prod_list , produce_id[ 0 ] ) ] = 1
- num_conyard++
- if prod_barracks_list[| ds_list_find_index( prod_list , produce_id[ 0 ] ) ] = 1
- num_barracks++
- if prod_warfac_list[| ds_list_find_index( prod_list , produce_id[ 0 ] ) ] = 1
- num_warfac++
- if prod_refinery_list[| ds_list_find_index( prod_list , produce_id[ 0 ] ) ] = 1
- num_refinery++
- if prod_harvest_list[| ds_list_find_index( prod_list , produce_id[ 0 ] ) ] = 1
- num_harvester++
- produce_id[ 0 ] = 0
- }
- }
- if produce_id[ 1 ] > 0
- if produce_time[ 1 ] <= 0
- {
- prod_limit_list[| ds_list_find_index( prod_list , produce_id[ 1 ] ) ]--
- limit_break = 0
- limit_break_x = 0
- do
- {
- ran_length = ( real( string_char_at( seed_temp , slot ) + string_char_at( seed_temp , slot + 1 ) ) / 100 ) * expand
- ranreal = ( real( string_char_at( seed_temp , slot ) + string_char_at( seed_temp , slot + 1 ) ) / 100 ) * 359
- 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 )
- if do_it = true
- {
- limit_break++
- seed_temp = string( round( real( seed_temp ) * 1.1 ) )
- if limit_break = 6
- {
- limit_break = 0
- limit_break_x++
- }
- if limit_break_x = 1
- {
- expand += 2
- limit_break = 0
- }
- }
- }
- until
- do_it = false || limit_break_x = 1
- seed_temp = seed_apply
- limit_break = 0
- if limit_break_x < 1
- {
- 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 )
- {
- side = other.slot
- c_c_id = other.produce_id[ 1 ]
- tickcheck = global.tickrate2
- str = true
- c_w = 4
- c_h = 4
- isdefence = true
- spawn_state = 2
- event_perform( ev_other , ev_user6 )
- custard_alarm[ 11 ] = 1
- }
- if prod_conyard_list[| ds_list_find_index( prod_list , produce_id[ 1 ] ) ] = 1
- num_conyard++
- if prod_barracks_list[| ds_list_find_index( prod_list , produce_id[ 1 ] ) ] = 1
- num_barracks++
- if prod_warfac_list[| ds_list_find_index( prod_list , produce_id[ 1 ] ) ] = 1
- num_warfac++
- if prod_refinery_list[| ds_list_find_index( prod_list , produce_id[ 1 ] ) ] = 1
- num_refinery++
- if prod_harvest_list[| ds_list_find_index( prod_list , produce_id[ 1 ] ) ] = 1
- num_harvester++
- if prod_category_list[| ds_list_find_index( prod_list , produce_id[ 1 ] ) ] = 2
- num_str_defence++
- produce_id[ 1 ] = 0
- }
- }
- if produce_id[ 2 ] > 0
- if produce_time[ 2 ] <= 0
- {
- prod_limit_list[| ds_list_find_index( prod_list , produce_id[ 2 ] ) ]--
- with test_u
- {
- if sidebar.primaries[# 1 , other.slot ] = u_id
- if sidebar.primaries[# 1 , other.slot ] != 0
- other.pri_temp = id
- }
- if instance_exists( pri_temp )
- {
- with pri_temp
- {
- other.spawn_at_x = ( ( floor( x / 32 ) * 32 ) + 16 ) + 32
- other.spawn_at_y = ( ( floor( y / 32 ) * 32 ) + 16 ) + 32
- }
- if pri_temp.vehicle = true
- {
- for ( a = 0 ; a <= pri_temp.height ; a += 32 )
- {
- ds_list_add( ingame_sys.part_col , c_white )
- 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 ) )
- 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 ) )
- ds_list_add( ingame_sys.part_sprite , spr_tele )
- ds_list_add( ingame_sys.part_frame , 0 )
- ds_list_add( ingame_sys.part_frame_var , .5 )
- ds_list_add( ingame_sys.part_scale_x , 1 )
- ds_list_add( ingame_sys.part_scale_y , 1 )
- ds_list_add( ingame_sys.part_scale_x_var , 0.02 )
- ds_list_add( ingame_sys.part_scale_y_var , 0.05 )
- ds_list_add( ingame_sys.part_bounce , 0 )
- ds_list_add( ingame_sys.part_rot , 0 )
- ds_list_add( ingame_sys.part_rot_var , 0 )
- ds_list_add( ingame_sys.part_alpha , .5 )
- ds_list_add( ingame_sys.part_alpha_var , -.01 )
- ds_list_add( ingame_sys.part_height , a )
- ds_list_add( ingame_sys.part_x_speed , 0 )
- ds_list_add( ingame_sys.part_y_speed , 0 )
- ds_list_add( ingame_sys.part_z_speed , -.5 )
- ds_list_add( ingame_sys.part_g_speed , 0 )
- ds_list_add( ingame_sys.part_time , 600 )
- }
- queue_sound( 3 , deploy_sfx , 0.5 , iso_x( x , y ) , iso_y( x , y ) , 1024 )
- }
- 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 )
- }
- if obj_console.pop_limit != 0
- ds_list_add( limit_pop , inst_create )
- with inst_create
- {
- side = other.slot
- c_c_id = other.produce_id[ 2 ]
- tickcheck = global.tickrate2
- c_w = 4
- c_h = 4
- spawn_state = 2
- event_perform( ev_other , ev_user6 )
- custard_alarm[ 11 ] = 1
- }
- event_perform( ev_other , ev_user2 )
- if prod_conyard_list[| ds_list_find_index( prod_list , produce_id[ 2 ] ) ] = 1
- num_conyard++
- if prod_barracks_list[| ds_list_find_index( prod_list , produce_id[ 2 ] ) ] = 1
- num_barracks++
- if prod_warfac_list[| ds_list_find_index( prod_list , produce_id[ 2 ] ) ] = 1
- num_warfac++
- if prod_refinery_list[| ds_list_find_index( prod_list , produce_id[ 2 ] ) ] = 1
- num_refinery++
- if prod_harvest_list[| ds_list_find_index( prod_list , produce_id[ 2 ] ) ] = 1
- num_harvester++
- produce_id[ 2 ] = 0
- }
- if produce_id[ 3 ] > 0
- if produce_time[ 3 ] <= 0
- {
- prod_limit_list[| ds_list_find_index( prod_list , produce_id[ 3 ] ) ]--
- with test_u
- {
- if sidebar.primaries[# 2 , other.slot ] = u_id
- if sidebar.primaries[# 2 , other.slot ] != 0
- other.pri_temp = id
- }
- if instance_exists( pri_temp )
- {
- with pri_temp
- {
- other.spawn_at_x = ( ( floor( x / 32 ) * 32 ) + 16 ) + 32
- other.spawn_at_y = ( ( floor( y / 32 ) * 32 ) + 16 ) + 32
- }
- if pri_temp.vehicle = true
- {
- for ( a = 0 ; a <= pri_temp.height ; a += 32 )
- {
- ds_list_add( ingame_sys.part_col , c_white )
- 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 ) )
- 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 ) )
- ds_list_add( ingame_sys.part_sprite , spr_tele )
- ds_list_add( ingame_sys.part_frame , 0 )
- ds_list_add( ingame_sys.part_frame_var , .5 )
- ds_list_add( ingame_sys.part_scale_x , 1 )
- ds_list_add( ingame_sys.part_scale_y , 1 )
- ds_list_add( ingame_sys.part_scale_x_var , 0.02 )
- ds_list_add( ingame_sys.part_scale_y_var , 0.05 )
- ds_list_add( ingame_sys.part_bounce , 0 )
- ds_list_add( ingame_sys.part_rot , 0 )
- ds_list_add( ingame_sys.part_rot_var , 0 )
- ds_list_add( ingame_sys.part_alpha , .5 )
- ds_list_add( ingame_sys.part_alpha_var , -.01 )
- ds_list_add( ingame_sys.part_height , a )
- ds_list_add( ingame_sys.part_x_speed , 0 )
- ds_list_add( ingame_sys.part_y_speed , 0 )
- ds_list_add( ingame_sys.part_z_speed , -.5 )
- ds_list_add( ingame_sys.part_g_speed , 0 )
- ds_list_add( ingame_sys.part_time , 600 )
- }
- queue_sound( 3 , deploy_sfx , 0.5 , iso_x( x , y ) , iso_y( x , y ) , 1024 )
- }
- 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 )
- }
- if obj_console.pop_limit != 0
- ds_list_add( limit_pop , inst_create )
- with inst_create
- {
- side = other.slot
- c_c_id = other.produce_id[ 3 ]
- tickcheck = global.tickrate2
- c_w = 4
- c_h = 4
- vehicle = true
- spawn_state = 2
- event_perform( ev_other , ev_user6 )
- custard_alarm[ 11 ] = 1
- }
- event_perform( ev_other , ev_user2 )
- if prod_conyard_list[| ds_list_find_index( prod_list , produce_id[ 3 ] ) ] = 1
- num_conyard++
- if prod_barracks_list[| ds_list_find_index( prod_list , produce_id[ 3 ] ) ] = 1
- num_barracks++
- if prod_warfac_list[| ds_list_find_index( prod_list , produce_id[ 3 ] ) ] = 1
- num_warfac++
- if prod_refinery_list[| ds_list_find_index( prod_list , produce_id[ 3 ] ) ] = 1
- num_refinery++
- if prod_harvest_list[| ds_list_find_index( prod_list , produce_id[ 3 ] ) ] = 1
- num_harvester++
- produce_id[ 3 ] = 0
- }
- //
- for ( var a = 0 ; a <= 3 ; a++ )
- {
- ds_list_clear( grab_type )
- ds_list_clear( grab_id )
- switch( a )
- {
- case 0:
- if ai_expand = true
- {
- if num_conyard > 0
- if produce_id[ 0 ] = 0
- {
- find_index = -1
- ds_list_clear( grab_type )
- ds_list_clear( grab_id )
- if num_barracks <= mins
- if produce_id[ 0 ] = 0
- {
- for ( f = 0 ; f < ds_list_size( prod_list ) ; f++ )
- {
- if funds < prod_cost_list[| f]
- if powerup_money <= 0
- {
- powerup_money = 600
- for ( b = 0 ; b < ds_list_size( powerup_list ) ; b++ )
- {
- if powerup_list[| b] = 7
- if powerup_hide[| b] = 0
- {
- ds_list_add( ds_compile , powerup_list[| b] )
- }
- }
- if !ds_list_empty( ds_compile )
- if powerup_have > 0
- {
- 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 ) ] )
- }
- }
- if prod_category_list[| f] = 1
- if prod_barracks_list[| f] = 1
- if funds >= prod_cost_list[| f]
- if prod_dont_list[| f] = 0
- if prod_limit_list[| f] > 0
- {
- ds_list_add( grab_type , prod_list[| f] )
- ds_list_add( grab_id , f )
- }
- }
- if !ds_list_empty( grab_id )
- 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 ) ) ]
- if find_index != -1
- {
- produce_id[ 0 ] = prod_list[| find_index]
- produce_time[ 0 ] = prod_time_list[| find_index] / ( 1 + ( ( num_conyard - 1 ) * 0.2 ) )
- funds -= prod_cost_list[| find_index]
- if instance_exists( temps )
- temps.player_funds[ slot ] -= prod_cost_list[| find_index]
- }
- }
- ds_list_clear( grab_type )
- ds_list_clear( grab_id )
- find_index = -1
- if num_refinery <= mins
- if produce_id[ 0 ] = 0
- {
- for ( f = 0 ; f < ds_list_size( prod_list ) ; f++ )
- {
- if funds < prod_cost_list[| f]
- if powerup_money <= 0
- {
- powerup_money = 600
- for ( b = 0 ; b < ds_list_size( powerup_list ) ; b++ )
- {
- if powerup_list[| b] = 7
- if powerup_hide[| b] = 0
- {
- ds_list_add( ds_compile , powerup_list[| b] )
- }
- }
- if !ds_list_empty( ds_compile )
- if powerup_have > 0
- {
- 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 ) ] )
- }
- }
- if prod_category_list[| f] = 1
- if prod_refinery_list[| f] = 1
- if funds >= prod_cost_list[| f]
- if prod_dont_list[| f] = 0
- if prod_limit_list[| f] > 0
- {
- ds_list_add( grab_type , prod_list[| f] )
- ds_list_add( grab_id , f )
- }
- }
- if !ds_list_empty( grab_id )
- 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 ) ) ]
- if find_index != -1
- {
- produce_id[ 0 ] = prod_list[| find_index]
- produce_time[ 0 ] = prod_time_list[| find_index] / ( 1 + ( ( num_conyard - 1 ) * 0.2 ) )
- funds -= prod_cost_list[| find_index]
- if instance_exists( temps )
- temps.player_funds[ slot ] -= prod_cost_list[| find_index]
- }
- }
- find_index = -1
- ds_list_clear( grab_type )
- ds_list_clear( grab_id )
- if num_warfac <= mins
- if produce_id[ 0 ] = 0
- {
- for ( f = 0 ; f < ds_list_size( prod_list ) ; f++ )
- {
- if funds < prod_cost_list[| f]
- if powerup_money <= 0
- {
- powerup_money = 600
- for ( b = 0 ; b < ds_list_size( powerup_list ) ; b++ )
- {
- if powerup_list[| b] = 7
- if powerup_hide[| b] = 0
- {
- ds_list_add( ds_compile , powerup_list[| b] )
- }
- }
- if !ds_list_empty( ds_compile )
- if powerup_have > 0
- {
- 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 ) ] )
- }
- }
- if prod_category_list[| f] = 1
- if prod_warfac_list[| f] = 1
- if funds >= prod_cost_list[| f]
- if prod_dont_list[| f] = 0
- if prod_limit_list[| f] > 0
- {
- ds_list_add( grab_type , prod_list[| f] )
- ds_list_add( grab_id , f )
- }
- }
- if !ds_list_empty( grab_id )
- 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 ) ) ]
- if find_index != -1
- {
- produce_id[ 0 ] = prod_list[| find_index]
- produce_time[ 0 ] = prod_time_list[| find_index] / ( 1 + ( ( num_conyard - 1 ) * 0.2 ) )
- funds -= prod_cost_list[| find_index]
- if instance_exists( temps )
- temps.player_funds[ slot ] -= prod_cost_list[| find_index]
- }
- }
- ds_list_clear( grab_type )
- ds_list_clear( grab_id )
- find_index = -1
- if num_conyard <= mins
- if produce_id[ 0 ] = 0
- {
- for ( f = 0 ; f < ds_list_size( prod_list ) ; f++ )
- {
- if funds < prod_cost_list[| f]
- if powerup_money <= 0
- {
- powerup_money = 600
- for ( b = 0 ; b < ds_list_size( powerup_list ) ; b++ )
- {
- if powerup_list[| b] = 7
- if powerup_hide[| b] = 0
- {
- ds_list_add( ds_compile , powerup_list[| b] )
- }
- }
- if !ds_list_empty( ds_compile )
- if powerup_have > 0
- {
- 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 ) ] )
- }
- }
- if prod_category_list[| f] = 1
- if prod_conyard_list[| f] = 1
- if funds >= prod_cost_list[| f]
- if prod_dont_list[| f] = 0
- if prod_limit_list[| f] > 0
- {
- ds_list_add( grab_type , prod_list[| f] )
- ds_list_add( grab_id , f )
- }
- }
- if !ds_list_empty( grab_id )
- 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 ) ) ]
- if find_index != -1
- {
- produce_id[ 0 ] = prod_list[| find_index]
- produce_time[ 0 ] = prod_time_list[| find_index] / ( 1 + ( ( num_conyard - 1 ) * 0.2 ) )
- funds -= prod_cost_list[| find_index]
- if instance_exists( temps )
- temps.player_funds[ slot ] -= prod_cost_list[| find_index]
- }
- }
- find_index = -1
- ds_list_clear( grab_type )
- ds_list_clear( grab_id )
- if produce_id[ 0 ] = 0
- {
- for ( f = 0 ; f < ds_list_size( prod_list ) ; f++ )
- {
- if funds < prod_cost_list[| f]
- if powerup_money <= 0
- {
- powerup_money = 600
- for ( b = 0 ; b < ds_list_size( powerup_list ) ; b++ )
- {
- if powerup_list[| b] = 7
- if powerup_hide[| b] = 0
- {
- ds_list_add( ds_compile , powerup_list[| b] )
- }
- }
- if !ds_list_empty( ds_compile )
- if powerup_have > 0
- {
- 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 ) ] )
- }
- }
- if prod_conyard_list[| f] = 0
- if prod_refinery_list[| f] = 0
- if prod_barracks_list[| f] = 0
- if prod_warfac_list[| f] = 0
- if prod_category_list[| f] = 1
- if funds >= prod_cost_list[| f]
- if prod_dont_list[| f] = 0
- if prod_limit_list[| f] > 0
- {
- ds_list_add( grab_type , prod_list[| f] )
- ds_list_add( grab_id , f )
- }
- }
- if !ds_list_empty( grab_id )
- 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 ) ) ]
- if find_index != -1
- {
- produce_id[ 0 ] = prod_list[| find_index]
- produce_time[ 0 ] = prod_time_list[| find_index] / ( 1 + ( ( num_conyard - 1 ) * 0.2 ) )
- funds -= prod_cost_list[| find_index]
- if instance_exists( temps )
- temps.player_funds[ slot ] -= prod_cost_list[| find_index]
- }
- }
- ds_list_clear( grab_type )
- ds_list_clear( grab_id )
- find_index = -1
- if produce_id[ 0 ] = 0
- {
- for ( f = 0 ; f < ds_list_size( prod_list ) ; f++ )
- {
- if funds < prod_cost_list[| f]
- if powerup_money <= 0
- {
- powerup_money = 600
- for ( b = 0 ; b < ds_list_size( powerup_list ) ; b++ )
- {
- if powerup_list[| b] = 7
- if powerup_hide[| b] = 0
- {
- ds_list_add( ds_compile , powerup_list[| b] )
- }
- }
- if !ds_list_empty( ds_compile )
- if powerup_have > 0
- {
- 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 ) ] )
- }
- }
- 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.
- if funds >= prod_cost_list[| f]
- if prod_dont_list[| f] = 0
- if prod_limit_list[| f] > 0
- {
- ds_list_add( grab_type , prod_list[| f] )
- ds_list_add( grab_id , f )
- }
- }
- if !ds_list_empty( grab_id )
- 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 ) ) ]
- if find_index != -1
- {
- produce_id[ 0 ] = prod_list[| find_index]
- produce_time[ 0 ] = prod_time_list[| find_index] / ( 1 + ( ( num_conyard - 1 ) * 0.2 ) )
- funds -= prod_cost_list[| find_index]
- if instance_exists( temps )
- temps.player_funds[ slot ] -= prod_cost_list[| find_index]
- }
- }
- ds_list_clear( grab_type )
- ds_list_clear( grab_id )
- find_index = -1
- }
- }
- ds_list_clear( grab_type )
- ds_list_clear( grab_id )
- break;
- // defences
- case 1:
- if ai_defence = true
- {
- find_index = -1
- if produce_id[ 1 ] = 0
- if num_conyard > 0
- if num_str_defence <= mins * 3
- {
- for ( f = 0 ; f < ds_list_size( prod_list ) ; f++ )
- {
- if funds < prod_cost_list[| f]
- if powerup_money <= 0
- {
- powerup_money = 600
- for ( b = 0 ; b < ds_list_size( powerup_list ) ; b++ )
- {
- if powerup_list[| b] = 7
- if powerup_hide[| b] = 0
- {
- ds_list_add( ds_compile , powerup_list[| b] )
- }
- }
- if !ds_list_empty( ds_compile )
- if powerup_have > 0
- {
- 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 ) ] )
- }
- }
- if prod_category_list[| f] = 2
- if prod_can_att_list[| f] = 1
- if funds >= prod_cost_list[| f]
- if prod_dont_list[| f] = 0
- if prod_limit_list[| f] > 0
- {
- ds_list_add( grab_type , prod_list[| f] )
- ds_list_add( grab_id , f )
- }
- }
- if !ds_list_empty( grab_id )
- 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 ) ) ]
- if find_index != -1
- {
- produce_id[ 1 ] = prod_list[| find_index]
- produce_time[ 1 ] = prod_time_list[| find_index] / ( 1 + ( ( num_conyard - 1 ) * 0.2 ) )
- funds -= prod_cost_list[| find_index]
- if instance_exists( temps )
- temps.player_funds[ slot ] -= prod_cost_list[| find_index]
- }
- }
- }
- ds_list_clear( grab_type )
- ds_list_clear( grab_id )
- break;
- // infantry
- case 2:
- if ds_list_size( limit_pop ) < obj_console.pop_limit || obj_console.pop_limit = 0
- {
- if ai_harvester = true
- {
- find_index = -1
- if produce_id[ 2 ] = 0
- if num_barracks > 0
- {
- // harvesters
- find_index = -1
- if num_harvester <= mins + 5
- if produce_id[ 2 ] = 0
- {
- for ( f = 0 ; f < ds_list_size( prod_list ) ; f++ )
- {
- if funds < prod_cost_list[| f]
- if powerup_money <= 0
- {
- powerup_money = 600
- for ( b = 0 ; b < ds_list_size( powerup_list ) ; b++ )
- {
- if powerup_list[| b] = 7
- if powerup_hide[| b] = 0
- {
- ds_list_add( ds_compile , powerup_list[| b] )
- }
- }
- if !ds_list_empty( ds_compile )
- if powerup_have > 0
- {
- 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 ) ] )
- }
- }
- if prod_category_list[| f] = 3
- if prod_harvest_list[| f] = 1
- if funds >= prod_cost_list[| f]
- if prod_dont_list[| f] = 0
- if prod_limit_list[| f] > 0
- {
- ds_list_add( grab_type , prod_list[| f] )
- ds_list_add( grab_id , f )
- }
- }
- if !ds_list_empty( grab_id )
- 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 ) ) ]
- if find_index != -1
- {
- produce_id[ 2 ] = prod_list[| find_index]
- produce_time[ 2 ] = prod_time_list[| find_index] / ( 1 + ( ( num_barracks - 1 ) * 0.2 ) )
- funds -= prod_cost_list[| find_index]
- if instance_exists( temps )
- temps.player_funds[ slot ] -= prod_cost_list[| find_index]
- }
- }
- }
- }
- ds_list_clear( grab_type )
- ds_list_clear( grab_id )
- if ai_army = true
- {
- find_index = -1
- if produce_id[ 2 ] = 0
- if num_barracks > 0
- {
- for ( f = 0 ; f < ds_list_size( prod_list ) ; f++ )
- {
- if funds < prod_cost_list[| f]
- if powerup_money <= 0
- {
- powerup_money = 600
- for ( b = 0 ; b < ds_list_size( powerup_list ) ; b++ )
- {
- if powerup_list[| b] = 7
- if powerup_hide[| b] = 0
- {
- ds_list_add( ds_compile , powerup_list[| b] )
- }
- }
- if !ds_list_empty( ds_compile )
- if powerup_have > 0
- {
- 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 ) ] )
- }
- }
- if prod_category_list[| f] = 3
- if prod_can_att_list[| f] = 1
- if funds >= prod_cost_list[| f]
- if prod_dont_list[| f] = 0
- if prod_limit_list[| f] > 0
- {
- ds_list_add( grab_type , prod_list[| f] )
- ds_list_add( grab_id , f )
- }
- }
- if !ds_list_empty( grab_id )
- 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 ) ) ]
- if find_index != -1
- {
- produce_id[ 2 ] = prod_list[| find_index]
- produce_time[ 2 ] = prod_time_list[| find_index] / ( 1 + ( ( num_barracks - 1 ) * 0.2 ) )
- funds -= prod_cost_list[| find_index]
- if instance_exists( temps )
- temps.player_funds[ slot ] -= prod_cost_list[| find_index]
- }
- }
- }
- ds_list_clear( grab_type )
- ds_list_clear( grab_id )
- }
- break;
- // warfacs
- case 3:
- if ds_list_size( limit_pop ) < obj_console.pop_limit || obj_console.pop_limit = 0
- {
- if ai_harvester = true
- {
- find_index = -1
- if produce_id[ 3 ] = 0
- if num_warfac > 0
- {
- // harvesters
- find_index = -1
- if num_harvester <= mins + 1
- if produce_id[ 3 ] = 0
- {
- for ( f = 0 ; f < ds_list_size( prod_list ) ; f++ )
- {
- if funds < prod_cost_list[| f]
- if powerup_money <= 0
- {
- powerup_money = 600
- for ( b = 0 ; b < ds_list_size( powerup_list ) ; b++ )
- {
- if powerup_list[| b] = 7
- if powerup_hide[| b] = 0
- {
- ds_list_add( ds_compile , powerup_list[| b] )
- }
- }
- if !ds_list_empty( ds_compile )
- if powerup_have > 0
- {
- 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 ) ] )
- }
- }
- if prod_category_list[| f] = 4
- if prod_harvest_list[| f] = 1
- if funds >= prod_cost_list[| f]
- if prod_dont_list[| f] = 0
- if prod_limit_list[| f] > 0
- {
- ds_list_add( grab_type , prod_list[| f] )
- ds_list_add( grab_id , f )
- }
- }
- if !ds_list_empty( grab_id )
- 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 ) ) ]
- if find_index != -1
- {
- produce_id[ 3 ] = prod_list[| find_index]
- produce_time[ 3 ] = prod_time_list[| find_index] / ( 1 + ( ( num_warfac - 1 ) * 0.2 ) )
- funds -= prod_cost_list[| find_index]
- if instance_exists( temps )
- temps.player_funds[ slot ] -= prod_cost_list[| find_index]
- }
- }
- }
- }
- ds_list_clear( grab_type )
- ds_list_clear( grab_id )
- //
- if ai_army = true
- {
- find_index = -1
- if produce_id[ 3 ] = 0
- if num_warfac > 0
- {
- for ( f = 0 ; f < ds_list_size( prod_list ) ; f++ )
- {
- if funds < prod_cost_list[| f]
- if powerup_money <= 0
- {
- powerup_money = 600
- for ( b = 0 ; b < ds_list_size( powerup_list ) ; b++ )
- {
- if powerup_list[| b] = 7
- if powerup_hide[| b] = 0
- {
- ds_list_add( ds_compile , powerup_list[| b] )
- }
- }
- if !ds_list_empty( ds_compile )
- if powerup_have > 0
- {
- 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 ) ] )
- }
- }
- if prod_category_list[| f] = 4
- if funds >= prod_cost_list[| f]
- if prod_dont_list[| f] = 0
- if prod_limit_list[| f] > 0
- {
- ds_list_add( grab_type , prod_list[| f] )
- ds_list_add( grab_id , f )
- }
- }
- if !ds_list_empty( grab_id )
- 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 ) ) ]
- if find_index != -1
- {
- produce_id[ 3 ] = prod_list[| find_index]
- produce_time[ 3 ] = prod_time_list[| find_index] / ( 1 + ( ( num_warfac - 1 ) * 0.2 ) )
- funds -= prod_cost_list[| find_index]
- if instance_exists( temps )
- temps.player_funds[ slot ] -= prod_cost_list[| find_index]
- }
- }
- }
- ds_list_clear( grab_type )
- ds_list_clear( grab_id )
- }
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement