Simplify how some variables receive their values,
and remove some unused and redundant variables.
This commit is contained in:
parent
c88846eefb
commit
8dc87d7d82
1 changed files with 29 additions and 87 deletions
|
@ -32,12 +32,10 @@ Note: You need to use the default map settings for the scenario to work right."
|
|||
[/variable]
|
||||
[then]
|
||||
{RANDOMIZE $location}
|
||||
{VARIABLE x $spawn_place[$random].x}
|
||||
{VARIABLE y $spawn_place[$random].y}
|
||||
[store_locations]
|
||||
variable=locs
|
||||
x=$x
|
||||
y=$y
|
||||
x=$spawn_place[$random].x
|
||||
y=$spawn_place[$random].y
|
||||
radius=1
|
||||
[/store_locations]
|
||||
{RANDOMIZE_INDEX $locs.length}
|
||||
|
@ -58,15 +56,12 @@ Note: You need to use the default map settings for the scenario to work right."
|
|||
[/filter]
|
||||
[/store_unit]
|
||||
{FOREACH spawns id}
|
||||
{VARIABLE less_max_moves $spawns[$id].max_moves}
|
||||
{VARIABLE_OP less_max_moves multiply 0.33}
|
||||
{VARIABLE_OP less_max_moves add 1}
|
||||
|
||||
# store the original max_moves so they can be restored later
|
||||
{VARIABLE spawns[$id].variables.original_max_moves $spawns[$id].max_moves}
|
||||
|
||||
# give the unit only a third of its normal max movement for now
|
||||
{VARIABLE spawns[$id].max_moves $less_max_moves}
|
||||
{VARIABLE_OP $spawns[$id].max_moves multiply 0.33}
|
||||
{VARIABLE_OP $spawns[$id].max_moves add 1}
|
||||
|
||||
{VARIABLE spawns[$id].side $timid_ai_side}
|
||||
{VARIABLE spawns[$id].generate_name yes}
|
||||
|
@ -116,18 +111,7 @@ Note: You need to use the default map settings for the scenario to work right."
|
|||
{FOREACH spawns id}
|
||||
{VARIABLE spawns[$id].x $spawn_x}
|
||||
{VARIABLE spawns[$id].y $spawn_y}
|
||||
{RANDOMIZE 3}
|
||||
{VARIABLE position "se"}
|
||||
[if]
|
||||
[variable]
|
||||
name=random
|
||||
numerical_equals=1
|
||||
[/variable]
|
||||
[then]
|
||||
{VARIABLE position "sw"}
|
||||
[/then]
|
||||
[/if]
|
||||
{VARIABLE spawns[$id].facing $position}
|
||||
{VARIABLE_OP spawns[$id].facing rand "sw,se,se"}
|
||||
{VARIABLE_OP msg value "$msg
|
||||
$spawns[$id].type"}
|
||||
[if]
|
||||
|
@ -188,12 +172,7 @@ Note: You need to use the default map settings for the scenario to work right."
|
|||
#enddef
|
||||
|
||||
#define SPAWN_UNIT SIDE TYPE ID TIER_NUMBER NUMBER
|
||||
{VARIABLE uside {SIDE}}
|
||||
{VARIABLE utype {TYPE}}
|
||||
{VARIABLE y 10}
|
||||
{VARIABLE number -{NUMBER}}
|
||||
{VARIABLE_OP number add 11}
|
||||
{VARIABLE_OP y add $number}
|
||||
{VARIABLE y "$(21-{NUMBER})"} # 10 + 11 - NUMBER
|
||||
{VARIABLE x 18}
|
||||
{VARIABLE this_tier {TIER_NUMBER}}
|
||||
[if]
|
||||
|
@ -238,10 +217,8 @@ Note: You need to use the default map settings for the scenario to work right."
|
|||
|
||||
#define ADJUST_UNIT_LEVEL SIDE TIER_NUMBER
|
||||
{VARIABLE next_tier {TIER_NUMBER}}
|
||||
{VARIABLE tier {TIER_NUMBER}}
|
||||
{VARIABLE side {SIDE}}
|
||||
{VARIABLE_OP next_tier add 1}
|
||||
{VARIABLE_OP next_role value "new_spawn$next_tier"}
|
||||
{VARIABLE next_role "new_spawn$next_tier"}
|
||||
[store_unit]
|
||||
kill=yes
|
||||
variable=new_spawn
|
||||
|
@ -265,7 +242,6 @@ Note: You need to use the default map settings for the scenario to work right."
|
|||
not_equals=none
|
||||
[/variable]
|
||||
[then]
|
||||
{VARIABLE yind $new_spawn[$unit_id].y}
|
||||
[if]
|
||||
[variable]
|
||||
name=advanceto
|
||||
|
@ -451,8 +427,7 @@ Note: You need to use the default map settings for the scenario to work right."
|
|||
greater_than=0
|
||||
[/variable]
|
||||
[then]
|
||||
{RANDOMIZE $fixed_group}
|
||||
{VARIABLE fixed_id $random}
|
||||
{VARIABLE_OP fixed_id rand "1..$fixed_group"}
|
||||
{VARIABLE size $fixed_spawns[$fixed_id].spawn_number}
|
||||
[while]
|
||||
[variable]
|
||||
|
@ -494,9 +469,7 @@ Note: You need to use the default map settings for the scenario to work right."
|
|||
{VARIABLE_OP id add 1}
|
||||
[/do]
|
||||
[/while]
|
||||
{VARIABLE fixed_x $fixed_spawns[$fixed_id].x}
|
||||
{VARIABLE fixed_y $fixed_spawns[$fixed_id].y}
|
||||
{PLACE_SPAWN_GROUP $fixed_x $fixed_y}
|
||||
{PLACE_SPAWN_GROUP $fixed_spawns[$fixed_id].x $fixed_spawns[$fixed_id].y}
|
||||
{VARIABLE fixed_spawns[$fixed_id].spawn_number 0}
|
||||
{VARIABLE_OP fixed_groups_left sub 1}
|
||||
[/then]
|
||||
|
@ -558,8 +531,7 @@ Note: You need to use the default map settings for the scenario to work right."
|
|||
{VARIABLE unit_increment $units}
|
||||
### END DEBUG
|
||||
{VARIABLE_OP units add {UNITS_AMOUNT}}
|
||||
{RANDOMIZE 4}
|
||||
{VARIABLE_OP random sub 2}
|
||||
{VARIABLE_OP random rand -1..2}
|
||||
{VARIABLE_OP units add $random}
|
||||
{RANDOMIZE 5}
|
||||
[if]
|
||||
|
@ -571,8 +543,7 @@ Note: You need to use the default map settings for the scenario to work right."
|
|||
{VARIABLE_OP units sub 1}
|
||||
[/then]
|
||||
[/if]
|
||||
{RANDOMIZE 3}
|
||||
{VARIABLE_OP random sub 2}
|
||||
{VARIABLE_OP random rand -1..1}
|
||||
{VARIABLE_OP turns add $random}
|
||||
[/then]
|
||||
[else]
|
||||
|
@ -593,11 +564,7 @@ Note: You need to use the default map settings for the scenario to work right."
|
|||
[/if]
|
||||
[/do]
|
||||
[/while]
|
||||
{CLEAR_VARIABLE num}
|
||||
{VARIABLE triggered_spawns {SPAWN_NUMBER}}
|
||||
{VARIABLE_OP triggered_spawns sub 1}
|
||||
{VARIABLE final_turns $timed_spawn[$triggered_spawns].turn}
|
||||
{CLEAR_VARIABLE triggered_spawns}
|
||||
{VARIABLE final_turns "$timed_spawn[$({SPAWN_NUMBER}-1)].turn"}
|
||||
{VARIABLE_OP final_turns add 40}
|
||||
{VARIABLE_OP final_turns divide 2}
|
||||
{VARIABLE fixed_groups_left $fixed_group}
|
||||
|
@ -606,26 +573,21 @@ Note: You need to use the default map settings for the scenario to work right."
|
|||
# reduce gold and units for spawns
|
||||
# after the final spawn
|
||||
{VARIABLE spawn_id 0}
|
||||
{VARIABLE num 0}
|
||||
[while]
|
||||
[variable]
|
||||
name=spawn_id
|
||||
less_than=$main_group
|
||||
[/variable]
|
||||
[do]
|
||||
{VARIABLE turn $timed_spawn[$spawn_id].turn}
|
||||
{VARIABLE end_spawn 0}
|
||||
[if]
|
||||
[variable]
|
||||
name=turn
|
||||
name=timed_spawn[$spawn_id].turn
|
||||
greater_than_equal_to=$final_turns
|
||||
[/variable]
|
||||
[then]
|
||||
{VARIABLE diff_div 3}
|
||||
{VARIABLE_OP diff_div add $end_spawn}
|
||||
{VARIABLE_OP timed_spawn[$spawn_id].gold divide $diff_div}
|
||||
{VARIABLE_OP diff_div add 1}
|
||||
{VARIABLE_OP timed_spawn[$spawn_id].units divide $diff_div}
|
||||
{VARIABLE_OP timed_spawn[$spawn_id].gold divide "$($end_spawn+3)"}
|
||||
{VARIABLE_OP timed_spawn[$spawn_id].units divide "$($end_spawn+4)"}
|
||||
[if]
|
||||
# two spawns added to the final
|
||||
[variable]
|
||||
|
@ -655,11 +617,10 @@ Note: You need to use the default map settings for the scenario to work right."
|
|||
greater_than=2
|
||||
[/variable]
|
||||
[then]
|
||||
{VARIABLE trigger_turn $timed_spawn[$trigger_index].turn}
|
||||
[if]
|
||||
[variable]
|
||||
name=turn_number
|
||||
numerical_equals=$trigger_turn
|
||||
numerical_equals=$timed_spawn[$trigger_index].turn
|
||||
[/variable]
|
||||
[then]
|
||||
# normal spawn
|
||||
|
@ -668,7 +629,6 @@ Note: You need to use the default map settings for the scenario to work right."
|
|||
{VARIABLE min_cost 100}
|
||||
{VARIABLE_OP trigger_index add 1}
|
||||
{VARIABLE spawn_now "yes"}
|
||||
{RANDOMIZE_INDEX 2}
|
||||
{VARIABLE previous_spawn "yes"}
|
||||
[/then]
|
||||
[/if]
|
||||
|
@ -682,9 +642,7 @@ Note: You need to use the default map settings for the scenario to work right."
|
|||
[then]
|
||||
### DEBUG
|
||||
{VARIABLE total_cost 0}
|
||||
{VARIABLE size $main_group}
|
||||
{RANDOMIZE $size}
|
||||
{VARIABLE group_id $random}
|
||||
{VARIABLE_OP group_id rand 1..$main_group}
|
||||
{VARIABLE size $main_spawns[$group_id].spawn_number}
|
||||
[while]
|
||||
[variable]
|
||||
|
@ -746,9 +704,7 @@ Note: You need to use the default map settings for the scenario to work right."
|
|||
[/if]
|
||||
[/do]
|
||||
[/while]
|
||||
{VARIABLE spawn_x $main_spawns[$group_id].x}
|
||||
{VARIABLE spawn_y $main_spawns[$group_id].y}
|
||||
{PLACE_SPAWN_GROUP $spawn_x $spawn_y}
|
||||
{PLACE_SPAWN_GROUP $main_spawns[$group_id].x $main_spawns[$group_id].y}
|
||||
{REMOVE_SPAWN_GROUP $group_id}
|
||||
[music]
|
||||
name=frantic.ogg
|
||||
|
@ -780,9 +736,8 @@ Note: You need to use the default map settings for the scenario to work right."
|
|||
append=yes
|
||||
[/music]
|
||||
{FINAL_SPAWN}
|
||||
{VARIABLE new_limit 12}
|
||||
{VARIABLE new_limit "-33"} # 12 - 45
|
||||
{VARIABLE_OP new_limit add $turn_number}
|
||||
{VARIABLE_OP new_limit sub 45}
|
||||
[modify_turns]
|
||||
add=$new_limit
|
||||
[/modify_turns]
|
||||
|
@ -957,7 +912,6 @@ Note: You need to use the default map settings for the scenario to work right."
|
|||
#enddef
|
||||
|
||||
#define ADJUST_WEATHER
|
||||
{VARIABLE weather $weather_event[$next_weather].weather}
|
||||
[if]
|
||||
[variable]
|
||||
name=weather_change
|
||||
|
@ -1037,10 +991,6 @@ Note: You need to use the default map settings for the scenario to work right."
|
|||
#enddef
|
||||
|
||||
#define INIT_WEATHER
|
||||
{VARIABLE turn 5}
|
||||
{RANDOMIZE 3}
|
||||
{VARIABLE_OP random sub 2}
|
||||
{VARIABLE_OP turn add $random}
|
||||
{VARIABLE weather[0].turns 22}
|
||||
{VARIABLE weather[0].name "Clear"}
|
||||
{VARIABLE weather[1].turns 10}
|
||||
|
@ -1053,17 +1003,20 @@ Note: You need to use the default map settings for the scenario to work right."
|
|||
{VARIABLE weather[4].name "Heavy Snowfall"}
|
||||
{VARIABLE next_weather 1}
|
||||
{VARIABLE weather_events 0}
|
||||
|
||||
# Enforce limits on turns spent in each weather pattern.
|
||||
{VARIABLE_OP turn rand 4..6}
|
||||
[while]
|
||||
[variable]
|
||||
name=turn
|
||||
less_than=55
|
||||
[/variable]
|
||||
[do]
|
||||
{RANDOMIZE 3}
|
||||
{VARIABLE_OP id rand 1..3}
|
||||
{VARIABLE check 3}
|
||||
[while]
|
||||
[variable]
|
||||
name=weather[$random].turns
|
||||
name=weather[$id].turns
|
||||
less_than=1
|
||||
[/variable]
|
||||
[variable]
|
||||
|
@ -1071,20 +1024,12 @@ Note: You need to use the default map settings for the scenario to work right."
|
|||
greater_than=0
|
||||
[/variable]
|
||||
[do]
|
||||
{VARIABLE_OP random add 1}
|
||||
[if]
|
||||
[variable]
|
||||
name=random
|
||||
greater_than=3
|
||||
[/variable]
|
||||
[then]
|
||||
{VARIABLE random 1}
|
||||
[/then]
|
||||
[/if]
|
||||
# Cycle to the next weather, excluding clear and heavy snow.
|
||||
{VARIABLE id "$($id % 3 + 1)"}
|
||||
# Prevent infinite recursion.
|
||||
{VARIABLE_OP check sub 1}
|
||||
[/do]
|
||||
[/while]
|
||||
{VARIABLE id $random}
|
||||
{WEATHER_EVENT_AT $turn $id}
|
||||
# check for second snow
|
||||
[if]
|
||||
|
@ -1094,14 +1039,13 @@ Note: You need to use the default map settings for the scenario to work right."
|
|||
[/variable]
|
||||
[then]
|
||||
{RANDOMIZE 2}
|
||||
{VARIABLE check $weather[4].turns}
|
||||
[if]
|
||||
[variable]
|
||||
name=random
|
||||
equals=1
|
||||
[/variable]
|
||||
[variable]
|
||||
name=check
|
||||
name=weather[4].turns
|
||||
greater_than=0
|
||||
[/variable]
|
||||
[then]
|
||||
|
@ -1116,7 +1060,6 @@ Note: You need to use the default map settings for the scenario to work right."
|
|||
[event]
|
||||
name=side turn
|
||||
first_time_only=no
|
||||
{VARIABLE turn_for_weather $weather_event[$next_weather].turn}
|
||||
[if]
|
||||
[variable]
|
||||
name=weather_change
|
||||
|
@ -1134,11 +1077,10 @@ Note: You need to use the default map settings for the scenario to work right."
|
|||
[event]
|
||||
name=new turn
|
||||
first_time_only=no
|
||||
{VARIABLE turn_weather $weather_event[$next_weather].turn}
|
||||
[if]
|
||||
[variable]
|
||||
name=turn_number
|
||||
greater_than_equal_to=$turn_weather
|
||||
greater_than_equal_to=$weather_event[$next_weather].turn
|
||||
[/variable]
|
||||
[then]
|
||||
{VARIABLE weather_change $weather_event[$next_weather].weather}
|
||||
|
|
Loading…
Add table
Reference in a new issue