#textdomain wesnoth-multiplayer [multiplayer] id=multiplayer_2p_Dark_Forecast name= _ "2p — Dark Forecast (Survival)" description= _ "Dark Forecast is a survival scenario for solitaire or two-player team-based play against randomly-spawned AI units. Victory is achieved by surviving and defeating all enemy waves. During the course of play, the terrain will change based on random weather effects. Note: You need to use the default map settings for the scenario to work right." turns="45" experience_modifier="100" map_data="{multiplayer/maps/Dark_Forecast.map}" victory_when_enemies_defeated=no #define RANDOMIZE NUMBER {VARIABLE_OP random rand 1..{NUMBER}} #enddef #define RANDOMIZE_INDEX NUMBER {VARIABLE_OP random rand 1..{NUMBER}} {VARIABLE_OP random sub 1} #enddef #define PLACE_SPAWN_GROUP X Y {VARIABLE spawn_x {X}} {VARIABLE spawn_y {Y}} [if] [variable] name=spawn_x equals="random" [/variable] [then] {RANDOMIZE $location} [store_locations] variable=locs [and] x=$spawn_place[$random].x y=$spawn_place[$random].y radius=1 [/and] # Avoid border hexes; we cannot spawn there. [and] x=1-16 y=8-22 [/and] [/store_locations] {RANDOMIZE_INDEX $locs.length} {VARIABLE spawn_x $locs[$random].x} {VARIABLE spawn_y $locs[$random].y} {CLEAR_VARIABLE locs} [/then] [/if] [store_unit] variable=spawns kill=yes [filter] canrecruit=no side=1,2 [not] x=1-15 y=8-22 [/not] [/filter] [/store_unit] {FOREACH spawns id} # 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_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} {VARIABLE spawns[$id].status.slowed yes} {CLEAR_VARIABLE spawns[$id].name} [unstore_unit] variable=spawns[$id] [/unstore_unit] [object] silent=yes duration=forever [filter] x,y=$spawns[$id].x,$spawns[$id].y [/filter] [effect] apply_to=movement_costs replace=true [movement_costs] flat=1 sand=2 forest=2 impassable=3 unwalkable=3 deep_water=3 [/movement_costs] [/effect] [/object] {NEXT id} {CLEAR_VARIABLE spawns} [store_unit] variable=spawns kill=yes [filter] canrecruit=no side=1,2 [not] x=1-15 y=8-22 [/not] [/filter] [/store_unit] {VARIABLE msg "Spawning: "} {FOREACH spawns id} {VARIABLE spawns[$id].x $spawn_x} {VARIABLE spawns[$id].y $spawn_y} {VARIABLE_OP spawns[$id].facing rand "sw,se,se"} {VARIABLE msg "$msg $spawns[$id].type"} [if] [variable] name=unit_name equals="none" [/variable] [else] {VARIABLE spawns[$id].name $unit_name} [/else] [/if] [unstore_unit] variable=spawns[$id] find_vacant=yes animate=yes [/unstore_unit] {NEXT id} {CLEAR_VARIABLE spawns} ### DEBUG #{VARIABLE msg "$msg # #total cost: $total_cost"} #[message] # speaker=narrator # message=$msg #[/message] #enddef # copies the units over from FROM_SIDE to TO_SIDE # and removes all temporary limitations of movement_type and max_moves #define ADJUST_AGGRESSION FROM_SIDE TO_SIDE [if] [have_unit] side={FROM_SIDE} [/have_unit] [then] [store_unit] variable=ai_unit kill=yes [filter] side={FROM_SIDE} [/filter] [/store_unit] {FOREACH ai_unit id} {VARIABLE ai_unit[$id].side {TO_SIDE}} {CLEAR_VARIABLE ai_unit[$id].movement_costs} {VARIABLE ai_unit[$id].max_moves $ai_unit[$id].variables.original_max_moves} [unstore_unit] variable=ai_unit[$id] find_vacant=no [/unstore_unit] {NEXT id} {CLEAR_VARIABLE ai_unit} [/then] [/if] #enddef #define SPAWN_UNIT SIDE TYPE ID TIER_NUMBER NUMBER {VARIABLE y "$(21-{NUMBER})"} # 10 + 11 - NUMBER {VARIABLE x 18} {VARIABLE this_tier {TIER_NUMBER}} [if] [variable] name=this_tier greater_than=1 [/variable] [then] {VARIABLE x 19} [/then] [/if] [unit] type={TYPE} side={SIDE} x=$x y=$y role=new_unit{TIER_NUMBER} random_traits=no name="none" to_variable=new_unit [/unit] {VARIABLE_OP gold sub $new_unit.cost} ### DEBUG {VARIABLE_OP total_cost add $new_unit.cost} [if] [variable] name=min_cost greater_than=$new_unit.cost [/variable] [then] {VARIABLE min_cost $new_unit.cost} [/then] [/if] {VARIABLE_OP max_units sub 1} {VARIABLE new_unit.variables.spawn_id {ID}} {VARIABLE new_unit.role new_spawn{TIER_NUMBER}} [unstore_unit] variable=new_unit [/unstore_unit] {CLEAR_VARIABLE new_unit} #enddef #define ADJUST_UNIT_LEVEL SIDE TIER_NUMBER {VARIABLE next_tier {TIER_NUMBER}} {VARIABLE_OP next_tier add 1} {VARIABLE next_role "new_spawn$next_tier"} [store_unit] kill=yes variable=new_spawn [filter] side={SIDE} role=new_spawn{TIER_NUMBER} [/filter] [/store_unit] {FOREACH new_spawn unit_id} {VARIABLE spawn_id $new_spawn[$unit_id].variables.spawn_id} {VARIABLE previous_cost $new_spawn.cost} {VARIABLE upgrade_var main_spawns[$group_id].spawn_type[$spawn_id].up{TIER_NUMBER}} {VARIABLE_OP advanceto to_variable $upgrade_var} [if] [variable] name=advanceto not_equals=null [/variable] [variable] name=advanceto not_equals=none [/variable] [then] [if] [variable] name=advanceto equals=more [/variable] [then] {VARIABLE upgrade_cost $new_spawn[$unit_id].cost} # add 2 gold to cost {VARIABLE_OP upgrade_cost add 2} {VARIABLE advanceto $new_spawn[$unit_id].type} [if] [variable] name=gold greater_than_equal_to=$upgrade_cost [/variable] [then] {VARIABLE_OP gold sub $upgrade_cost} ### DEBUG {VARIABLE_OP total_cost add $upgrade_cost} {SPAWN_UNIT {SIDE} $advanceto $spawn_id $next_role $max_units} {VARIABLE new_spawn[$unit_id].role $next_role} [/then] [/if] [/then] [else] [unit] side={SIDE} type=$advanceto random_traits=no name="none" x=20 y=22 to_variable=advancement [/unit] {VARIABLE upgrade_cost $advancement.cost} {VARIABLE_OP upgrade_cost sub $previous_cost} # 25% surcharge {VARIABLE_OP upgrade_cost multiply 1.25} {CLEAR_VARIABLE advancement} [if] [variable] name=gold greater_than_equal_to=$upgrade_cost [/variable] [then] {VARIABLE_OP gold sub $upgrade_cost} ### DEBUG {VARIABLE_OP total_cost add $upgrade_cost} {VARIABLE new_spawn[$unit_id].role $next_role} {VARIABLE somehack_type $advanceto} {VARIABLE use_somehack yes} [/then] [/if] [/else] [/if] [/then] [/if] [if] [variable] name=use_somehack boolean_equals=yes [/variable] [then] [unit] type=$somehack_type side={SIDE} x=$new_spawn[$unit_id].x y=$new_spawn[$unit_id].y role=new_unit{TIER_NUMBER} random_traits=no name="none" [/unit] {VARIABLE use_somehack no} [/then] [else] [unstore_unit] variable=new_spawn[$unit_id] find_vacant=yes [/unstore_unit] [/else] [/if] {NEXT unit_id} {CLEAR_VARIABLE new_spawn} #enddef #define CLEAR_SPAWN_GROUP NUMBER {CLEAR_VARIABLE main_spawns[{NUMBER}]} {VARIABLE_OP main_group sub 1} #enddef #define VICTORY_CHECK [event] name=die [filter] side=1,2 [/filter] [filter_condition] [not] [have_unit] side=1,2 x=1-15 y=8-22 [/have_unit] [/not] [/filter_condition] [music] name=victory.ogg play_once=yes immediate=yes [/music] [message] speaker=narrator message= _"The screams and pleas for mercy are finally silenced, as you remove your blood soaked blade from the last of the rebels. There will be no more resistance from the local scum. Your reign has finally earned stability." image=wesnoth-icon.png [/message] [endlevel] result=victory [/endlevel] [/event] #enddef #define FINAL_SPAWN [if] [variable] name=fixed_groups_left greater_than=0 [/variable] [then] {VARIABLE_OP fixed_id rand "1..$fixed_group"} {VARIABLE size $fixed_spawns[$fixed_id].spawn_number} [while] [variable] name=size less_than=1 [/variable] [do] {VARIABLE_OP fixed_id add 1} [if] [variable] name=fixed_id greater_than=$fixed_group [/variable] [then] {VARIABLE fixed_id 1} [/then] [/if] {VARIABLE size $fixed_spawns[$fixed_id].spawn_number} [/do] [/while] {VARIABLE id 1} {VARIABLE y 9} [while] [variable] name=id less_than_equal_to=$size [/variable] [do] {VARIABLE type $fixed_spawns[$fixed_id].spawn_type[$id].type} [unit] type=$type side=2 x=18 y=$y random_traits=no name="none" [/unit] {VARIABLE_OP y add 1} {VARIABLE_OP id add 1} [/do] [/while] {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] [/if] #enddef #define REGULAR_RANDOM_SPAWNS SIDE INTERVAL_NUMBER SPAWN_NUMBER BASE_GOLD_AMOUNT GOLD_INCREMENT UNITS_AMOUNT GOLD_PER_UNIT_AMOUNT # Calculate how many timed_spawn[] entries to define. [if] [variable] name=main_group less_then={SPAWN_NUMBER} [/variable] [then] {VARIABLE spawn_limit $main_group} [/then] [else] {VARIABLE spawn_limit {SPAWN_NUMBER}} [/else] [/if] {VARIABLE spawn_id 0} [while] [variable] name=spawn_id less_than=$spawn_limit [/variable] [do] {VARIABLE turns $spawn_id} {VARIABLE_OP turns multiply {INTERVAL_NUMBER}} {VARIABLE_OP turns add 3} {VARIABLE_OP spawn_id add 1} # Loop control variable increment. {VARIABLE gold {BASE_GOLD_AMOUNT}} {VARIABLE gold_turns $turns} {VARIABLE_OP gold_turns sub 3} {VARIABLE_OP gold_turns multiply {GOLD_INCREMENT}} {VARIABLE_OP gold add $gold_turns} # regular spawns [if] [variable] name=spawn_id greater_than=1 [/variable] [then] {VARIABLE units $gold_turns} # add a random amount of the basic gold {RANDOMIZE {BASE_GOLD_AMOUNT}} {VARIABLE gold1 $random} {RANDOMIZE {BASE_GOLD_AMOUNT}} [if] [variable] name=gold1 less_than=random [/variable] [then] {VARIABLE random $gold1} [/then] [/if] {CLEAR_VARIABLE gold1} {VARIABLE_OP units add $random} {VARIABLE unit_increment {GOLD_PER_UNIT_AMOUNT}} {VARIABLE unit_turns $turns} {VARIABLE_OP unit_turns divide 1.5} {VARIABLE_OP unit_increment add $unit_turns} {VARIABLE_OP units divide $unit_increment} ### DEBUG {VARIABLE unit_increment $units} ### END DEBUG {VARIABLE_OP units add {UNITS_AMOUNT}} {VARIABLE_OP random rand -1..2} {VARIABLE_OP units add $random} {RANDOMIZE 5} [if] [variable] name=random numerical_equals=1 [/variable] [then] {VARIABLE_OP units sub 1} [/then] [/if] {VARIABLE_OP random rand -1..1} {VARIABLE_OP turns add $random} [/then] [else] {VARIABLE units {UNITS_AMOUNT}} {VARIABLE_OP units add 1} ### DEBUG {VARIABLE unit_increment 0} ### END DEBUG [/else] [/if] {VARIABLE timed_spawn[$spawn_id].units $units} {VARIABLE timed_spawn[$spawn_id].turn $turns} {VARIABLE timed_spawn[$spawn_id].gold $gold} ### DEBUG {VARIABLE timed_spawn[$spawn_id].units_added $unit_increment} ### END DEBUG [/do] [/while] {CLEAR_VARIABLE spawn_limit} {VARIABLE final_turns "$timed_spawn[{SPAWN_NUMBER}].turn"} {VARIABLE_OP final_turns add 40} {VARIABLE_OP final_turns divide 2} {VARIABLE_OP final_turns round 0} {VARIABLE fixed_groups_left $fixed_group} {VARIABLE trigger_index 1} # reduce gold and units for spawns # after the final spawn {VARIABLE spawn_id 0} {VARIABLE end_spawn 0} [while] [variable] name=spawn_id less_than=$timed_spawn.length [/variable] [do] [if] [variable] name=timed_spawn[$spawn_id].turn greater_than_equal_to=$final_turns [/variable] [then] {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] name=end_spawn greater_than=1 [/variable] [then] {VARIABLE timed_spawn[$spawn_id].turn -1} [/then] [else] {VARIABLE_OP end_spawn add 1} [/else] [/if] [/then] [/if] {VARIABLE_OP spawn_id add 1} [/do] [/while] [event] name=new turn first_time_only=no [filter_condition] [variable] name=turn_number greater_than=2 [/variable] [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} ### 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=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} {CLEAR_SPAWN_GROUP $group_id} [music] name=frantic.ogg ms_before=300 play_once=yes immediate=yes [/music] [/event] # the event extending the turn limit # (This is so the player does not know exactly when the final spawn will occur?) [event] name=turn_44 id=Dark_Forecast_Turn_Limit_Extension_Starter [event] name=new_turn id=Dark_Forecast_Turn_Limit_Extension first_time_only=no # Add a turn. [modify_turns] add=1 [/modify_turns] [/event] [/event] # the event firing final spawns [event] name=turn_$final_turns [music] name=battle.ogg ms_before=200 immediate=yes append=yes [/music] {FINAL_SPAWN} [modify_turns] value="$($turn_number + 12)" [/modify_turns] [message] side=3,4 canrecruit=yes message= _ "The last and most powerful of these creatures are almost upon us. I feel that if we can finish them off in time, we shall be victorious." [/message] # Define the victory condition. {VICTORY_CHECK} # Stop the turn limit extension. [event] id=Dark_Forecast_Turn_Limit_Extension_Starter remove=yes [/event] [event] id=Dark_Forecast_Turn_Limit_Extension remove=yes [/event] # More final spawns in later turns: {VARIABLE_OP next_final_spawn rand 2..3} {VARIABLE_OP next_final_spawn add $turn_number} [event] name=turn_$next_final_spawn first_time_only=no {FINAL_SPAWN} {RANDOMIZE 2} {VARIABLE_OP next_final_spawn add $random} [/event] [/event] #enddef # X_VALUE is either an X coordinate (for fixed spawn position) # or "random" for a random location # chosen from the spawn_place array # set in DEFINE_SPAWN_LOCATION # (in the latter case Y_VALUE is ignored) #define DEFINE_MAIN_GROUP X_VALUE Y_VALUE {VARIABLE spawn_id 0} {VARIABLE_OP main_group add 1} {VARIABLE main_spawns[$main_group].x {X_VALUE}} {VARIABLE main_spawns[$main_group].y {Y_VALUE}} #enddef #define ADD_MAIN_SPAWN TYPE UP1_VALUE UP2_VALUE UP3_VALUE {VARIABLE_OP spawn_id add 1} {VARIABLE main_spawns[$main_group].spawn_type[$spawn_id].type {TYPE}} {VARIABLE main_spawns[$main_group].spawn_type[$spawn_id].up1 {UP1_VALUE}} {VARIABLE main_spawns[$main_group].spawn_type[$spawn_id].up2 {UP2_VALUE}} {VARIABLE main_spawns[$main_group].spawn_type[$spawn_id].up3 {UP3_VALUE}} {VARIABLE main_spawns[$main_group].spawn_number $spawn_id} #enddef #define DEFINE_SPAWN_LOCATION X_SPAN Y_SPAN {VARIABLE_OP location add 1} {VARIABLE spawn_place[$location].x {X_SPAN}} {VARIABLE spawn_place[$location].y {Y_SPAN}} #enddef #define DEFINE_FIXED_GROUP X Y {VARIABLE spawn_id 0} {VARIABLE_OP fixed_group add 1} {VARIABLE fixed_spawns[$fixed_group].x {X}} {VARIABLE fixed_spawns[$fixed_group].y {Y}} #enddef #define ADD_FIXED_SPAWN TYPE {VARIABLE_OP spawn_id add 1} {VARIABLE fixed_spawns[$fixed_group].spawn_type[$spawn_id].type {TYPE}} {VARIABLE fixed_spawns[$fixed_group].spawn_number $spawn_id} #enddef #define SET_TIMID_AI_AND_BOLD_AI TIMID_SIDE BOLD_SIDE {VARIABLE timid_ai_side {TIMID_SIDE}} {VARIABLE bold_ai_side {BOLD_SIDE}} [event] name=side turn first_time_only=no [if] [variable] name=side_number greater_than=$timid_ai_side [/variable] [then] {ADJUST_AGGRESSION $timid_ai_side $bold_ai_side} [/then] [/if] [/event] #enddef #define WEATHER_EVENT_AT TURN WEATHER_VALUE {VARIABLE_OP weather_events add 1} {VARIABLE weather_event[$weather_events].turn {TURN}} {VARIABLE weather_event[$weather_events].weather {WEATHER_VALUE}} {RANDOMIZE 2} {VARIABLE_OP turn add $random} {VARIABLE_OP weather[{WEATHER_VALUE}].turns sub $random} {VARIABLE max_turns 2} {VARIABLE w_id {WEATHER_VALUE}} [if] [variable] name=w_id numerical_equals=0 [/variable] [then] {VARIABLE max_turns 1} [/then] [/if] [while] [variable] name=max_turns greater_than=0 [/variable] [variable] name=weather[{WEATHER_VALUE}].turns greater_than=1 [/variable] [do] {RANDOMIZE 2} [if] [variable] name=random less_than=2 [/variable] [then] {VARIABLE_OP turn add $random} {VARIABLE_OP max_turns sub $random} {VARIABLE_OP weather[{WEATHER_VALUE}].turns sub $random} [/then] [else] # stop incrementing {VARIABLE max_turns 0} [/else] [/if] [/do] [/while] {CLEAR_VARIABLE w_id} #enddef #define WEATHER_MAP NAME [terrain_mask] mask={NAME} x=1 y=1 [/terrain_mask] #enddef #define WEATHER_ALERT TEXT RED GREEN BLUE [print] text= {TEXT} duration=120 size=26 red={RED} green={GREEN} blue={BLUE} [/print] #enddef #define ADJUST_WEATHER VAR [switch] variable={VAR} [case] value=4 # second snow {WEATHER_MAP "{multiplayer/maps/Dark_Forecast_secondsnow.mask}"} [sound] name=bat-flapping.wav [/sound] {WEATHER_ALERT _"Heavy Snowfall" 224 255 251} [/case] [case] value=3 # first snow {WEATHER_MAP "{multiplayer/maps/Dark_Forecast_firstsnow.mask}"} [sound] name=wail.wav [/sound] {WEATHER_ALERT _"Snowfall" 229 243 241} [/case] [case] value=2 # heavy rains {WEATHER_MAP "{multiplayer/maps/Dark_Forecast_rain.mask}"} [sound] name=magic-faeriefire-miss.ogg [/sound] [delay] time=250 [/delay] [sound] name=ambient/ship.ogg [/sound] {WEATHER_ALERT _"Heavy Rains" 174 220 255} [/case] [case] value=1 # drought {WEATHER_MAP "{multiplayer/maps/Dark_Forecast_drought.mask}"} [sound] name=gryphon-shriek-1.ogg [/sound] {WEATHER_ALERT _"Drought" 251 231 171} [/case] [else] # clear weather {WEATHER_MAP "{multiplayer/maps/Dark_Forecast_basic.mask}"} [sound] name=magic-holy-miss-2.ogg [/sound] {WEATHER_ALERT _"Clear Weather" 221 253 171} [/else] [/switch] #enddef #define INIT_WEATHER {VARIABLE weather[0].turns 22} {VARIABLE weather[0].name "Clear"} {VARIABLE weather[1].turns 10} {VARIABLE weather[1].name "Drought"} {VARIABLE weather[2].turns 12} {VARIABLE weather[2].name "Heavy Rain"} {VARIABLE weather[3].turns 9} {VARIABLE weather[3].name "Snowfall"} {VARIABLE weather[4].turns 6} {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] {VARIABLE_OP id rand 1..3} {VARIABLE check 3} [while] [variable] name=weather[$id].turns less_than=1 [/variable] [variable] name=check greater_than=0 [/variable] [do] # 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] {WEATHER_EVENT_AT $turn $id} # check for second snow [if] [variable] name=id numerical_equals=3 [/variable] [variable] name=weather[4].turns greater_than=0 [/variable] [then] # Second snow happens half the time. {RANDOMIZE 2} [if] [variable] name=random equals=1 [/variable] [then] {WEATHER_EVENT_AT $turn 4} [/then] [/if] [/then] [/if] # Go back to clear weather. {WEATHER_EVENT_AT $turn 0} [/do] [/while] [event] name=side 3 turn first_time_only=no [filter_condition] [variable] name=turn_number greater_than_equal_to=$weather_event[$next_weather].turn [/variable] [/filter_condition] {ADJUST_WEATHER weather_event[$next_weather].weather} {VARIABLE_OP next_weather add 1} [/event] #enddef {DEFAULT_SCHEDULE_DAWN} [side] side=1 team_name="revolt" user_team_name= _ "teamname^Revolt" allow_player=no disallow_observers=yes no_leader=yes controller="ai" village_gold=1 [unit] type=Ancient Lich canrecruit=yes x=8 y=6 ai_special=guardian [modifications] [object] [effect] apply_to=movement_costs replace=true [movement_costs] frozen={UNREACHABLE} [/movement_costs] [/effect] [/object] [/modifications] [/unit] [/side] [side] side=2 color=red team_name="revolt" user_team_name= _ "teamname^Revolt" allow_player=no disallow_observers=yes no_leader=yes controller="ai" village_gold=1 [ai] aggression=-4.0 caution=0.99 grouping=defensive village_value=12 attack_depth=1 [/ai] [/side] [side] side=3 canrecruit=yes team_name="human" user_team_name= _ "teamname^Human" controller="human" save_id="Player1" village_gold=1 gold=75 income=0 gold_lock="true" income_lock="true" team_lock="true" fog="yes" share_view="yes" [/side] [side] side=4 canrecruit=yes team_name="human" user_team_name= _ "teamname^Human" controller="human" save_id="Player2" village_gold=1 gold=75 income=0 gold_lock="true" income_lock="true" team_lock="true" fog="yes" share_view="yes" [/side] [event] name=prestart {SET_TIMID_AI_AND_BOLD_AI 2 1} {VARIABLE location 0} {VARIABLE turn_limit 40} {DEFINE_SPAWN_LOCATION "3-14" "22"} #south {DEFINE_SPAWN_LOCATION "1" "11-20"} #west {DEFINE_SPAWN_LOCATION "2-13" "8"} #north {DEFINE_SPAWN_LOCATION "1" "9-22"} #west {VARIABLE main_group 0} # this is used as spacer for the final spawns {VARIABLE next_final_spawn 99} {DEFINE_MAIN_GROUP random 1} {ADD_MAIN_SPAWN "Heavy Infantryman" "Shock Trooper" "Iron Mauler" "none"} {ADD_MAIN_SPAWN "Elvish Fighter" "Elvish Hero" "more" "Elvish Champion"} {ADD_MAIN_SPAWN "Goblin Spearman" "more" "more" "more"} {ADD_MAIN_SPAWN "Goblin Spearman" "Goblin Rouser" "none" "none"} {ADD_MAIN_SPAWN "Elvish Fighter" "Elvish Captain" "Elvish Marshal" "none"} {DEFINE_MAIN_GROUP random 2} {ADD_MAIN_SPAWN "Mage" "Red Mage" "Silver Mage" "none"} {ADD_MAIN_SPAWN "Footpad" "Outlaw" "more" "none"} {ADD_MAIN_SPAWN "Drake Fighter" "Drake Warrior" "Drake Blademaster" "none"} {ADD_MAIN_SPAWN "Walking Corpse" "more" "more" "more"} {DEFINE_MAIN_GROUP random 3} {ADD_MAIN_SPAWN "Merman Hunter" "Merman Spearman" "Merman Entangler" "none"} {ADD_MAIN_SPAWN "Naga Fighter" "Naga Warrior" "Naga Myrmidon" "none"} {ADD_MAIN_SPAWN "Spearman" "Pikeman" "none" "Halberdier"} {DEFINE_MAIN_GROUP random 4} {ADD_MAIN_SPAWN "Elvish Shaman" "Elvish Druid" "Elvish Shyde" "Elvish Sylph"} {ADD_MAIN_SPAWN "Drake Burner" "Fire Drake" "Inferno Drake" "Armageddon Drake"} {ADD_MAIN_SPAWN "Skeleton" "Revenant" "more" "Draug"} {DEFINE_MAIN_GROUP random 5} {ADD_MAIN_SPAWN "Giant Mudcrawler" "Sea Serpent" "none" "none"} {ADD_MAIN_SPAWN "Mudcrawler" "more" "Giant Mudcrawler" "more"} {DEFINE_MAIN_GROUP random 6} {ADD_MAIN_SPAWN "Ghoul" "Necrophage" "more" "none"} {ADD_MAIN_SPAWN "Elvish Archer" "Elvish Marksman" "none" "Elvish Sharpshooter"} {ADD_MAIN_SPAWN "Elvish Archer" "Elvish Ranger" "Elvish Avenger" "none"} {ADD_MAIN_SPAWN "Drake Clasher" "Drake Thrasher" "more" "Drake Enforcer"} {DEFINE_MAIN_GROUP random 7} {ADD_MAIN_SPAWN "Skeleton Archer" "Bone Shooter" "more" "Banebow"} {ADD_MAIN_SPAWN "Fencer" "Duelist" "none" "Master at Arms"} {ADD_MAIN_SPAWN "Drake Glider" "Sky Drake" "Hurricane Drake" "none"} {DEFINE_MAIN_GROUP random 8} {ADD_MAIN_SPAWN "Merman Fighter" "Merman Warrior" "more" "Merman Triton"} {ADD_MAIN_SPAWN "Dark Adept" "Dark Sorcerer" "Necromancer" "none"} {ADD_MAIN_SPAWN "Elvish Scout" "Elvish Rider" "more" "none"} {DEFINE_MAIN_GROUP random 9} {ADD_MAIN_SPAWN "Wose" "Elder Wose" "Ancient Wose" "none"} {ADD_MAIN_SPAWN "Orcish Archer" "Orcish Crossbowman" "Orcish Slurbow" "none"} {ADD_MAIN_SPAWN "Saurian Skirmisher" "more" "Saurian Ambusher" "more"} {DEFINE_MAIN_GROUP random 10} {ADD_MAIN_SPAWN "Orcish Grunt" "Orcish Warrior" "more" "none"} {ADD_MAIN_SPAWN "Vampire Bat" "Blood Bat" "more" "none"} {ADD_MAIN_SPAWN "Dwarvish Thunderer" "Dwarvish Thunderguard" "none" "none"} {ADD_MAIN_SPAWN "Peasant" "more" "more" "more"} {ADD_MAIN_SPAWN "Woodsman" "more" "Sergeant" "Orcish Ruler"} {DEFINE_MAIN_GROUP random 11} {ADD_MAIN_SPAWN "Dwarvish Guardsman" "Dwarvish Stalwart" "none" "none"} {ADD_MAIN_SPAWN "Bowman" "Longbowman" "more" "Master Bowman"} {ADD_MAIN_SPAWN "Troll Whelp" "Troll" "Troll Warrior" "none"} {DEFINE_MAIN_GROUP random 12} {ADD_MAIN_SPAWN "Orcish Assassin" "Orcish Slayer" "more" "none"} {ADD_MAIN_SPAWN "Cavalryman" "Dragoon" "more" "Cavalier"} {ADD_MAIN_SPAWN "Saurian Augur" "Saurian Soothsayer" "none" "none"} {DEFINE_MAIN_GROUP random 13} {ADD_MAIN_SPAWN "Wolf Rider" "Goblin Pillager" "more" "none"} {ADD_MAIN_SPAWN "Ghost" "Shadow" "more" "more"} {ADD_MAIN_SPAWN "Sergeant" "Lieutenant" "General" "Grand Marshal"} {DEFINE_MAIN_GROUP random 14} {ADD_MAIN_SPAWN "Gryphon Rider" "none" "more" "none"} {ADD_MAIN_SPAWN "Thief" "Rogue" "more" "Assassin"} {DEFINE_MAIN_GROUP random 15} {ADD_MAIN_SPAWN "Dwarvish Fighter" "Dwarvish Steelclad" "more" "Dwarvish Lord"} {ADD_MAIN_SPAWN "Poacher" "Trapper" "more" "none"} {ADD_MAIN_SPAWN "Cuttle Fish" "more" "more" "none"} {DEFINE_MAIN_GROUP random 16} {ADD_MAIN_SPAWN "Walking Corpse" "more" "more" "more"} {ADD_MAIN_SPAWN "Mage" "White Mage" "Mage of Light" "none"} {ADD_MAIN_SPAWN "Thug" "Bandit" "more" "none"} {VARIABLE fixed_group 0} {DEFINE_FIXED_GROUP 1 22} {ADD_FIXED_SPAWN "Fire Dragon"} {ADD_FIXED_SPAWN "Gryphon Master"} {ADD_FIXED_SPAWN "Hurricane Drake"} {DEFINE_FIXED_GROUP 5 8} {ADD_FIXED_SPAWN "Yeti"} {ADD_FIXED_SPAWN "Elvish Druid"} {ADD_FIXED_SPAWN "Elvish Druid"} {DEFINE_FIXED_GROUP 1 14} {ADD_FIXED_SPAWN "Lich"} {ADD_FIXED_SPAWN "Walking Corpse"} {ADD_FIXED_SPAWN "Walking Corpse"} {ADD_FIXED_SPAWN "Walking Corpse"} {ADD_FIXED_SPAWN "Ghoul"} {ADD_FIXED_SPAWN "Soulless"} {ADD_FIXED_SPAWN "Walking Corpse"} {ADD_FIXED_SPAWN "Walking Corpse"} {ADD_FIXED_SPAWN "Walking Corpse"} {DEFINE_FIXED_GROUP 11 22} {ADD_FIXED_SPAWN "Elvish Champion"} {ADD_FIXED_SPAWN "Dwarvish Stalwart"} {ADD_FIXED_SPAWN "Dwarvish Stalwart"} {ADD_FIXED_SPAWN "Orcish Slayer"} [store_unit] variable=leader [filter] side=3,4 [/filter] kill=no [/store_unit] [if] [variable] name=leader.length less_than=2 [/variable] [then] {VARIABLE lose_condition_string ( _ "Death of your leader")} {VARIABLE notes ( _ "Since your team has only one leader, the enemy waves will not be at full strength.")} [/then] [else] {VARIABLE lose_condition_string ( _ "Death of both of your team’s leaders")} {VARIABLE notes ( _ "Since your team has two leaders, the enemy waves will be at full strength.")} [/else] [/if] [music] name=wanderer.ogg ms_before=2000 [/music] [music] name=battle.ogg ms_before=2000 append=yes [/music] [music] name=breaking_the_chains.ogg play_once=yes immediate=yes [/music] [objectives] [objective] description= _ "Survive and defeat all enemy waves" condition=win [/objective] [objective] description=$lose_condition_string condition=lose [/objective] [note] description=$notes [/note] [/objectives] {CLEAR_VARIABLE lose_condition_string} {CLEAR_VARIABLE notes} [/event] [event] name=start [message] caption= _"Dark Forecast — a random survival scenario" speaker=narrator image=misc/time-schedules/default/schedule-dawn.png #wmllint: local spellings jb Rhuvaen #wmllint: display on message= _ "Your aim is to survive the spawning waves of units and defeat the final archenemies. The spawning waves are randomly generated and will be different each time Dark Forecast is played. They appear along the north, south, and west map edges — though they are most likely to spawn on the west edge. The waves appear at somewhat regular intervals. The weather will also change randomly, affecting the layout of the map. Dark Forecast was made by: jb: • Map design, spawn groups, and scenario concept Rhuvaen: • WML implementation" #wmllint: display off [/message] [message] side=3 message= _"So this is the accursed valley — a land ours for the taking." [/message] [message] side=4 message= _"The inhabitants are rumored to be a strange alliance of man and beast, and our claim is not going to be unopposed. We must be prepared for the surprises of this land." [/message] [message] side=3 message= _"Then let us discover what lies in waiting and teach them not to oppose our claim." [/message] [/event] [event] name=turn 2 {INIT_WEATHER} [if] [variable] name=leader.length less_than=2 [/variable] [then] {REGULAR_RANDOM_SPAWNS 2 5 11 50 5 4 21} [/then] [else] {REGULAR_RANDOM_SPAWNS 2 4 11 90 4 5 23} [/else] [/if] {CLEAR_VARIABLE leader} [/event] [event] name=last breath first_time_only=no [filter] side=3,4 canrecruit=yes [/filter] [if] [have_unit] side=3,4 canrecruit=yes [/have_unit] [then] [message] speaker=unit message= _"Ugh! How can this be? Defeated by mere barbarians! My gods have forsaken me..." [/message] [/then] [else] [music] name=defeat.ogg play_once=yes immediate=yes [/music] [sound] name=dwarf-laugh.wav [/sound] [message] speaker=second_unit message= _"Cheers of your enemy are the last thing you hear as you slip into death...their joy fills your last moments with pure hate." [/message] [endlevel] result=defeat [/endlevel] [/else] [/if] [/event] [event] name=time over [music] name=defeat.ogg play_once=yes immediate=yes [/music] [sound] name=dwarf-laugh.wav [/sound] [message] side=1,2 canrecruit=yes message= _ "The enemy cheers as a dark mist rises from the land, engulfing you. As ghostly wisps drain away your will, you realize that your time in this land is over." [/message] [/event] #undef RANDOMIZE #undef RANDOMIZE_INDEX #undef PLACE_SPAWN_GROUP #undef ADJUST_AGGRESSION #undef SPAWN_UNIT #undef ADJUST_UNIT_LEVEL #undef CLEAR_SPAWN_GROUP #undef VICTORY_CHECK #undef FINAL_SPAWN #undef REGULAR_RANDOM_SPAWNS #undef DEFINE_MAIN_GROUP #undef ADD_MAIN_SPAWN #undef DEFINE_SPAWN_LOCATION #undef DEFINE_FIXED_GROUP #undef ADD_FIXED_SPAWN #undef SET_TIMID_AI_AND_BOLD_AI #undef WEATHER_EVENT_AT #undef WEATHER_MAP #undef WEATHER_ALERT #undef ADJUST_WEATHER #undef INIT_WEATHER [/multiplayer]