share/hedgewars/Data/Missions/Scenario/User_Mission_-_Diver.lua
author KoBeWi
Mon, 30 Jul 2018 20:38:01 +0200
changeset 13580 213f2bef8a24
parent 12938 e65aa3c3d4e6
child 13588 141cdfe0f3ca
permissions -rw-r--r--
Update Polish translation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
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")
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
     3
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
     4
local player = nil -- This variable will point to the hog's gear
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
     5
local enemy = nil
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
     6
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
     7
local GameOver = false
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
     8
12395
c051ac2544f2 Add note in Diver scenario that jetpack only has 50% fuel
Wuzzy <almikes@aol.com>
parents: 12359
diff changeset
     9
local jetpackFuel = 1000
c051ac2544f2 Add note in Diver scenario that jetpack only has 50% fuel
Wuzzy <almikes@aol.com>
parents: 12359
diff changeset
    10
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    11
function onGameInit()
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    12
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    13
	-- Things we don't modify here will use their default values.
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    14
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    15
	Seed = 0 -- The base number for the random number generator
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    16
	GameFlags = gfInfAttack + gfDisableWind-- Game settings and rules
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    17
	TurnTime = 90000 -- The time the player has to move each round (in ms)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    18
	CaseFreq = 0 -- The frequency of crate drops
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    19
	MinesNum = 0 -- The number of mines being placed
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    20
	MinesTime  = 1000
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    21
	Explosives = 0 -- The number of explosives being placed
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    22
	Delay = 10 -- The delay between each round
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    23
	Map = "Hydrant" -- The map to be played
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    24
	Theme = "City" -- The theme to be used
12229
d62d6f8ebef1 Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents: 12083
diff changeset
    25
d62d6f8ebef1 Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents: 12083
diff changeset
    26
	-- Disable Sudden Death
d62d6f8ebef1 Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents: 12083
diff changeset
    27
	HealthDecrease = 0
d62d6f8ebef1 Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents: 12083
diff changeset
    28
	WaterRise = 0
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    29
12591
7510fe66bfbb Change graves of teams in missions for greater variety
Wuzzy <almikes@aol.com>
parents: 12518
diff changeset
    30
	AddTeam(loc("Bloody Rookies"), 14483456, "deadhog", "Island", "Default", "cm_eyes")
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    31
	player = AddHog(loc("Hunter"), 0, 1, "NoHat")
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    32
			
12591
7510fe66bfbb Change graves of teams in missions for greater variety
Wuzzy <almikes@aol.com>
parents: 12518
diff changeset
    33
	AddTeam(loc("Toxic Team"), 	1175851, "skull", "Island", "Default", "cm_magicskull")
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    34
	enemy = AddHog(loc("Poison"), 1, 100, "Skull")
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    35
7877
b3fb94986255 Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents: 5823
diff changeset
    36
	SetGearPosition(player,430,516)
b3fb94986255 Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents: 5823
diff changeset
    37
	SetGearPosition(enemy,1464,936)
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    38
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    39
end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    40
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    41
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    42
function onGameStart()
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    43
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    44
12938
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12591
diff changeset
    45
	SpawnSupplyCrate(426,886,amJetpack)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12591
diff changeset
    46
	SpawnSupplyCrate(1544,690,amFirePunch)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12591
diff changeset
    47
	SpawnSupplyCrate(950,851,amBlowTorch)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12591
diff changeset
    48
	SpawnSupplyCrate(1032,853,amParachute)
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    49
7877
b3fb94986255 Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents: 5823
diff changeset
    50
	AddGear(579, 296, gtMine, 0, 0, 0, 0)
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    51
12359
5e4ac10a03ce Mention inf attack rule in Diver, also fix the in-game mission name
Wuzzy <almikes@aol.com>
parents: 12231
diff changeset
    52
	ShowMission(loc("Diver"), loc("Scenario"),
5e4ac10a03ce Mention inf attack rule in Diver, also fix the in-game mission name
Wuzzy <almikes@aol.com>
parents: 12231
diff changeset
    53
		loc("Eliminate the enemy before the time runs out.") .. "|" .. 
5e4ac10a03ce Mention inf attack rule in Diver, also fix the in-game mission name
Wuzzy <almikes@aol.com>
parents: 12231
diff changeset
    54
		loc("Unlimited Attacks: Attacks don't end your turn") .. "|" ..
5e4ac10a03ce Mention inf attack rule in Diver, also fix the in-game mission name
Wuzzy <almikes@aol.com>
parents: 12231
diff changeset
    55
		loc("Mines time: 1 second"), -amFirePunch, 0);
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    56
	--SetTag(AddGear(0, 0, gtATSmoothWindCh, 0, 0, 0, 1), -70)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    57
12395
c051ac2544f2 Add note in Diver scenario that jetpack only has 50% fuel
Wuzzy <almikes@aol.com>
parents: 12359
diff changeset
    58
	SetAmmoDescriptionAppendix(amJetpack, string.format(loc("In this mission you get %d%% fuel."), div(jetpackFuel, 20)))
c051ac2544f2 Add note in Diver scenario that jetpack only has 50% fuel
Wuzzy <almikes@aol.com>
parents: 12359
diff changeset
    59
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    60
	SetWind(-100)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    61
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    62
end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    63
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    64
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    65
function onGameTick()
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    66
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    67
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    68
	if (TotalRounds == 3) and (GameOver == false) then
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    69
		SetHealth(player, 0)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    70
		GameOver = true
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    71
	end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    72
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    73
	if TurnTimeLeft == 1 then
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    74
		SetHealth(player, 0)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    75
		GameOver = true
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    76
	end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    77
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    78
end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    79
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    80
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    81
function onAmmoStoreInit()
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    82
	SetAmmo(amFirePunch, 1, 0, 0, 1)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    83
	SetAmmo(amBlowTorch, 0, 0, 0, 1)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    84
	SetAmmo(amGirder, 1, 0, 0, 0)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    85
	SetAmmo(amParachute, 0, 0, 0, 1)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    86
	SetAmmo(amJetpack, 0, 0, 0, 1)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    87
end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    88
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    89
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    90
function onGearAdd(gear)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    91
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    92
	if GetGearType(gear) == gtJetpack then
12395
c051ac2544f2 Add note in Diver scenario that jetpack only has 50% fuel
Wuzzy <almikes@aol.com>
parents: 12359
diff changeset
    93
		SetHealth(gear, jetpackFuel)
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    94
	end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    95
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    96
end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    97
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    98
function onGearDelete(gear)
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
    99
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   100
	if (gear == enemy) and (GameOver == false) then
12359
5e4ac10a03ce Mention inf attack rule in Diver, also fix the in-game mission name
Wuzzy <almikes@aol.com>
parents: 12231
diff changeset
   101
		ShowMission(loc("Diver"), loc("MISSION SUCCESSFUL"), loc("Congratulations!"), 0, 0)
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   102
	elseif gear == player then
12359
5e4ac10a03ce Mention inf attack rule in Diver, also fix the in-game mission name
Wuzzy <almikes@aol.com>
parents: 12231
diff changeset
   103
		ShowMission(loc("Diver"), loc("MISSION FAILED"), loc("Oh no! Just try again!"), -amSkip, 0)		
4662
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   104
		GameOver = true
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   105
	end
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   106
63aafc9c2a81 Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff changeset
   107
end