share/hedgewars/Data/Missions/Scenario/User_Mission_-_Teamwork_2.lua
author Wuzzy <almikes@aol.com>
Thu, 27 Apr 2017 01:10:37 +0200
changeset 12347 f4c55ac82698
parent 12228 8b523acb3220
child 12352 7f09d01ecb45
permissions -rw-r--r--
Fix Ammo/Utility crate confusion in portal mission
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12228
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
     1
-- Teamwork 2
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
     2
-- Original scenario by Arkhnen
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
     3
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
     4
HedgewarsScriptLoad("Scripts/Locale.lua")
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
     5
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
     6
local player = nil
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
     7
local hlayer = nil
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
     8
local enemy = nil
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
     9
local Pack = nil
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    10
local help = false
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    11
local GameOver = false
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    12
local skipTime = 0
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    13
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    14
function onGameInit()
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    15
	Seed = 0
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    16
	GameFlags = gfDisableWind
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    17
	TurnTime = 600000000
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    18
	CaseFreq = 0
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    19
	MinesNum = 0
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    20
	MinesTime = 0
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    21
	-- Disable Sudden Death
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    22
	HealthDecrease = 0
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    23
	WaterRise = 0
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    24
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    25
	Explosives = 0
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    26
	Delay = 10
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    27
	Map = "CrazyMission"
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    28
	Theme = "CrazyMission"
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    29
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    30
	AddTeam(loc("Feeble Resistance"), 14483456, "Simple", "Island", "Default", "cm_kiwi")
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    31
	player = AddHog(loc("Greg"), 0, 30, "NoHat")
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    32
	hlayer = AddHog(loc("Mark"), 0, 40, "NoHat")
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    33
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    34
	AddTeam(loc("Cybernetic Empire"), 1175851, "Simple", "Island", "Robot", "cm_binary")
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    35
	enemy = AddHog(loc("WatchBot 4000"), 5, 50, "cyborg1")
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    36
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    37
	SetGearPosition(player, 180, 555)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    38
	SetGearPosition(enemy, 1500, 914)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    39
	SetGearPosition(hlayer, 333, 555)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    40
end
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    41
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    42
function onGameStart()
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    43
	Pack = SpawnAmmoCrate(40, 888, amPickHammer)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    44
	SpawnAmmoCrate(90, 888, amBaseballBat)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    45
	SpawnAmmoCrate(822, 750, amBlowTorch)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    46
	SpawnAmmoCrate(700, 580, amJetpack)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    47
	SpawnAmmoCrate(1400, 425, amParachute)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    48
	SpawnAmmoCrate(1900, 770, amDynamite)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    49
	SpawnAmmoCrate(1794, 970, amDynamite)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    50
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    51
	ShowMission(loc("Teamwork 2"), loc("Scenario"), loc("Eliminate WatchBot 4000.") .. "|" .. loc("Both your hedgehogs must survive.") .. "|" .. loc("Land mines explode instantly."), -amBaseballBat, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    52
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    53
	AddGear(355, 822, gtSMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    54
	AddGear(515, 525, gtSMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    55
	AddGear(1080, 821, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    56
	AddGear(1055, 821, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    57
	AddGear(930, 587, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    58
	AddGear(955, 556, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    59
	AddGear(980, 556, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    60
	AddGear(1005, 556, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    61
	AddGear(710, 790, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    62
	AddGear(685, 790, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    63
	AddGear(660, 790, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    64
	AddGear(1560, 540, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    65
	AddGear(1610, 600, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    66
	AddGear(1660, 655, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    67
	AddGear(713, 707, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    68
	AddGear(1668, 969, gtExplosives, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    69
	AddGear(1668, 906, gtExplosives, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    70
	AddGear(1668, 842, gtExplosives, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    71
	AddGear(1713, 969, gtExplosives, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    72
	SetWind(90)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    73
end
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    74
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    75
function onGearAdd(gear)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    76
	if GetGearType(gear) == gtJetpack then
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    77
		SetHealth(gear, 300)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    78
	end
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    79
end
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    80
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    81
function onAmmoStoreInit()
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    82
	SetAmmo(amParachute, 1, 0, 0, 2)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    83
	SetAmmo(amSwitch, 9, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    84
	SetAmmo(amSkip, 9, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    85
	SetAmmo(amPickHammer, 0, 0, 0, 1)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    86
	SetAmmo(amBaseballBat, 0, 0, 0, 1)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    87
	SetAmmo(amBlowTorch, 0, 0, 0, 2)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    88
	SetAmmo(amJetpack, 0, 0, 0, 1)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    89
	SetAmmo(amDynamite, 0, 0, 0, 1)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    90
end
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    91
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    92
--[[ This is some hackery to make the enemy hedgehog skip ]]
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    93
function onNewTurn()
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    94
	if CurrentHedgehog == enemy then
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    95
		skipTime = GameTime + 1
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    96
	end
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    97
end
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    98
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    99
function onGameTick20()
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   100
	if CurrentHedgehog == enemy and skipTime ~= 0 and skipTime < GameTime then
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   101
        	ParseCommand("/skip")
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   102
		skipTime = 0
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   103
	end
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   104
end
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   105
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   106
function onGearDelete(gear)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   107
	if gear == Pack then
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   108
		HogSay(CurrentHedgehog, loc("This will certianly come in handy."), SAY_THINK)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   109
	end
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   110
	if (gear == enemy) and (GameOver == false) then
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   111
		ShowMission(loc("Teamwork 2"), loc("MISSION SUCCESSFUL"), loc("Congratulations!"), 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   112
		GameOver = true
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   113
	elseif ( ((gear == player) or (gear == hlayer)) and (GameOver == false)) then
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   114
		ShowMission(loc("Teamwork 2"), loc("MISSION FAILED"), loc("Oh no! Just try again!"), -amSkip, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   115
		GameOver = true
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   116
		SetHealth(hlayer, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   117
		SetHealth(player, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   118
	end
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   119
end