share/hedgewars/Data/Missions/Scenario/User_Mission_-_Teamwork_2.lua
author Wuzzy <Wuzzy2@mail.ru>
Mon, 21 Jan 2019 19:49:38 +0100
changeset 14670 e7b2542c4d28
parent 14516 ff2c1f25fc03
child 14953 ff4003a90ff8
permissions -rw-r--r--
More spawn height tweaking in missions
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
14503
d4aa64f51c9f Use player-chosen team identity for most challenges and scenarios
Wuzzy <Wuzzy2@mail.ru>
parents: 14487
diff changeset
    12
local playerTeamName
12228
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
13752
110d6c1e817f Lua: Rename globals: NoPointX→NO_CURSOR, cMaxTurnTime→MAX_TURN_TIME, cMaxHogHealth→MAX_HOG_HEALTH
Wuzzy <Wuzzy2@mail.ru>
parents: 13664
diff changeset
    17
	TurnTime = MAX_TURN_TIME
12228
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
	Map = "CrazyMission"
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    27
	Theme = "CrazyMission"
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    28
14516
ff2c1f25fc03 Minor refactor in single missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14503
diff changeset
    29
	playerTeamName = AddMissionTeam(-1)
14503
d4aa64f51c9f Use player-chosen team identity for most challenges and scenarios
Wuzzy <Wuzzy2@mail.ru>
parents: 14487
diff changeset
    30
	player = AddMissionHog(30)
d4aa64f51c9f Use player-chosen team identity for most challenges and scenarios
Wuzzy <Wuzzy2@mail.ru>
parents: 14487
diff changeset
    31
	hlayer = AddMissionHog(40)
12228
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    32
13583
141cdfe0f3ca Switch almost all Lua calls of AddTeam to using default clan colors instead of hardcoded color
Wuzzy <Wuzzy2@mail.ru>
parents: 13354
diff changeset
    33
	AddTeam(loc("Cybernetic Empire"), -6, "ring", "Island", "Robot", "cm_binary")
12228
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    34
	enemy = AddHog(loc("WatchBot 4000"), 5, 50, "cyborg1")
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    35
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    36
	SetGearPosition(player, 180, 555)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    37
	SetGearPosition(enemy, 1500, 914)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    38
	SetGearPosition(hlayer, 333, 555)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    39
end
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    40
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    41
function onGameStart()
12933
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12586
diff changeset
    42
	Pack = SpawnSupplyCrate(40, 888, amPickHammer)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12586
diff changeset
    43
	SpawnSupplyCrate(90, 888, amBaseballBat)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12586
diff changeset
    44
	SpawnSupplyCrate(822, 750, amBlowTorch)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12586
diff changeset
    45
	SpawnSupplyCrate(700, 580, amJetpack)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12586
diff changeset
    46
	SpawnSupplyCrate(1400, 425, amParachute)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12586
diff changeset
    47
	SpawnSupplyCrate(1900, 770, amDynamite)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12586
diff changeset
    48
	SpawnSupplyCrate(1794, 970, amDynamite)
