#textdomain wesnoth-ai [test] id=The_Elves_Besieged name= _ "The Elves Besieged" next_scenario=micro_ai_test victory_when_enemies_defeated=no map_data="{campaigns/Heir_To_The_Throne/maps/01_The_Elves_Besieged.map}" turns=-1 {DEFAULT_SCHEDULE} # Chantal can't be killed for storyline reasons. # Prevent AIs from getting too close. #define AVOID_CHANTAL [avoid] x,y=2-4,22-24 [/avoid] #enddef {STARTING_VILLAGES 5 10} {STARTING_VILLAGES 6 10} {STARTING_VILLAGES 1 3} {STARTING_VILLAGES_AREA 6 7 10 6} {STARTING_VILLAGES_AREA 5 17 3 1} {STARTING_VILLAGES_AREA 6 9 40 10} {STARTING_VILLAGES_AREA 5 26 31 5} {STARTING_VILLAGES_AREA 5 29 46 1} # wmllint: recognize Kalenz [side] type=Spearman id=Konrad name= _"Konrad" unrenamable=yes side=1 persistent=no canrecruit=yes controller=ai [modifications] {TRAIT_QUICK} [/modifications] recruit=Elvish Scout,Elvish Fighter,Elvish Archer,Elvish Shaman gold=100 team_name=elves user_team_name=_"Rebels" [unit] id=Delfador name= _ "Delfador" unrenamable=yes type=Elder Mage side=1 x=19 y=23 {IS_HERO} [modifications] {TRAIT_LOYAL} {TRAIT_INTELLIGENT} [/modifications] [/unit] {FLAG_VARIANT long} # Also have them target Side 2 preferentially, in order to go in that direction [ai] [goal] [criteria] #NOTE: this is a SUF, because we're targeting a unit side=3 [/criteria] value=1000 [/goal] [/ai] [/side] #macro which tells the AI not to start thinking about #whether it's a bad idea to send trolls into the forest #against elves, and just do it #define EBESIEGED_RECRUITMENT [ai] recruitment_ignore_bad_movement=yes recruitment_ignore_bad_combat=yes simple_targeting=yes [/ai] #enddef [side] type=Orcish Warlord id=Urug-Telfar name= _ "Urug-Telfar" side=2 persistent=no canrecruit=yes recruit=Orcish Warrior,Goblin Knight,Goblin Pillager,Orcish Crossbowman,Orcish Assassin,Troll gold=400 [ai] recruitment_pattern=scout,fighter,mixed fighter,archer {AVOID_CHANTAL} [/ai] {EBESIEGED_RECRUITMENT} team_name=orcs user_team_name=_"Orcs" {FLAG_VARIANT ragged} [/side] [side] type=Orcish Warlord id=Knafa-Tan name= _ "Knafa-Tan" side=3 persistent=no canrecruit=yes recruit=Orcish Warrior,Wolf Rider,Orcish Crossbowman,Orcish Assassin,Troll {EBESIEGED_RECRUITMENT} team_name=orcs user_team_name=_"Orcs" gold=200 [ai] {AVOID_CHANTAL} [/ai] {FLAG_VARIANT ragged} [/side] [side] type=Orcish Warlord id=Maga-Knafa name= _ "Maga-Knafa" side=4 persistent=no canrecruit=yes recruit=Orcish Warrior,Wolf Rider,Orcish Crossbowman,Troll Warrior,Orcish Slayer {EBESIEGED_RECRUITMENT} team_name=orcs user_team_name=_"Orcs" gold=200 [ai] {AVOID_CHANTAL} [/ai] {FLAG_VARIANT ragged} [/side] #allies of Konrad [side] type=Elvish Champion id=Galdrad name= _ "Galdrad" side=5 persistent=no canrecruit=yes recruit=Elvish Fighter,Elvish Archer,Elvish Ranger [ai] recruitment_pattern=fighter,archer,mixed fighter [/ai] gold=170 team_name=elves user_team_name=_"Rebels" {FLAG_VARIANT long} [/side] [side] type=Elvish Shyde id=Chantal name= _ "Chantal" profile=portraits/chantal-shyde.png side=6 persistent=no canrecruit=yes recruit=Elvish Shaman,Elvish Archer,Elvish Fighter [ai] passive_leader="yes" leader_shares_keep="yes" recruitment_pattern=archer,archer,fighter,fighter,healer [/ai] gold=170 team_name=elves user_team_name=_"Rebels" {FLAG_VARIANT long} [/side] [side] # This side is only here because we need one persistent side for the game to go on side=7 controller=null persistent=yes save_id=Grnk hidden=yes [/side] [event] name=start {VARIABLE scenario_name The_Elves_Besieged} [micro_ai] # Required keys of [micro_ai] tag side=1 ai_type=protect_unit action=add [unit] id=Delfador goal_x,goal_y=1,2 [/unit] [unit] id=Konrad goal_x,goal_y=1,1 [/unit] disable_move_leader_to_keep=yes [/micro_ai] [message] speaker=Konrad message= _ "Master Delfador! Look, there are orcs coming from all directions! What shall we do?" [/message] [message] speaker=Delfador message= _ "There are too many to fight, far too many. We must escape!" [/message] # wmllint: unbalanced-on {MESSAGE narrator "wesnoth-icon.png" "" _"This is a reenactment of scenario The Elves Besieged of the mainline campaign Heir to the Throne, just that the AI is playing Konrad's side here. The goal is to move Konrad to the signpost in the northwest, while keeping both Konrad and Delfador alive. The same AI as in scenario Protect Unit is used. Note: The Protect Unit AI is coded as a Micro AI. A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the Micro AI wiki page at http://wiki.wesnoth.org/Micro_AIs for more information."} # wmllint: unbalanced-off {PLACE_IMAGE "scenery/signpost.png" 1 1} {SET_LABEL 1 1 _"Move Konrad here"} [scroll_to_unit] id=Konrad [/scroll_to_unit] [/event] [event] name=moveto [filter] x=1 y=1 id=Konrad [/filter] [message] speaker=unit message= _ "Very well, we have made it this far! But where do we go next?" [/message] # wmllint: local spellings HttT [message] speaker=Delfador message= _ "In HttT, we would travel north now, and try to make it to the Isle of Alduin. But for this demo campaign, we'll call it good here." [/message] # So that game goes on to next scenario [modify_side] side=7 controller=human [/modify_side] [endlevel] result=victory bonus=no carryover_percentage=0 carryover_report=no linger_mode=no [/endlevel] [/event] [event] name=last breath [filter] id=Konrad [/filter] [message] speaker=unit message= _ "I... I don’t think I can make it anymore." [/message] [message] speaker=Delfador message= _ "Prince... you must keep fighting! Nooooooo!" [/message] [message] speaker=unit message= _ "It is over. I am doomed..." [/message] [endlevel] result=defeat [/endlevel] [/event] [event] name=last breath [filter] id=Delfador [/filter] [message] speaker=unit message= _ "I have... have failed in my duty to protect the prince! I am defeated." [/message] [message] speaker=Konrad message= _ "Don’t die, Delfador! Please, you have to stay alive!" [/message] [message] speaker=unit message= _ "Ugh!" [/message] [endlevel] result=defeat [/endlevel] [/event] [event] name=time over [message] speaker=Delfador message= _ "Oh, no! We have run out of time, they have arrived with reinforcements..." [/message] [/event] [/test]