share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit03.lua
author Periklis Ntanasis <pntanasis@gmail.com>
Thu, 29 Aug 2013 19:50:45 +0300
branchspacecampaign
changeset 9594 749ef5bd0eaf
parent 9593 ac522dd06f00
child 9595 1acc5c3dc066
permissions -rw-r--r--
fixed the time adding in new hero turn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     1
------------------- ABOUT ----------------------
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     2
--
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     3
-- Hero has get into an Red Strawberies ambush
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     4
-- He has to eliminate the enemies by using limited
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     5
-- ammo of sniper rifle and watermelon
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     6
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     7
HedgewarsScriptLoad("/Scripts/Locale.lua")
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     8
HedgewarsScriptLoad("/Scripts/Animate.lua")
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     9
HedgewarsScriptLoad("/Missions/Campaign/A_Space_Adventure/global_functions.lua")
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    10
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    11
----------------- VARIABLES --------------------
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    12
-- globals
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    13
local missionName = loc("Precise shooting")
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    14
local timeLeft = 10000
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    15
local lastWeaponUsed = amSniperRifle
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    16
-- hogs
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    17
local hero = {
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    18
	name = loc("Hog Solo"),
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    19
	x = 1100,
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    20
	y = 560
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    21
}
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    22
local enemiesOdd = {
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    23
	{name = "Hog 1", x = 2000 , y = 175},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    24
	{name = "Hog 3", x = 1950 , y = 1110},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    25
	{name = "Hog 5", x = 1270 , y = 1480},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    26
	{name = "Hog 7", x = 240 , y = 790},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    27
	{name = "Hog 9", x = 620 , y = 1950},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    28
	{name = "Hog 11", x = 720 , y = 1950},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    29
	{name = "Hog 13", x = 1620 , y = 1950},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    30
	{name = "Hog 15", x = 1720 , y = 1950},
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    31
}
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    32
local enemiesEven = {
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    33
	{name = "Hog 2", x = 660, y = 140},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    34
	{name = "Hog 4", x = 1120, y = 1250},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    35
	{name = "Hog 6", x = 1290, y = 1250},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    36
	{name = "Hog 8", x = 820, y = 1950},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    37
	{name = "Hog 10", x = 920, y = 1950},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    38
	{name = "Hog 12", x = 1820, y = 1950},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    39
	{name = "Hog 14", x = 1920, y = 1950},
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    40
	{name = "Hog 16", x = 1200, y = 560},
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    41
}
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    42
-- teams
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    43
local teamA = {
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    44
	name = loc("Hog Solo"),
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    45
	color = tonumber("38D61C",16) -- green
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    46
}
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    47
local teamB = {
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    48
	name = loc("RS1"),
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    49
	color = tonumber("FF0000",16) -- red
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    50
}
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    51
local teamC = {
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    52
	name = loc("RS2"),
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    53
	color = tonumber("FF0000",16) -- red
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    54
}
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    55
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    56
-------------- LuaAPI EVENT HANDLERS ------------------
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    57
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    58
function onGameInit()
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    59
	GameFlags = gfDisableWind + gfInfAttack
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    60
	Seed = 1
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
    61
	TurnTime = 15000
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    62
	CaseFreq = 0
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    63
	MinesNum = 0
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    64
	MinesTime = 1
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    65
	Explosives = 0
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    66
	Map = "fruit03_map"
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    67
	Theme = "Fruit"
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    68
	
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    69
	-- Hog Solo
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    70
	AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy")
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    71
	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    72
	AnimSetGearPosition(hero.gear, hero.x, hero.y)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    73
	-- enemies
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    74
	AddTeam(teamC.name, teamC.color, "Bone", "Island", "HillBilly", "cm_birdy")
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    75
	for i=1,table.getn(enemiesEven) do
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    76
		enemiesEven[i].gear = AddHog(enemiesEven[i].name, 1, 100, "war_desertgrenadier1")
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    77
		AnimSetGearPosition(enemiesEven[i].gear, enemiesEven[i].x, enemiesEven[i].y)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    78
	end	
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    79
	AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_birdy")
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    80
	for i=1,table.getn(enemiesOdd) do
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    81
		enemiesOdd[i].gear = AddHog(enemiesOdd[i].name, 1, 100, "war_desertgrenadier1")
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    82
		AnimSetGearPosition(enemiesOdd[i].gear, enemiesOdd[i].x, enemiesOdd[i].y)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    83
	end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    84
	
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    85
	initCheckpoint("fruit03")
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    86
	
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    87
	AnimInit()
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    88
	--AnimationSetup()
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    89
end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    90
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    91
function onGameStart()
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    92
	AnimWait(hero.gear, 3000)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    93
	FollowGear(hero.gear)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    94
	
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    95
	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    96
	
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    97
	--hero ammo
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    98
	AddAmmo(hero.gear, amTeleport, 2)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    99
	AddAmmo(hero.gear, amSniperRifle, 2)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   100
	AddAmmo(hero.gear, amWatermelon, 2)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   101
	--enemies ammo
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   102
	AddAmmo(enemiesOdd[1].gear, amDEagle, 100)
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   103
	AddAmmo(enemiesOdd[1].gear, amSniperRifle, 100)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   104
	AddAmmo(enemiesOdd[1].gear, amWatermelon, 1)
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   105
	AddAmmo(enemiesOdd[1].gear, amGrenade, 5)
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   106
	AddAmmo(enemiesEven[1].gear, amDEagle, 100)
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   107
	AddAmmo(enemiesEven[1].gear, amSniperRifle, 100)
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   108
	AddAmmo(enemiesEven[1].gear, amWatermelon, 1)
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   109
	AddAmmo(enemiesEven[1].gear, amGrenade, 5)
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   110
	
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   111
	SendHealthStatsOff()
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   112
end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   113
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   114
function onNewTurn()
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   115
	if CurrentHedgehog == hero.gear then