12228
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    49
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    50
	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
    51
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    52
	AddGear(355, 822, gtSMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    53
	AddGear(515, 525, gtSMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    54
	AddGear(1080, 821, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    55
	AddGear(1055, 821, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    56
	AddGear(930, 587, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    57
	AddGear(955, 556, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    58
	AddGear(980, 556, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    59
	AddGear(1005, 556, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    60
	AddGear(710, 790, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    61
	AddGear(685, 790, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    62
	AddGear(660, 790, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    63
	AddGear(1560, 540, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    64
	AddGear(1610, 600, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    65
	AddGear(1660, 655, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    66
	AddGear(713, 707, gtMine, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    67
	AddGear(1668, 969, gtExplosives, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    68
	AddGear(1668, 906, gtExplosives, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    69
	AddGear(1668, 842, gtExplosives, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    70
	AddGear(1713, 969, gtExplosives, 0, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    71
	SetWind(90)
12353
ebff18a44c1e Refactor Teamwork 2: No more hacky skipping, set proper ammos for enemy instead
Wuzzy <almikes@aol.com>
parents: 12352
diff changeset
    72
ebff18a44c1e Refactor Teamwork 2: No more hacky skipping, set proper ammos for enemy instead
Wuzzy <almikes@aol.com>
parents: 12352
diff changeset
    73
	-- The enemy has no weapons and can only skip
ebff18a44c1e Refactor Teamwork 2: No more hacky skipping, set proper ammos for enemy instead
Wuzzy <almikes@aol.com>
parents: 12352
diff changeset
    74
	for i=0, AmmoTypeMax do
ebff18a44c1e Refactor Teamwork 2: No more hacky skipping, set proper ammos for enemy instead
Wuzzy <almikes@aol.com>
parents: 12352
diff changeset
    75
		if i ~= amNothing and i ~= amSkip then
ebff18a44c1e Refactor Teamwork 2: No more hacky skipping, set proper ammos for enemy instead
Wuzzy <almikes@aol.com>
parents: 12352
diff changeset
    76
			AddAmmo(enemy, i, 0)
ebff18a44c1e Refactor Teamwork 2: No more hacky skipping, set proper ammos for enemy instead
Wuzzy <almikes@aol.com>
parents: 12352
diff changeset
    77
		end
ebff18a44c1e Refactor Teamwork 2: No more hacky skipping, set proper ammos for enemy instead
Wuzzy <almikes@aol.com>
parents: 12352
diff changeset
    78
	end
12228
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 onGearAdd(gear)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    82
	if GetGearType(gear) == gtJetpack then
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    83
		SetHealth(gear, 300)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    84
	end
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    85
end
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    86
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    87
function onAmmoStoreInit()
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    88
	SetAmmo(amParachute, 1, 0, 0, 2)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    89
	SetAmmo(amSwitch, 9, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    90
	SetAmmo(amSkip, 9, 0, 0, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    91
	SetAmmo(amPickHammer, 0, 0, 0, 1)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    92
	SetAmmo(amBaseballBat, 0, 0, 0, 1)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    93
	SetAmmo(amBlowTorch, 0, 0, 0, 2)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    94
	SetAmmo(amJetpack, 0, 0, 0, 1)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    95
	SetAmmo(amDynamite, 0, 0, 0, 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
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    98
function onGearDelete(gear)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
    99
	if gear == Pack then
13354
f9a15dcd857c Fix a couple of English typos
Wuzzy <Wuzzy2@mail.ru>
parents: 12933
diff changeset
   100
		HogSay(CurrentHedgehog, loc("This will certainly come in handy."), SAY_THINK)
12228
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   101
	end
12352
7f09d01ecb45 Fix false victory in Teamwork/Teamwork 2 when one of your hogs die in same turn as enemy
Wuzzy <almikes@aol.com>
parents: 12228
diff changeset
   102
	-- Note: The victory sequence is done automatically by Hedgewars
7f09d01ecb45 Fix false victory in Teamwork/Teamwork 2 when one of your hogs die in same turn as enemy
Wuzzy <almikes@aol.com>
parents: 12228
diff changeset
   103
	if ( ((gear == player) or (gear == hlayer)) and (GameOver == false)) then
12228
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   104
		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
   105
		GameOver = true
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   106
		SetHealth(hlayer, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   107
		SetHealth(player, 0)
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   108
	end
14487
734a7af2dfc2 Fix victory check of a few scenarios
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
   109
end
734a7af2dfc2 Fix victory check of a few scenarios
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
   110
734a7af2dfc2 Fix victory check of a few scenarios
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
   111
function onGameResult(winningClan)
734a7af2dfc2 Fix victory check of a few scenarios
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
   112
	if winningClan == GetTeamClan(playerTeamName) then
14485
ead8928a59f8 Report mission victory for most missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   113
		SaveMissionVar("Won", "true")
ead8928a59f8 Report mission victory for most missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   114
	end
12228
8b523acb3220 Add scenario: Teamwork 2
Wuzzy <almikes@aol.com>
parents:
diff changeset
   115
end