share/hedgewars/Data/Missions/Challenge/User_Mission_-_RCPlane_Challenge.lua
changeset 14494 cc358e997e32
parent 14480 208359558642
child 14648 be8af70adf2c
equal deleted inserted replaced
14493:e78c44ae94da 14494:cc358e997e32
     1 HedgewarsScriptLoad("/Scripts/Utils.lua")
     1 HedgewarsScriptLoad("/Scripts/Utils.lua")
     2 HedgewarsScriptLoad("/Scripts/Locale.lua")
     2 HedgewarsScriptLoad("/Scripts/Locale.lua")
     3 HedgewarsScriptLoad("/Scripts/Achievements.lua")
     3 HedgewarsScriptLoad("/Scripts/Achievements.lua")
     4 
     4 
     5 local player = nil
     5 local player = nil
       
     6 local playerTeamName = nil
     6 local RCGear = nil
     7 local RCGear = nil
     7 local planesUsed = 0
     8 local planesUsed = 0
     8 local planeTimer = 0
     9 local planeTimer = 0
     9 local planeUhOh = false
    10 local planeUhOh = false
    10 local cratesLeft = 0
    11 local cratesLeft = 0
    33 
    34 
    34 	CaseFreq = 0
    35 	CaseFreq = 0
    35 	MinesNum = 0
    36 	MinesNum = 0
    36 	Explosives = 0
    37 	Explosives = 0
    37 
    38 
    38 	AddMissionTeam(-1)
    39 	playerTeamName = AddMissionTeam(-1)
    39 	player = AddMissionHog(80)
    40 	player = AddMissionHog(80)
    40 	SetGearPosition(player, 1380, 1500)
    41 	SetGearPosition(player, 1380, 1500)
    41 
    42 
    42 end
    43 end
    43 
    44 
    54 
    55 
    55                                 loc("Collect or destroy all the health crates.") .. "|" ..
    56                                 loc("Collect or destroy all the health crates.") .. "|" ..
    56                                 loc("Compete to use as few planes as possible!") .. "|" ..
    57                                 loc("Compete to use as few planes as possible!") .. "|" ..
    57                                 recordInfo, -amRCPlane, 4000
    58                                 recordInfo, -amRCPlane, 4000
    58                                 )
    59                                 )
    59 	SetTeamLabel(loc("Wannabe Flyboys"), "0")
    60 	SetTeamLabel(playerTeamName, "0")
    60 
    61 
    61 	PlaceGirder(2192, 508, 6)
    62 	PlaceGirder(2192, 508, 6)
    62 	PlaceGirder(2192, 670, 6)
    63 	PlaceGirder(2192, 670, 6)
    63 	PlaceGirder(2193, 792, 2)
    64 	PlaceGirder(2193, 792, 2)
    64 	PlaceGirder(2100, 825, 4)
    65 	PlaceGirder(2100, 825, 4)
   287 function onGearAdd(gear)
   288 function onGearAdd(gear)
   288 
   289 
   289 	if GetGearType(gear) == gtRCPlane then
   290 	if GetGearType(gear) == gtRCPlane then
   290 		RCGear = gear
   291 		RCGear = gear
   291 		planesUsed = planesUsed + 1
   292 		planesUsed = planesUsed + 1
   292 		SetTeamLabel(loc("Wannabe Flyboys"), tostring(planesUsed))
   293 		SetTeamLabel(playerTeamName, tostring(planesUsed))
   293 		planeTimer = 0
   294 		planeTimer = 0
   294 		missiles = 0
   295 		missiles = 0
   295 	end
   296 	end
   296 
   297 
   297 	if GetGearType(gear) == gtCase then
   298 	if GetGearType(gear) == gtCase then
   440                                 )
   441                                 )
   441 			SetState(player, gstWinner)
   442 			SetState(player, gstWinner)
   442 			PlaySound(sound, player)
   443 			PlaySound(sound, player)
   443 
   444 
   444 
   445 
   445 			DismissTeam(loc("Wannabe Flyboys"))
   446 			DismissTeam(playerTeamName)
   446 			EndGame()
   447 			EndGame()
   447 		end
   448 		end
   448 
   449 
   449 		if RCGear ~= nil then
   450 		if RCGear ~= nil then
   450 			SetTimer(RCGear, GetTimer(RCGear) + 10000)
   451 			SetTimer(RCGear, GetTimer(RCGear) + 10000)