share/hedgewars/Data/Missions/Training/User_Mission_-_Teamwork.lua
changeset 4662 63aafc9c2a81
child 4664 debfdc340e68
equal deleted inserted replaced
4661:f5d858e4b634 4662:63aafc9c2a81
       
     1 loadfile(GetDataPath() .. "Scripts/Locale.lua")()
       
     2 
       
     3 local player = nil -- This variable will point to the hog's gear
       
     4 local p2 = nil
       
     5 local enemy = nil
       
     6 local bCrate = nil
       
     7 
       
     8 local GameOver = false
       
     9 
       
    10 function onGameInit()
       
    11 
       
    12 	-- Things we don't modify here will use their default values.
       
    13 	Seed = 0 -- The base number for the random number generator
       
    14 	GameFlags = gfDisableWind-- Game settings and rules
       
    15 	SuddenDeathTurns = 9999
       
    16 	TurnTime = 30000 -- The time the player has to move each round (in ms)
       
    17 	CaseFreq = 0 -- The frequency of crate drops
       
    18 	MinesNum = 0 -- The number of mines being placed
       
    19 	MinesTime  = 1
       
    20 	Explosives = 0 -- The number of explosives being placed
       
    21 	Delay = 10 -- The delay between each round
       
    22 	Map = "Mushrooms" -- The map to be played
       
    23 	Theme = "Nature" -- The theme to be used
       
    24 
       
    25 	AddTeam(loc("Feeble Resistance"), 14483456, "Simple", "Island", "Default")
       
    26 	player = AddHog(loc("Pathetic Hog #1"), 0, 50, "NoHat")
       
    27 	p2 = AddHog(loc("Pathetic Hog #2"), 0, 20, "NoHat")
       
    28 
       
    29 	--AddTeam("Toxic Team", 	1175851, "Simple", "Island", "Robot","cm_binary")
       
    30 	AddTeam(loc("Cybernetic Empire"), 	1175851, "Simple", "Island", "Robot", "cm_binary")
       
    31 	enemy = AddHog(loc("Unit 3378"), 5, 30, "cyborg")
       
    32 
       
    33 	SetGearPosition(player, 2427, 1259)
       
    34 	SetGearPosition(p2, 2293, 1263)
       
    35 	SetGearPosition(enemy, 1516, 1519)
       
    36 
       
    37 end
       
    38 
       
    39 
       
    40 function onGameStart()
       
    41 
       
    42 	--mines
       
    43 	AddGear(1300, 1100, gtMine, 0, 0, 0, 0)
       
    44 	AddGear(1325, 1100, gtMine, 0, 0, 0, 0)
       
    45 	AddGear(1350, 1100, gtMine, 0, 0, 0, 0)
       
    46 	AddGear(1375, 1100, gtMine, 0, 0, 0, 0)
       
    47 	AddGear(1400, 1100, gtMine, 0, 0, 0, 0)
       
    48 	AddGear(1425, 1100, gtMine, 0, 0, 0, 0)
       
    49 	AddGear(1450, 1100, gtMine, 0, 0, 0, 0)
       
    50 	AddGear(1475, 1100, gtMine, 0, 0, 0, 0)
       
    51 	AddGear(1500, 1100, gtMine, 0, 0, 0, 0)
       
    52 
       
    53 	AddGear(1910, 1380, gtMine, 0, 0, 0, 0)
       
    54 	AddGear(1925, 1380, gtMine, 0, 0, 0, 0)
       
    55 	AddGear(1950, 1380, gtMine, 0, 0, 0, 0)
       
    56 	AddGear(1975, 1380, gtMine, 0, 0, 0, 0)
       
    57 	AddGear(2000, 1380, gtMine, 0, 0, 0, 0)
       
    58 	AddGear(2025, 1380, gtMine, 0, 0, 0, 0)
       
    59 
       
    60 	-- crates crates and more crates
       
    61 	bCrate = SpawnAmmoCrate(2712,1500,amBaseballBat)
       
    62 	SpawnUtilityCrate(1596,1167,amGirder)
       
    63 	SpawnAmmoCrate(2728,1978,amPickHammer)
       
    64 	SpawnAmmoCrate(1728,1647,amBlowTorch)
       
    65 	SpawnUtilityCrate(2567,1768,amJetpack)
       
    66 	SpawnAmmoCrate(1251,1466,amDrill)
       
    67 
       
    68 	ShowMission(loc("Codename: Teamwork"), loc("by mikade"), loc("- Eliminate Unit 3378 |- Feeble Resistance must survive"), 0, 0)
       
    69 
       
    70 end
       
    71 
       
    72 
       
    73 function onGameTick()
       
    74 
       
    75 	--if CurrentHedgehog ~= nil then
       
    76 	--	AddCaption(GetX(CurrentHedgehog) .. ";" .. GetY(CurrentHedgehog))
       
    77 	--end
       
    78 
       
    79 end
       
    80 
       
    81 
       
    82 function onAmmoStoreInit()
       
    83 	SetAmmo(amBlowTorch, 0, 0, 0, 1)
       
    84 	SetAmmo(amGirder, 0, 0, 0, 1)
       
    85 	SetAmmo(amPickHammer, 0, 0, 0, 2)
       
    86 	SetAmmo(amJetpack, 0, 0, 0, 1)
       
    87 	SetAmmo(amDrill, 0, 0, 0, 2)
       
    88 	SetAmmo(amBaseballBat, 0, 0, 0, 1)
       
    89 	SetAmmo(amSwitch, 9, 0, 0, 0)
       
    90 	SetAmmo(amSkip, 9, 0, 0, 0)
       
    91 end
       
    92 
       
    93 function onGearDamage(gear, damage)
       
    94 	if (gear == player) and (damage == 30) then
       
    95 		HogSay(player,loc("T_T"),SAY_SHOUT)
       
    96 	end
       
    97 end
       
    98 
       
    99 function onGearDelete(gear)
       
   100 
       
   101 	if gear == bCrate then
       
   102 		HogSay(CurrentHedgehog, loc("Hmmm..."), SAY_THINK)
       
   103 	end
       
   104 
       
   105 	if GetGearType(gear) == gtCase then
       
   106 		TurnTimeLeft = TurnTimeLeft + 5000
       
   107 	end
       
   108 
       
   109 	if (gear == enemy) and (GameOver == false) then
       
   110 		ShowMission(loc("Codename: Teamwork"), loc("MISSION SUCCESSFUL"), loc("Congratulations!"), 0, 0);
       
   111 	elseif (gear == player) or (gear == p2) then
       
   112 		ShowMission(loc("Codename: Teamwork"), loc("MISSION FAILED"), loc("Oh no! Just try again!"), -amSkip, 0)
       
   113 		GameOver = true
       
   114 		SetHealth(p2,0)
       
   115 		SetHealth(player,0)
       
   116 
       
   117 	end
       
   118 
       
   119 end