Added my version of the ai controller to core.
Needs some WML changes and better default values.
This commit is contained in:
parent
e27050afbb
commit
c99a4f6897
1 changed files with 838 additions and 0 deletions
838
data/core/macros/ai_controller.cfg
Normal file
838
data/core/macros/ai_controller.cfg
Normal file
|
@ -0,0 +1,838 @@
|
|||
#textdomain wesnoth
|
||||
|
||||
#define AI_CONTROLLER ID PLAYER_SIDE ALLY_SIDES VARIABLES
|
||||
# expects $order_type to be set
|
||||
[event]
|
||||
name=apply_ai_params
|
||||
first_time_only=no
|
||||
|
||||
{FOREACH ai_controller.side_$ally_side|_original_settings.ai_settings.ai i}
|
||||
[if]
|
||||
[variable]
|
||||
name=foo
|
||||
equals=bar
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
{VARIABLE_OP i add -1}
|
||||
[/then]
|
||||
[/if]
|
||||
{NEXT i}
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=ai_controller_{ID}.$order_type|.merge
|
||||
boolean_equals=yes
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
[set_variables]
|
||||
name=temp
|
||||
|
||||
[insert_tag]
|
||||
name=literal
|
||||
variable=ai_controller.side_$ally_side|_original_settings.ai_settings.ai
|
||||
[/insert_tag]
|
||||
|
||||
[insert_tag]
|
||||
name=literal
|
||||
variable=ai_controller_{ID}.$order_type|.ai
|
||||
[/insert_tag]
|
||||
[/set_variables]
|
||||
|
||||
[modify_side]
|
||||
side=$ally_side
|
||||
|
||||
[insert_tag]
|
||||
name=ai
|
||||
variable=temp
|
||||
[/insert_tag]
|
||||
[/modify_side]
|
||||
[/then]
|
||||
|
||||
[else]
|
||||
[modify_side]
|
||||
side=$ally_side
|
||||
|
||||
[insert_tag]
|
||||
name=ai
|
||||
variable=ai_controller_{ID}.$order_type|.ai
|
||||
[/insert_tag]
|
||||
[/modify_side]
|
||||
[/else]
|
||||
[/if]
|
||||
[/event]
|
||||
|
||||
[event]
|
||||
name=prestart
|
||||
|
||||
[set_variables]
|
||||
name=ai_controller_{ID}
|
||||
|
||||
# This block contains all the default settings and options.
|
||||
[literal]
|
||||
enabled=yes
|
||||
player_side={PLAYER_SIDE}
|
||||
ally_sides={ALLY_SIDES}
|
||||
disabled_for_sides=0
|
||||
|
||||
################
|
||||
|
||||
[aggression]
|
||||
[ai]
|
||||
aggression=0.9
|
||||
caution=0.1
|
||||
[/ai]
|
||||
|
||||
[option]
|
||||
message= _ "Be more aggressive."
|
||||
|
||||
[show_if]
|
||||
[variable]
|
||||
name=ai_controller_{ID}.aggression.disabled
|
||||
not_equals=yes
|
||||
[/variable]
|
||||
[/show_if]
|
||||
|
||||
[command]
|
||||
{VARIABLE order_type aggression}
|
||||
|
||||
[fire_event]
|
||||
name=apply_ai_params
|
||||
[/fire_event]
|
||||
|
||||
{VARIABLE ai_controller.side_$ally_side|_current_settings.behaviour_set yes}
|
||||
{VARIABLE ai_controller.side_$ally_side|_current_settings.currently_doing_behaviour_description _"aggressive."}
|
||||
[/command]
|
||||
[/option]
|
||||
[/aggression]
|
||||
|
||||
################
|
||||
|
||||
[caution]
|
||||
[ai]
|
||||
aggression=0.1
|
||||
caution=1.0
|
||||
grouping=defensive
|
||||
[/ai]
|
||||
|
||||
[option]
|
||||
message= _ "Be more defensive."
|
||||
|
||||
[show_if]
|
||||
[variable]
|
||||
name=ai_controller_{ID}.caution.disabled
|
||||
not_equals=yes
|
||||
[/variable]
|
||||
[/show_if]
|
||||
|
||||
[command]
|
||||
{VARIABLE order_type caution}
|
||||
|
||||
[fire_event]
|
||||
name=apply_ai_params
|
||||
[/fire_event]
|
||||
|
||||
{VARIABLE ai_controller.side_$ally_side|_current_settings.behaviour_set yes}
|
||||
{VARIABLE ai_controller.side_$ally_side|_current_settings.currently_doing_behaviour_description _"defensive."}
|
||||
[/command]
|
||||
[/option]
|
||||
[/caution]
|
||||
|
||||
################
|
||||
|
||||
[focus_on_enemy]
|
||||
[ai]
|
||||
[target]
|
||||
side=$temp_i
|
||||
value=20
|
||||
[/target]
|
||||
[/ai]
|
||||
|
||||
[option]
|
||||
message= _ "Focus on defeating..."
|
||||
|
||||
[show_if]
|
||||
[variable]
|
||||
name=ai_controller_{ID}.focus_on_enemy.disabled
|
||||
not_equals=yes
|
||||
[/variable]
|
||||
[/show_if]
|
||||
|
||||
[command]
|
||||
[set_variables]
|
||||
name=focus_on_enemy_options_message
|
||||
|
||||
[literal]
|
||||
caption= _"Instruct ally"
|
||||
speaker=narrator
|
||||
image=wesnoth-icon.png
|
||||
message= _"Which enemy side to focus on?"
|
||||
[/literal]
|
||||
[/set_variables]
|
||||
|
||||
[store_side]
|
||||
side=$ally_side
|
||||
variable=stored_ally_side
|
||||
[/store_side]
|
||||
|
||||
{VARIABLE temp_i 1}
|
||||
|
||||
[while]
|
||||
[variable]
|
||||
name=temp_i
|
||||
less_than=10
|
||||
[/variable]
|
||||
|
||||
[do]
|
||||
[store_side]
|
||||
side=$temp_i
|
||||
variable=stored_other_side
|
||||
[/store_side]
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=stored_ally_side.team_name
|
||||
not_equals=$stored_other_side.team_name
|
||||
[/variable]
|
||||
|
||||
[have_unit]
|
||||
side=$temp_i
|
||||
[/have_unit]
|
||||
|
||||
[then]
|
||||
[if]
|
||||
[have_unit]
|
||||
side=$temp_i
|
||||
canrecruit=yes
|
||||
[/have_unit]
|
||||
|
||||
[then]
|
||||
[store_unit]
|
||||
[filter]
|
||||
side=$temp_i
|
||||
canrecruit=yes
|
||||
|
||||
[filter_vision]
|
||||
viewing_side=$side_number
|
||||
visible=yes
|
||||
[/filter_vision]
|
||||
[/filter]
|
||||
|
||||
kill=no
|
||||
variable=side_i_leader
|
||||
[/store_unit]
|
||||
|
||||
{VARIABLE this_enemy_txt_img_description "&$side_i_leader.image~TC($temp_i|,$side_i_leader.flag_rgb|)=$side_i_leader.name|="+_"(side $temp_i|)"}
|
||||
{VARIABLE this_enemy_description _"$side_i_leader.name (side $temp_i|)"}
|
||||
[/then]
|
||||
|
||||
[else]
|
||||
{VARIABLE this_enemy_txt_img_description "&misc/blank-hex.png= ="+_"(side $temp_i|)"}
|
||||
{VARIABLE this_enemy_description _"side $temp_i"}
|
||||
[/else]
|
||||
[/if]
|
||||
|
||||
[set_variables]
|
||||
name=focus_on_enemy_options_message.option
|
||||
mode=append
|
||||
|
||||
[value]
|
||||
message=$this_enemy_txt_img_description
|
||||
|
||||
[command]
|
||||
{VARIABLE order_type focus_on_enemy}
|
||||
|
||||
[fire_event]
|
||||
name=apply_ai_params
|
||||
[/fire_event]
|
||||
|
||||
{VARIABLE ai_controller.side_$ally_side|_current_settings.focus_on_enemy.side $temp_i}
|
||||
{VARIABLE ai_controller.side_$ally_side|_current_settings.objective_set yes}
|
||||
{VARIABLE ai_controller.side_$ally_side|_current_settings.currently_doing_objective_description _"focusing on defeating $this_enemy_description|."}
|
||||
[/command]
|
||||
[/value]
|
||||
[/set_variables]
|
||||
[/then]
|
||||
[/if]
|
||||
|
||||
{VARIABLE_OP temp_i add 1}
|
||||
[/do]
|
||||
[/while]
|
||||
|
||||
[insert_tag]
|
||||
name=message
|
||||
variable=focus_on_enemy_options_message
|
||||
[/insert_tag]
|
||||
|
||||
{CLEAR_VARIABLE stored_other_side,focus_on_enemy_options_message,side_i_leader,this_enemy_description}
|
||||
[/command]
|
||||
[/option]
|
||||
[/focus_on_enemy]
|
||||
|
||||
################
|
||||
|
||||
[protect]
|
||||
[ai]
|
||||
[target]
|
||||
side=$temp_i
|
||||
value=20
|
||||
[/target]
|
||||
[/ai]
|
||||
|
||||
[option]
|
||||
message= _ "Focus on protecting..."
|
||||
|
||||
[show_if]
|
||||
[variable]
|
||||
name=ai_controller_{ID}.protect.disabled
|
||||
not_equals=yes
|
||||
[/variable]
|
||||
[/show_if]
|
||||
|
||||
[command]
|
||||
[set_variables]
|
||||
name=protect_options_message
|
||||
|
||||
[literal]
|
||||
caption= _"Instruct ally"
|
||||
speaker=narrator
|
||||
image=wesnoth-icon.png
|
||||
message= _"Which friendly side to protect?"
|
||||
[/literal]
|
||||
[/set_variables]
|
||||
|
||||
[store_side]
|
||||
side=$ally_side
|
||||
variable=stored_ally_side
|
||||
[/store_side]
|
||||
|
||||
{VARIABLE temp_i 1}
|
||||
|
||||
[while]
|
||||
[variable]
|
||||
name=temp_i
|
||||
less_than=10
|
||||
[/variable]
|
||||
|
||||
[do]
|
||||
[store_side]
|
||||
side=$temp_i
|
||||
variable=stored_other_side
|
||||
[/store_side]
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=ally_side
|
||||
not_equals=$temp_i
|
||||
[/variable]
|
||||
|
||||
[variable]
|
||||
name=stored_ally_side.team_name
|
||||
equals=$stored_other_side.team_name
|
||||
[/variable]
|
||||
|
||||
[have_unit]
|
||||
side=$temp_i
|
||||
[/have_unit]
|
||||
|
||||
[then]
|
||||
[if]
|
||||
[have_unit]
|
||||
side=$temp_i
|
||||
canrecruit=yes
|
||||
[/have_unit]
|
||||
|
||||
[then]
|
||||
[store_unit]
|
||||
[filter]
|
||||
side=$temp_i
|
||||
canrecruit=yes
|
||||
|
||||
[filter_vision]
|
||||
viewing_side=$side_number
|
||||
visible=yes
|
||||
[/filter_vision]
|
||||
[/filter]
|
||||
|
||||
kill=no
|
||||
variable=side_i_leader
|
||||
[/store_unit]
|
||||
|
||||
{VARIABLE this_ally_txt_img_description "&$side_i_leader.image~TC($temp_i|,$side_i_leader.flag_rgb|)=$side_i_leader.name|="+_"(side $temp_i|)"}
|
||||
{VARIABLE this_ally_description _"$side_i_leader.name (side $temp_i|)"}
|
||||
[/then]
|
||||
|
||||
[else]
|
||||
{VARIABLE this_ally_txt_img_description "&misc/blank-hex.png= ="+_"(side $temp_i|)"}
|
||||
{VARIABLE this_ally_description _"side $temp_i"}
|
||||
[/else]
|
||||
[/if]
|
||||
|
||||
[set_variables]
|
||||
name=protect_options_message.option
|
||||
mode=append
|
||||
|
||||
[value]
|
||||
message=$this_ally_txt_img_description
|
||||
|
||||
[command]
|
||||
{VARIABLE order_type protect}
|
||||
|
||||
[fire_event]
|
||||
name=apply_ai_params
|
||||
[/fire_event]
|
||||
|
||||
{VARIABLE ai_controller.side_$ally_side|_current_settings.protect.side $temp_i}
|
||||
{VARIABLE ai_controller.side_$ally_side|_current_settings.objective_set yes}
|
||||
{VARIABLE ai_controller.side_$ally_side|_current_settings.currently_doing_objective_description _"focusing on protecting $this_ally_description|."}
|
||||
[/command]
|
||||
[/value]
|
||||
[/set_variables]
|
||||
[/then]
|
||||
[/if]
|
||||
|
||||
{VARIABLE_OP temp_i add 1}
|
||||
[/do]
|
||||
[/while]
|
||||
|
||||
[insert_tag]
|
||||
name=message
|
||||
variable=protect_options_message
|
||||
[/insert_tag]
|
||||
|
||||
{CLEAR_VARIABLE stored_other_side,protect_options_message,side_i_leader,this_ally_description}
|
||||
[/command]
|
||||
[/option]
|
||||
[/protect]
|
||||
|
||||
################
|
||||
|
||||
[revoke_objective_orders]
|
||||
[option]
|
||||
message= _ "Clear objective orders"
|
||||
|
||||
[show_if]
|
||||
[variable]
|
||||
name=ai_controller_{ID}.revoke_objective_orders.disabled
|
||||
not_equals=yes
|
||||
[/variable]
|
||||
[/show_if]
|
||||
|
||||
[command]
|
||||
[insert_tag]
|
||||
name=modify_side
|
||||
variable=ai_controller.side_$ally_side|_original_settings.ai_settings
|
||||
[/insert_tag]
|
||||
|
||||
{VARIABLE ai_controller.side_$ally_side|_current_settings.objective_set no}
|
||||
[/command]
|
||||
[/option]
|
||||
[/revoke_objective_orders]
|
||||
|
||||
################
|
||||
|
||||
[revoke_behaviour_orders]
|
||||
[option]
|
||||
message= _ "Clear behaviour orders"
|
||||
|
||||
[show_if]
|
||||
[variable]
|
||||
name=ai_controller_{ID}.revoke_behaviour_orders.disabled
|
||||
not_equals=yes
|
||||
[/variable]
|
||||
[/show_if]
|
||||
|
||||
[command]
|
||||
[insert_tag]
|
||||
name=modify_side
|
||||
variable=ai_controller.side_$ally_side|_original_settings.ai_settings
|
||||
[/insert_tag]
|
||||
|
||||
{VARIABLE ai_controller.side_$ally_side|_current_settings.behaviour_set no}
|
||||
[/command]
|
||||
[/option]
|
||||
[/revoke_behaviour_orders]
|
||||
|
||||
################
|
||||
|
||||
[revoke_all_orders]
|
||||
[option]
|
||||
message= _ "Clear all orders"
|
||||
|
||||
[show_if]
|
||||
[variable]
|
||||
name=ai_controller_{ID}.revoke_orders.disabled
|
||||
not_equals=yes
|
||||
[/variable]
|
||||
[/show_if]
|
||||
|
||||
[command]
|
||||
[insert_tag]
|
||||
name=modify_side
|
||||
variable=ai_controller.side_$ally_side|_original_settings.ai_settings
|
||||
[/insert_tag]
|
||||
|
||||
{CLEAR_VARIABLE ai_controller.side_$ally_side|_current_settings}
|
||||
[/command]
|
||||
[/option]
|
||||
[/revoke_all_orders]
|
||||
|
||||
################
|
||||
|
||||
[exit]
|
||||
[option]
|
||||
message= _ "*Exit"
|
||||
|
||||
[command]
|
||||
{VARIABLE ai_controller_finished yes}
|
||||
|
||||
#ifndef MULTIPLAYER
|
||||
[allow_undo]
|
||||
[/allow_undo]
|
||||
#endif
|
||||
[/command]
|
||||
[/option]
|
||||
[/exit]
|
||||
[/literal]
|
||||
[/set_variables]
|
||||
|
||||
[set_variables]
|
||||
name=ai_controller_{ID}
|
||||
mode=merge
|
||||
|
||||
[literal]
|
||||
{VARIABLES}
|
||||
[/literal]
|
||||
[/set_variables]
|
||||
|
||||
[set_menu_item]
|
||||
id=ai_controller
|
||||
description= _ "Instruct ally"
|
||||
|
||||
[show_if]
|
||||
[have_unit]
|
||||
side=$ai_controller_{ID}.ally_sides
|
||||
x,y=$x1,$y1
|
||||
|
||||
[not]
|
||||
side=$ai_controller_{ID}.disabled_for_sides
|
||||
[/not]
|
||||
[/have_unit]
|
||||
|
||||
[variable]
|
||||
name=ai_controller_{ID}.enabled
|
||||
equals=yes
|
||||
[/variable]
|
||||
|
||||
[variable]
|
||||
name=ai_controller_{ID}.player_side
|
||||
contains=$side_number
|
||||
[/variable]
|
||||
[/show_if]
|
||||
|
||||
[command]
|
||||
[store_unit]
|
||||
[filter]
|
||||
x,y=$x1,$y1
|
||||
[/filter]
|
||||
|
||||
kill=no
|
||||
variable=ally_unit
|
||||
[/store_unit]
|
||||
|
||||
[store_unit]
|
||||
[filter]
|
||||
side=$ally_unit.side
|
||||
canrecruit=yes
|
||||
[/filter]
|
||||
|
||||
kill=no
|
||||
variable=ally_leader
|
||||
[/store_unit]
|
||||
|
||||
{VARIABLE ally_side $ally_leader.side}
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=ai_controller.side_$ally_side|_original_settings.side
|
||||
equals=$empty
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
[store_side]
|
||||
side=$ally_side
|
||||
variable=ai_controller.side_$ally_side|_original_settings
|
||||
[/store_side]
|
||||
|
||||
[set_variables]
|
||||
name=ai_controller.side_$ally_side|_original_settings.ai_settings
|
||||
|
||||
[value]
|
||||
side=$ally_side
|
||||
|
||||
[insert_tag]
|
||||
name=ai
|
||||
variable=ally_leader.ai
|
||||
[/insert_tag]
|
||||
[/value]
|
||||
[/set_variables]
|
||||
[/then]
|
||||
[/if]
|
||||
|
||||
{CLEAR_VARIABLE ai_controller_finished}
|
||||
|
||||
[while]
|
||||
[variable]
|
||||
name=ai_controller_finished
|
||||
not_equals=yes
|
||||
[/variable]
|
||||
|
||||
[do]
|
||||
[if]
|
||||
[variable]
|
||||
name=ai_controller.side_$ally_side|_current_settings.objective_set
|
||||
boolean_equals=no
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
{VARIABLE ai_controller.side_$ally_side|_current_settings.currently_doing_objective_description _"none set."}
|
||||
[/then]
|
||||
[/if]
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=ai_controller.side_$ally_side|_current_settings.behaviour_set
|
||||
boolean_equals=no
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
{VARIABLE ai_controller.side_$ally_side|_current_settings.currently_doing_behaviour_description _"none set."}
|
||||
[/then]
|
||||
[/if]
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=ai_controller.side_$ally_side|_current_settings.objective_set
|
||||
boolean_equals=no
|
||||
[/variable]
|
||||
|
||||
[variable]
|
||||
name=ai_controller.side_$ally_side|_current_settings.behaviour_set
|
||||
boolean_equals=no
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
[set_variables]
|
||||
name=ai_controller_{ID}.main_menu_message
|
||||
|
||||
[value]
|
||||
speaker=narrator
|
||||
caption= _ "Instruct ally"
|
||||
message= _ "$ally_leader.name (side $ally_side|) has not been given any instructions and is acting normally."+"
|
||||
<0,0,0>-"+"
|
||||
"+_"Objective: $ai_controller.side_$ally_side|_current_settings.currently_doing_objective_description
|
||||
Behaviour: $ai_controller.side_$ally_side|_current_settings.currently_doing_behaviour_description"+"
|
||||
<0,0,0>-"
|
||||
image=wesnoth-icon.png
|
||||
[/value]
|
||||
[/set_variables]
|
||||
[/then]
|
||||
|
||||
[else]
|
||||
[set_variables]
|
||||
name=ai_controller_{ID}.main_menu_message
|
||||
|
||||
[value]
|
||||
speaker=narrator
|
||||
caption= _ "Instruct ally"
|
||||
message= _ "$ally_leader.name (side $ally_side|) is carrying out the following instructions:"+"
|
||||
<0,0,0>-"+"
|
||||
"+_"Objective: $ai_controller.side_$ally_side|_current_settings.currently_doing_objective_description
|
||||
Behaviour: $ai_controller.side_$ally_side|_current_settings.currently_doing_behaviour_description"+"
|
||||
<0,0,0>-"
|
||||
image=wesnoth-icon.png
|
||||
[/value]
|
||||
[/set_variables]
|
||||
[/else]
|
||||
[/if]
|
||||
|
||||
[set_variables]
|
||||
name=ai_controller_{ID}.main_menu_message.option
|
||||
|
||||
[literal]
|
||||
message= _ "Set objective..."
|
||||
|
||||
[command]
|
||||
[message]
|
||||
speaker=narrator
|
||||
caption= _ "Instruct ally"
|
||||
message=$ai_controller_{ID}.main_menu_message.message
|
||||
image=wesnoth-icon.png
|
||||
|
||||
[insert_tag]
|
||||
name=option
|
||||
variable=ai_controller_{ID}.focus_on_enemy.option
|
||||
[/insert_tag]
|
||||
|
||||
[insert_tag]
|
||||
name=option
|
||||
variable=ai_controller_{ID}.protect.option
|
||||
[/insert_tag]
|
||||
|
||||
[insert_tag]
|
||||
name=option
|
||||
variable=ai_controller_{ID}.revoke_objective_orders.option
|
||||
[/insert_tag]
|
||||
|
||||
[insert_tag]
|
||||
name=option
|
||||
variable=ai_controller_{ID}.exit.option
|
||||
[/insert_tag]
|
||||
[/message]
|
||||
[/command]
|
||||
[/literal]
|
||||
|
||||
[literal]
|
||||
message= _ "Set behaviour..."
|
||||
|
||||
[command]
|
||||
[message]
|
||||
speaker=narrator
|
||||
caption= _ "Instruct ally"
|
||||
message=$ai_controller_{ID}.main_menu_message.message
|
||||
image=wesnoth-icon.png
|
||||
|
||||
[insert_tag]
|
||||
name=option
|
||||
variable=ai_controller_{ID}.aggression.option
|
||||
[/insert_tag]
|
||||
|
||||
[insert_tag]
|
||||
name=option
|
||||
variable=ai_controller_{ID}.caution.option
|
||||
[/insert_tag]
|
||||
|
||||
[insert_tag]
|
||||
name=option
|
||||
variable=ai_controller_{ID}.revoke_behaviour_orders.option
|
||||
[/insert_tag]
|
||||
|
||||
[insert_tag]
|
||||
name=option
|
||||
variable=ai_controller_{ID}.exit.option
|
||||
[/insert_tag]
|
||||
[/message]
|
||||
[/command]
|
||||
[/literal]
|
||||
|
||||
[insert_tag]
|
||||
name=literal
|
||||
variable=ai_controller_{ID}.revoke_all_orders.option
|
||||
[/insert_tag]
|
||||
|
||||
[insert_tag]
|
||||
name=literal
|
||||
variable=ai_controller_{ID}.exit.option
|
||||
[/insert_tag]
|
||||
[/set_variables]
|
||||
|
||||
[insert_tag]
|
||||
name=message
|
||||
variable=ai_controller_{ID}.main_menu_message
|
||||
[/insert_tag]
|
||||
|
||||
{CLEAR_VARIABLE ally_unit,ally_leader,ai_controller_{ID}.main_menu_message}
|
||||
[/do]
|
||||
[/while]
|
||||
[/command]
|
||||
[/set_menu_item]
|
||||
[/event]
|
||||
#enddef
|
||||
|
||||
#define DISABLE_AI_CONTROLLER ID
|
||||
{VARIABLE ai_controller_{ID}.enabled no}
|
||||
#enddef
|
||||
|
||||
#define DISABLE_AI_CONTROLLER_FOR_SIDE ID SIDE
|
||||
[if]
|
||||
[variable]
|
||||
name=ai_controller_{ID}.disabled_for_sides
|
||||
equals=0
|
||||
[/variable]
|
||||
|
||||
[not]
|
||||
[variable]
|
||||
name=ai_controller_{ID}.disabled_for_sides
|
||||
contains={SIDE}
|
||||
[/variable]
|
||||
[/not]
|
||||
|
||||
[then]
|
||||
{VARIABLE ai_controller_{ID}.disabled_for_sides {SIDE}}
|
||||
[/then]
|
||||
|
||||
[else]
|
||||
[if]
|
||||
[variable]
|
||||
name=ai_controller_{ID}.disabled_for_sides
|
||||
contains={SIDE}
|
||||
[/variable]
|
||||
|
||||
[else]
|
||||
{VARIABLE ai_controller_{ID}.disabled_for_sides $ai_controller_{ID}.disabled_for_sides|,{SIDE}}
|
||||
[/else]
|
||||
[/if]
|
||||
[/else]
|
||||
[/if]
|
||||
#enddef
|
||||
|
||||
#define ENABLE_AI_CONTROLLER_FOR_SIDE ID SIDE
|
||||
[if]
|
||||
[variable]
|
||||
name=ai_controller_{ID}.disabled_for_sides
|
||||
contains={SIDE}
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
[set_variables]
|
||||
name=disabled_for_sides_array
|
||||
|
||||
[split]
|
||||
list=ai_controller_{ID}.disabled_for_sides
|
||||
key=side
|
||||
separator=,
|
||||
[/split]
|
||||
[/set_variables]
|
||||
|
||||
{FOREACH disabled_for_sides_array disabled_for_side_i}
|
||||
[if]
|
||||
[variable]
|
||||
name=disabled_for_sides_array[$disabled_for_side_i].side
|
||||
equals={SIDE}
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
{CLEAR_VARIABLE disabled_for_sides_array[$disabled_for_side_i]}
|
||||
[/then]
|
||||
[/if]
|
||||
{NEXT disabled_for_side_i}
|
||||
|
||||
[set_variable]
|
||||
name=ai_controller_{ID}.disabled_for_sides
|
||||
|
||||
[join]
|
||||
variable=disabled_for_sides_array
|
||||
key=side
|
||||
separator=,
|
||||
[/join]
|
||||
[/set_variable]
|
||||
|
||||
{CLEAR_VARIABLE disabled_for_sides_array}
|
||||
[/then]
|
||||
|
||||
[else]
|
||||
{VARIABLE ai_controller_{ID}.ally_sides $ai_controller_{ID}.ally_sides|,{SIDE}}
|
||||
[/else]
|
||||
[/if]
|
||||
#enddef
|
Loading…
Add table
Reference in a new issue