share/hedgewars/Data/Missions/Scenario/User_Mission_-_Bamboo_Thicket.lua
author Wuzzy <Wuzzy2@mail.ru>
Fri, 31 May 2019 21:39:47 +0200
changeset 15091 5c8c729a16ce
parent 15015 a1165392c9db
permissions -rw-r--r--
Scenarios: Show "Mission succeeded/failed!" in stats screen
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5427
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
     1
8043
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7877
diff changeset
     2
HedgewarsScriptLoad("/Scripts/Locale.lua")
13496
cbda0f842364 Standardize hidden mission achievement in new Lua library "Achievements"
Wuzzy <Wuzzy2@mail.ru>
parents: 13061
diff changeset
     3
HedgewarsScriptLoad("/Scripts/Achievements.lua")
5427
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
     4
15091
5c8c729a16ce Scenarios: Show "Mission succeeded/failed!" in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents: 15015
diff changeset
     5
local playerTeamName
5427
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
     6
local player = nil 
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
     7
local enemy = nil
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
     8
local firedShell = false
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
     9
local turnNumber = 0
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    10
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    11
local hhs = {}
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    12
local numhhs = 0
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    13
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    14
function onGameInit()
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    15
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    16
	Seed = 0 
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    17
	TurnTime = 20000 
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    18
	CaseFreq = 0 
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    19
	MinesNum = 0 
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    20
	Explosives = 0 
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    21
	Map = "Bamboo" 
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    22
	Theme = "Bamboo"
12224
d62d6f8ebef1 Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents: 12078
diff changeset
    23
	-- Disable Sudden Death
d62d6f8ebef1 Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents: 12078
diff changeset
    24
	HealthDecrease = 0
d62d6f8ebef1 Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents: 12078
diff changeset
    25
	WaterRise = 0
13061
8d2087c85b8d Fix incorrect wind bar in some missions
Wuzzy <Wuzzy2@mail.ru>
parents: 12933
diff changeset
    26
	GameFlags = gfDisableWind
5427
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    27
15091
5c8c729a16ce Scenarios: Show "Mission succeeded/failed!" in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents: 15015
diff changeset
    28
	playerTeamName = AddMissionTeam(-1)
14482
d4aa64f51c9f Use player-chosen team identity for most challenges and scenarios
Wuzzy <Wuzzy2@mail.ru>
parents: 14464
diff changeset
    29
	player = AddMissionHog(10)
5427
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    30
			
14932
ff4003a90ff8 Enable automatic voicepack language selection for all missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14482
diff changeset
    31
	AddTeam(loc("Cybernetic Empire"), -6, "ring", "Island", "Robot_qau", "cm_cyborg")
5823
mikade
parents: 5449
diff changeset
    32
	enemy = AddHog(loc("Unit 835"), 1, 10, "cyborg1")
5427
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    33
7877
b3fb94986255 Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents: 5823
diff changeset
    34
	SetGearPosition(player,142,656)
b3fb94986255 Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents: 5823
diff changeset
    35
	SetGearPosition(enemy,1824,419)
5427
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    36
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    37
end
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    38
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    39
function onGameStart()
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    40
12078
99bfd35b3924 Fix misleading scenario desciptions regarding time limit / no time limit
Wuzzy <almikes@aol.com>
parents: 12077
diff changeset
    41
	ShowMission(loc("Bamboo Thicket"), loc("Scenario"), loc("Eliminate the enemy."), -amBazooka, 0)
5427
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    42
12933
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    43
	-- CRATE LIST.
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    44
	SpawnSupplyCrate(891,852,amBazooka)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    45
	SpawnSupplyCrate(962,117,amBlowTorch)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    46
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    47
	SpawnSupplyCrate(403,503,amParachute)
5427
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    48
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    49
	AddAmmo(enemy, amGrenade, 100)
13061
8d2087c85b8d Fix incorrect wind bar in some missions
Wuzzy <Wuzzy2@mail.ru>
parents: 12933
diff changeset
    50
8d2087c85b8d Fix incorrect wind bar in some missions
Wuzzy <Wuzzy2@mail.ru>
parents: 12933
diff changeset
    51
	SetWind(100)
5427
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    52
		
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    53
end
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    54
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    55
function onNewTurn()
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    56
	turnNumber = turnNumber + 1
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    57
end
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    58
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    59
function onAmmoStoreInit()
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    60
	SetAmmo(amSkip, 9, 0, 0, 0)
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    61
	SetAmmo(amGirder, 4, 0, 0, 0)
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    62
	SetAmmo(amBlowTorch, 0, 0, 0, 1)
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    63
	SetAmmo(amParachute, 0, 0, 0, 2)
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    64
	SetAmmo(amBazooka, 0, 0, 0, 2)
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    65
end
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    66
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    67
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    68
function onGearAdd(gear)
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    69
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    70
	if GetGearType(gear) == gtHedgehog then
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    71
		hhs[numhhs] = gear
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    72
		numhhs = numhhs + 1
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    73
	elseif GetGearType(gear) == gtShell then
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    74
		firedShell = true
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    75
	end
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    76
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    77
end
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    78
15015
a1165392c9db Scenarios: Drawn games count as mission failure
Wuzzy <Wuzzy2@mail.ru>
parents: 14932
diff changeset
    79
function onGameResult(winner)
5427
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    80
15091
5c8c729a16ce Scenarios: Show "Mission succeeded/failed!" in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents: 15015
diff changeset
    81
	if (winner == GetTeamClan(playerTeamName)) then
5427
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    82
		
14464
ead8928a59f8 Report mission victory for most missions
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
    83
		SaveMissionVar("Won", "true")
15091
5c8c729a16ce Scenarios: Show "Mission succeeded/failed!" in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents: 15015
diff changeset
    84
		SendStat(siGameResult, loc("Mission succeeded!"))
5427
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    85
		
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    86
		if (turnNumber < 6) and (firedShell == false) then
13496
cbda0f842364 Standardize hidden mission achievement in new Lua library "Achievements"
Wuzzy <Wuzzy2@mail.ru>
parents: 13061
diff changeset
    87
			awardAchievement(loc("Energetic Engineer"))
5427
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    88
		end
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    89
15015
a1165392c9db Scenarios: Drawn games count as mission failure
Wuzzy <Wuzzy2@mail.ru>
parents: 14932
diff changeset
    90
	else
15091
5c8c729a16ce Scenarios: Show "Mission succeeded/failed!" in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents: 15015
diff changeset
    91
		SendStat(siGameResult, loc("Mission failed!"))
5427
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    92
	end
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    93
3817b7e6c871 New mission. Hopefully easier than most of my other missions. :D
mikade
parents:
diff changeset
    94
end