share/hedgewars/Data/Missions/Training/User_Mission_-_Dangerous_Ducklings.lua
changeset 9088 553355472675
parent 8043 da083f8d95e6
child 10290 42efccba0711
equal deleted inserted replaced
9087:52a8ee2e8324 9088:553355472675
     1 
     1 
     2 HedgewarsScriptLoad("/Scripts/Locale.lua")
     2 HedgewarsScriptLoad("/Scripts/Locale.lua")
     3 
       
     4 
     3 
     5 local player = nil -- This variable will point to the hog's gear
     4 local player = nil -- This variable will point to the hog's gear
     6 local instructor = nil
     5 local instructor = nil
     7 local enemy = nil
     6 local enemy = nil
     8 --local givenSpeech = false
       
     9 
     7 
    10 local speechStage = 0
     8 local speechStage = 0
    11 
     9 
    12 local gameLost = false
    10 local gameLost = false
    13 local gameWon = false
    11 local gameWon = false
    31 	SuddenDeathTurns = 99999
    29 	SuddenDeathTurns = 99999
    32 
    30 
    33 
    31 
    34 	AddTeam(loc("Bloody Rookies"), 14483456, "Simple", "Island", "Default")
    32 	AddTeam(loc("Bloody Rookies"), 14483456, "Simple", "Island", "Default")
    35 	player = AddHog(loc("Hunter"), 0, 1, "NoHat")
    33 	player = AddHog(loc("Hunter"), 0, 1, "NoHat")
       
    34 	instructor = AddHog(loc("Instructor"), 0, 100, "sf_vega")
    36 
    35 
    37 	--AddTeam("Instructors", 14483456, "Simple", "Island", "Default")
    36 	AddTeam(loc("Blue Team"), 29439, "Simple", "Island", "Default")
    38 	instructor = AddHog(loc("Instructor"), 1, 1, "sf_vega")
    37 	enemy = AddHog(loc("Filthy Blue"), 1, 100, "Skull")
    39 
       
    40 	AddTeam("Blue Team", 29439, "Simple", "Island", "Default")
       
    41 	enemy = AddHog("Filthy Blue", 1, 100, "Skull")
       
    42 
    38 
    43 	SetGearPosition(player,146,902)
    39 	SetGearPosition(player,146,902)
    44 	SetGearPosition(instructor,317,902)
    40 	SetGearPosition(instructor,317,902)
    45 	SetGearPosition(enemy,1918,837)
    41 	SetGearPosition(enemy,1918,837)
    46 
    42 
    47 
       
    48 	HogSay(player, ".............................", SAY_THINK)
    43 	HogSay(player, ".............................", SAY_THINK)
    49 	HogTurnLeft(instructor, true)
    44 	HogTurnLeft(instructor, true)
    50 
       
    51 
    45 
    52 end
    46 end
    53 
    47 
    54 
    48 
    55 function onGameStart()
    49 function onGameStart()
    57 	SpawnAmmoCrate(475,476,amRope)
    51 	SpawnAmmoCrate(475,476,amRope)
    58 	SpawnAmmoCrate(1729,476,amFirePunch)
    52 	SpawnAmmoCrate(1729,476,amFirePunch)
    59 
    53 
    60 	FollowGear(player)
    54 	FollowGear(player)
    61 
    55 
    62 	--spawnTarget()
    56 	ShowMission(loc("Dangerous Ducklings"), "", loc("Eliminate the Blue Team"), -amRope, 5000);
    63 
       
    64 	-- Show some nice mission goals.
       
    65 	-- Parameters are: caption, sub caption, description,
       
    66 	-- extra text, icon and time to show.
       
    67 	-- A negative icon parameter (-n) represents the n-th weapon icon
       
    68 	-- A positive icon paramter (n) represents the (n+1)-th mission icon
       
    69 	-- A timeframe of 0 is replaced with the default time to show.
       
    70 	ShowMission(loc("Dangerous Ducklings"), "", loc("Eliminate the Blue Team"), -amRope, 1);
       
    71 
    57 
    72 end
    58 end
    73 
    59 
    74 
    60 
    75 function onGameTick()
    61 function onGameTick()
    99 			givenSpeech = true
    85 			givenSpeech = true
   100 		end
    86 		end
   101 
    87 
   102 	end
    88 	end
   103 
    89 
   104 
       
   105 	-- if player falls in water or if player ignores speech
    90 	-- if player falls in water or if player ignores speech
   106 	if (CurrentHedgehog ~= nil) and (CurrentHedgehog == player) then
    91 	if (CurrentHedgehog ~= nil) and (CurrentHedgehog == player) then
   107 		if (GetY(player) > 2060) and (gameLost == false) then
    92 		if (GetY(player) > WaterLine) and (gameLost == false) then
   108 			HogSay(instructor, loc("DAMMIT, ROOKIE!"), SAY_SHOUT)
    93 			HogSay(instructor, loc("DAMMIT, ROOKIE!"), SAY_SHOUT)
   109 			gameLost = true
    94 			gameLost = true
   110 		end
    95 		end
   111 
    96 
   112 		if (GetX(player) > 1324) and (GetY(player) > 1908) and (notListening == false) and (speechStage < 3) then
    97 		if (GetX(player) > 300) and (GetY(player) > 880) and (notListening == false) and (speechStage < 3) then
   113 			HogSay(instructor, loc("DAMMIT, ROOKIE! GET OFF MY HEAD!"), SAY_SHOUT)
    98 			HogSay(instructor, loc("DAMMIT, ROOKIE! GET OFF MY HEAD!"), SAY_SHOUT)
   114 			notListening = true
    99 			notListening = true
   115 		end
   100 		end
   116 
   101 
   117 	end
   102 	end
   124 	-- meh
   109 	-- meh
   125 	if gameLost == true then
   110 	if gameLost == true then
   126 		endTimer = endTimer + 1
   111 		endTimer = endTimer + 1
   127 		if (CurrentHedgehog ~= nil) and (CurrentHedgehog == instructor) then
   112 		if (CurrentHedgehog ~= nil) and (CurrentHedgehog == instructor) then
   128 			if endTimer >= 3000 then
   113 			if endTimer >= 3000 then
   129 				SetHealth(instructor,0)
   114 				--SetHealth(instructor,0)
   130 				TurnTimeLeft = 0
   115 				TurnTimeLeft = 1
       
   116 				ParseCommand("teamgone " .. loc("Bloody Rookies"))
   131 			end
   117 			end
   132 			ShowMission(loc("MISSION FAILED"), loc(":("), loc("You've failed. Try again."), -amRope, 1);
   118 			ShowMission(loc("MISSION FAILED"), loc(":("), loc("You've failed. Try again."), -amRope, 5000);
   133 		end
   119 		end
   134 	end
   120 	end
   135 
   121 
   136 end
   122 end
   137 
   123 
   144 
   130 
   145 function onGearDelete(gear)
   131 function onGearDelete(gear)
   146 	if GetGearType(gear) == gtHedgehog then
   132 	if GetGearType(gear) == gtHedgehog then
   147 		if gear == player then
   133 		if gear == player then
   148 			gameLost = true
   134 			gameLost = true
   149 		elseif gear == instructor then
   135 		elseif (gear == instructor) and (GetY(gear) > WaterLine) then
   150 			HogSay(player, loc("See ya!"), SAY_THINK)
   136 			HogSay(player, loc("See ya!"), SAY_THINK)
   151 			TurnTimeLeft = 3000
   137 			TurnTimeLeft = 3000
       
   138 			AddCaption(loc("Achievement Unlocked") .. ": " .. loc("Naughty Ninja"),0xffba00ff,capgrpMessage2)
       
   139 			ParseCommand("teamgone " .. loc("Blue Team"))
       
   140 			gameWon = true
   152 		elseif gear == enemy then
   141 		elseif gear == enemy then
   153 			HogSay(player, loc("Enjoy the swim..."), SAY_THINK)
   142 			HogSay(player, loc("Enjoy the swim..."), SAY_THINK)
   154 			gameWon = true
   143 			gameWon = true
   155 			TurnTimeLeft = 3000
   144 			TurnTimeLeft = 3000
   156 		end
   145 		end