9594
749ef5bd0eaf fixed the time adding in new hero turn
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9593
diff changeset
   116
		if GetAmmoCount(hero.gear, amSkip) == 0 then
749ef5bd0eaf fixed the time adding in new hero turn
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9593
diff changeset
   117
			TurnTimeLeft = TurnTime + timeLeft
749ef5bd0eaf fixed the time adding in new hero turn
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9593
diff changeset
   118
			AddAmmo(hero.gear, amSkip, 1)
749ef5bd0eaf fixed the time adding in new hero turn
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9593
diff changeset
   119
		end
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   120
		timeLeft = 0
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   121
	end
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   122
	turnHogs()
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   123
	WriteLnToConsole("NEW TURN")
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   124
end
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   125
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   126
function onGameTick20()
9594
749ef5bd0eaf fixed the time adding in new hero turn
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9593
diff changeset
   127
	if CurrentHedgehog == hero.gear and TurnTimeLeft ~= 0 then
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   128
		timeLeft = TurnTimeLeft
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   129
	end
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   130
end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   131
9591
b7870f018e5f fixed bug that caused enemy hogs not to play
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9590
diff changeset
   132
function onGearDamage(gear, damage)
b7870f018e5f fixed bug that caused enemy hogs not to play
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9590
diff changeset
   133
	FollowGear(gear)
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   134
	WriteLnToConsole("GEAR DAMAGED")
9591
b7870f018e5f fixed bug that caused enemy hogs not to play
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9590
diff changeset
   135
end
b7870f018e5f fixed bug that caused enemy hogs not to play
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9590
diff changeset
   136
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   137
function onGearDelete(gear)
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   138
	WriteLnToConsole("HERO : "..hero.gear)
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   139
	WriteLnToConsole("GEAR : "..gear)
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   140
	WriteLnToConsole("UPPER BOUND : "..enemiesOdd[table.getn(enemiesOdd)].gear)
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   141
	WriteLnToConsole("UPPER BOUND : "..enemiesEven[table.getn(enemiesEven)].gear)
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   142
	
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   143
	if (gear > hero.gear and gear <= enemiesOdd[table.getn(enemiesOdd)].gear) or 
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   144
			(gear > hero.gear and gear <= enemiesEven[table.getn(enemiesEven)].gear) then
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   145
		WriteLnToConsole("NOT HERO GEAR")
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   146
		local availableTeleports = GetAmmoCount(hero.gear,amTeleport)
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   147
		local availableSniper = GetAmmoCount(hero.gear,amSniperRifle)
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   148
		if availableTeleports < 2 then
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   149
			AddAmmo(hero.gear, amTeleport, availableTeleports + 1 )
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   150
		end
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   151
		if availableSniper < 3 then
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   152
			AddAmmo(hero.gear, amSniperRifle, availableSniper + 1 )
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   153
		end
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   154
	end
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   155
	WriteLnToConsole("GEAR KILLED")
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   156
end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   157
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   158
-------------- EVENTS ------------------
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   159
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   160
function onHeroDeath(gear)
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   161
	if not GetHealth(hero.gear) then
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   162
		return true
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   163
	end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   164
	return false
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   165
end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   166
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   167
-------------- ACTIONS ------------------
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   168
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   169
-- game ends anyway but I want to sent custom stats probably...
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   170
function heroDeath(gear)
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   171
	EndGame()
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   172
end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   173
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   174
------------------ Other Functions -------------------
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   175
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   176
function turnHogs()
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   177
	if GetHealth(hero.gear) then
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   178
		for i=1,table.getn(enemiesEven) do
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   179
			if GetHealth(enemiesEven[i].gear) then
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   180
				if GetX(enemiesEven[i].gear) < GetX(hero.gear) then
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   181
					HogTurnLeft(enemiesEven[i].gear, false)
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   182
				elseif GetX(enemiesEven[i].gear) > GetX(hero.gear) then
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   183
					HogTurnLeft(enemiesEven[i].gear, true)
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   184
				end
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   185
			end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   186
		end
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   187
		for i=1,table.getn(enemiesOdd) do
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   188
			if GetHealth(enemiesOdd[i].gear) then
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   189
				if GetX(enemiesOdd[i].gear) < GetX(hero.gear) then
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   190
					HogTurnLeft(enemiesOdd[i].gear, false)
9593
ac522dd06f00 changed map and fixed some bugs regarding hog turning and adding more teleport
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9592
diff changeset
   191
				elseif GetX(enemiesOdd[i].gear) > GetX(hero.gear) then
9592
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   192
					HogTurnLeft(enemiesOdd[i].gear, true)
a39cb287e83e a bug fix
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9591
diff changeset
   193
				end
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   194
			end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   195
		end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   196
	end
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   197
end