Simplify the new_turn event that spawns the waves of creatures.

This commit is contained in:
J. Tyne 2013-01-31 06:22:27 +00:00
parent 7a6c382851
commit b4a9505e0b

View file

@ -608,110 +608,96 @@ Note: You need to use the default map settings for the scenario to work right."
[event]
name=new turn
first_time_only=no
{VARIABLE spawn_now "no"}
[if]
[filter_condition]
[variable]
name=turn_number
greater_than=2
[/variable]
[then]
[variable]
name=turn_number
numerical_equals=$timed_spawn[$trigger_index].turn
[/variable]
[/filter_condition]
# normal spawn
{VARIABLE gold $timed_spawn[$trigger_index].gold}
{VARIABLE max_units $timed_spawn[$trigger_index].units}
{VARIABLE min_cost 100}
{VARIABLE_OP trigger_index add 1}
{VARIABLE previous_spawn "yes"}
### DEBUG
{VARIABLE total_cost 0}
{VARIABLE_OP group_id rand 1..$main_group}
{VARIABLE size $main_spawns[$group_id].spawn_number}
[while]
[variable]
name=gold
greater_than=0
[/variable]
[variable]
name=max_units
greater_than=0
[/variable]
[do]
{RANDOMIZE $size}
[if]
[variable]
name=turn_number
numerical_equals=$timed_spawn[$trigger_index].turn
name=random
greater_than=0
[/variable]
[then]
# normal spawn
{VARIABLE gold $timed_spawn[$trigger_index].gold}
{VARIABLE max_units $timed_spawn[$trigger_index].units}
{VARIABLE min_cost 100}
{VARIABLE_OP trigger_index add 1}
{VARIABLE spawn_now "yes"}
{VARIABLE previous_spawn "yes"}
{VARIABLE type $main_spawns[$group_id].spawn_type[$random].type}
{SPAWN_UNIT {SIDE} $type $random 1 $max_units}
[/then]
[else]
# fallback for invalid/cleared spawn groups
{VARIABLE gold 0}
[/else]
[/if]
[/then]
[/if]
[if]
[/do]
[/while]
{ADJUST_UNIT_LEVEL {SIDE} 1}
{ADJUST_UNIT_LEVEL {SIDE} 2}
{ADJUST_UNIT_LEVEL {SIDE} 3}
# spend remainder
{VARIABLE extra_units 3}
[while]
[variable]
name=spawn_now
equals="yes"
name=gold
greater_than_equal_to=$min_cost
[/variable]
[then]
### DEBUG
{VARIABLE total_cost 0}
{VARIABLE_OP group_id rand 1..$main_group}
{VARIABLE size $main_spawns[$group_id].spawn_number}
[while]
[variable]
name=extra_units
greater_than=0
[/variable]
[do]
{RANDOMIZE $size}
[if]
[variable]
name=gold
name=random
greater_than=0
[/variable]
[variable]
name=max_units
greater_than=0
[/variable]
[do]
{RANDOMIZE $size}
[if]
[variable]
name=random
greater_than=0
[/variable]
[then]
{VARIABLE type $main_spawns[$group_id].spawn_type[$random].type}
{SPAWN_UNIT {SIDE} $type $random 1 $max_units}
[/then]
[else]
# fallback for invalid/cleared spawn groups
{VARIABLE gold 0}
[/else]
[/if]
[/do]
[/while]
{ADJUST_UNIT_LEVEL {SIDE} 1}
{ADJUST_UNIT_LEVEL {SIDE} 2}
{ADJUST_UNIT_LEVEL {SIDE} 3}
# spend remainder
{VARIABLE extra_units 3}
[while]
[variable]
name=gold
greater_than_equal_to=$min_cost
[/variable]
[variable]
name=extra_units
greater_than=0
[/variable]
[do]
{RANDOMIZE $size}
[if]
[variable]
name=random
greater_than=0
[/variable]
[then]
{VARIABLE type $main_spawns[$group_id].spawn_type[$random].type}
{SPAWN_UNIT {SIDE} $type $random 5 $max_units}
{VARIABLE_OP extra_units sub 1}
[/then]
[else]
# fallback for invalid/cleared spawn groups
{VARIABLE gold 0}
[/else]
[/if]
[/do]
[/while]
{PLACE_SPAWN_GROUP $main_spawns[$group_id].x $main_spawns[$group_id].y}
{REMOVE_SPAWN_GROUP $group_id}
[music]
name=frantic.ogg
ms_before=300
play_once=yes
immediate=yes
[/music]
[/then]
[/if]
[then]
{VARIABLE type $main_spawns[$group_id].spawn_type[$random].type}
{SPAWN_UNIT {SIDE} $type $random 5 $max_units}
{VARIABLE_OP extra_units sub 1}
[/then]
[else]
# fallback for invalid/cleared spawn groups
{VARIABLE gold 0}
[/else]
[/if]
[/do]
[/while]
{PLACE_SPAWN_GROUP $main_spawns[$group_id].x $main_spawns[$group_id].y}
{REMOVE_SPAWN_GROUP $group_id}
[music]
name=frantic.ogg
ms_before=300
play_once=yes
immediate=yes
[/music]
[/event]
# the event extending the turn limit