share/hedgewars/Data/Missions/Training/Basic_Training_-_Rope.lua
author Wuzzy <almikes@aol.com>
Fri, 25 Nov 2016 01:20:03 +0100
changeset 12072 10aad1cafc10
parent 12050 daf63e2a21d2
child 12344 877f55c77a3f
permissions -rw-r--r--
Game mode messages: New messages for PlaceHog+King; All messages get a colon to get highlighted; Reorder messages more logically
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
     1
--Created by Patrick Nielsen
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
     2
--It's been so fun to create this, your welcome to contact me at Trivkz@gmail.com
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
     3
--
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
     4
--I've tried to keep the code as clear as possible and with comments.
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
     5
--But as English is not my first language there may be spelling / grammar mistakes.
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
     6
--
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
     7
--I know there need to be more "tutorial" specefic messages, but I had a hard timer figuring out what to type / what would be the best technical description.
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
     8
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
     9
8043
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7838
diff changeset
    10
HedgewarsScriptLoad("/Scripts/Locale.lua")
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7838
diff changeset
    11
HedgewarsScriptLoad("/Scripts/Utils.lua") -- For the gearIsInBox function, wrote my own, but decided it was a waste to include it
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    12
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    13
local Player = nil -- Pointer to hog created in: onGameInit
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    14
local Target = nil -- Pointer to target hog
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    15
local GameLost = false -- You lost the game
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    16
local Objective = false -- Get to the target
12050
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
    17
local RopeMaster = false -- Achievement
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
    18
local StatsSent = false -- Remember whether the stats have been sent already
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    19
12050
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
    20
local WaitTime = 1000 -- Wait 1sec before quit
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    21
local FollowTime = 1500 -- For use with FollowGear
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    22
local FollowingGear = false
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    23
local BaseballIntro = false -- Fail safe for ticker
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    24
local TargetNumber = 0 -- The current target number
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    25
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    26
local TargetPos = {} -- Tabel of targets
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    27
local Timers = {}
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    28
local GetTime = 0
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    29
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    30
TargetPos[ 1 ] = { X = 1100, Y = 1100, Message = loc("Now find the next target! |Tip: Normally you lose health by falling down, so be careful!") }
12050
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
    31
TargetPos[ 2 ] = { X = 1500, Y = 1490, Message = loc("You're getting pretty good! |Tip: When you shorten you rope, you move faster!|And when you lengthen it, you move slower.") }
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    32
TargetPos[ 3 ] = { X = 2200, Y = 800, Message = loc("The next one is pretty hard! |Tip: You have to do multiple swings!") }
12050
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
    33
TargetPos[ 4 ] = { X = 2870, Y = 400, Message = loc("I don't know how you did that .. But good work! |The next one should be easy as cake for you!") }
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    34
TargetPos[ 5 ] = { X = 4000, Y = 1750, Message = "" }
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    35
TargetPos[ 6 ] = { Modifier = true, Func = function() -- Last target is ALWAYS the "winning" target!
12050
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
    36
	Info( loc("Congratulations"), loc("Congratulations! You've completed the Basic Rope Training!"), 0 ) -- Congrats
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
    37
	PlaySound( sndVictory, Player )
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    38
12050
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
    39
	AddCaption( loc( "Victory!" ))
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    40
	if TurnTimeLeft >= 250000 then -- If you very fast, unlock the ahievement "Rope Master!"
12050
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
    41
		RopeMaster = true
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
    42
		AddCaption( loc( "Achievement obtained: Rope Master!" ),0xffba00ff,capgrpAmmoinfo )
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    43
		PlaySound( sndHomerun )
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    44
	end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    45
	Objective = true
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    46
end }
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    47
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    48
function Info( Title, Text, Icon ) -- I made a small wrapper to ease the process
7827
353d90ddc188 Fix bad loc calls in campaign, rope training. Regenerate lua. Untested.
nemo
parents: 7165
diff changeset
    49
	ShowMission( loc("Rope Training"), Title, Text, Icon, 0 )
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    50
end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    51
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    52
function NewFollowGear( Gear )
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    53
	FollowingGear = true
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    54
	FollowGear( Gear )
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    55
end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    56
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    57
function SpawnTarget( PosX, PosY )
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    58
	Target = AddGear( 0, 0, gtTarget, 0, 0, 0, 0 ) -- Create a new target
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    59
	SetGearPosition( Target, PosX, PosY ) -- Set the position of the target
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    60
	NewFollowGear( Target )
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    61
end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    62
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    63
function AutoSpawn() -- Auto spawn the next target after you've killed the current target!
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    64
	TargetNumber = TargetNumber + 1
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    65
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    66
	if TargetPos[ TargetNumber ].Modifier then -- If there is a modifier, run the function, only used in the winning target!
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    67
		TargetPos[ TargetNumber ].Func()
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    68
		return true
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    69
	end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    70
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    71
	if TargetNumber > 1 then
12050
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
    72
		Info(loc("Training"), TargetPos[ TargetNumber - 1 ].Message, -amRope )
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    73
	end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    74
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    75
	SpawnTarget( TargetPos[ TargetNumber ].X, TargetPos[ TargetNumber ].Y ) -- Spawn target on the next position
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    76
end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    77
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    78
function InRange( Gear, PosX, PosY, Distance ) -- Fix as the default function didn't do quite what I needed
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    79
	GearX, GearY = GetGearPosition( Gear )
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    80
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    81
    return GearX >= PosX - Distance and GearX <= PosX + Distance and GearY >= PosY and GearY - Distance <= PosY + Distance
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    82
end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    83
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    84
function CheckPosition( Hog, Distance ) -- Show a message when you get close to the current target!
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    85
	if (not BaseballIntro and not Objective) and (CurrentHedgehog ~= nil) then --Fail safe check
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    86
		if InRange( Hog, 1100, 1100, Distance ) then -- Check if the player is within predefined position of the first target
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    87
			BaseballIntro = true
12050
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
    88
			Info(loc("Training"), loc("Great work! Now hit it with your Baseball Bat! |Tip: You can change weapon with 'Right Click'!"), -amRope ) -- Guide them
7827
353d90ddc188 Fix bad loc calls in campaign, rope training. Regenerate lua. Untested.
nemo
parents: 7165
diff changeset
    89
			Timer( 10000, loc("Remember: The rope only bend around objects, |if it doesn't hit anything it's always stright!"))
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    90
		end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    91
	end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    92
end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    93
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    94
function Timer( Delay, Message )
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    95
	local Timer = {}
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    96
	Timer.End = GetTime + Delay
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    97
	Timer.Message = Message
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    98
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    99
	table.insert( Timers, Timer )
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   100
end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   101
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   102
function onGameInit() -- Called when the game loads
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   103
	Seed = 1 -- The base number for the random number generator
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   104
	GameFlags = gfInfAttack + gfOneClanMode + gfSolidLand + gfInvulnerable + gfBorder -- Game settings and rules, going with a border to make it easier
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   105
	TurnTime = 300000 -- Player can move for 5min each round
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   106
	CaseFreq = 0 -- No random crate drops
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   107
	MinesNum = 0 -- Never place any mines on the map
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   108
	Explosives = 0 -- Never place any explosives
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   109
	Delay = 1 -- We don't wont to wait between each round ( as the only is one )
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   110
	Map = "Ropes" -- Map name
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   111
	Theme = "Nature" -- Map theme
12050
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   112
	-- Disable Sudden Death
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   113
	SuddenDeathTurns = 50
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   114
	WaterRise = 0
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   115
	HealthDecrease = 0
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   116
12049
030464f34d47 Tweak flags used in all missions to fit more to the theme
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   117
	AddTeam( loc( "Rope Team" ), 14483456, "Simple", "Island", "Default", "cm_shoppa" ) -- Lets make the team
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   118
	Player = AddHog( loc( "Hunter" ), 0, 1, "StrawHat" ) -- Add a hog for it, and name it "Hunter"
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   119
	SetGearPosition( Player, 420, 1750 ) -- Set player position
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   120
7838
5c2337f8dbb2 Issue #443 - change in syntax for effects
nemo
parents: 7827
diff changeset
   121
	SetEffect( Player, heResurrectable, 1 ) -- By Suggestion :)
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   122
end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   123
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   124
function onGameStart() -- Called when the game starts
12050
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   125
	SendHealthStatsOff()
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   126
	AutoSpawn() -- Spawn our 1st target using the wrapper function
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   127
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   128
	SetHealth( Player, 100 ) -- Give the player 100 Health points
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   129
12050
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   130
	PlaceGirder(46,1783, 0) -- Place a girder to prevent the player falling into the water
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   131
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   132
	local message = loc("Get to the target using your rope!") .. "|" .. loc("Controls: Hold the Attack key (space by default) to|fire the rope, then, once attached use:|Left and Right to swing the rope;|Up and Down to contract and expand.")
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   133
	Info(loc("Training"), message, -amRope ) -- Short intro to tell the player what to do
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   134
	Timer( 10000, message .. "|" .. loc("Tip: The rope physics are different than in the real world, |use it to your advantage!") ) -- After 15 sec, give them more help
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   135
end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   136
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   137
function onNewTurn()
10290
42efccba0711 lua api: DismissTeam(teamname)
sheepluva
parents: 8043
diff changeset
   138
	SetWeapon(amRope) -- Set the default weapon to Rope
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   139
end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   140
7165
aad1aea05f1e add onGameTick20 to basic training, extend laser sight out way more (it was visible at top when completely zoomed out), move call of new turn to after AfterSwitchHedgehog to avoid lua issues in onNewTurn - if this causes problems, lua can do delayed actions in onGameTick
nemo
parents: 6501
diff changeset
   141
function onGameTick20()
aad1aea05f1e add onGameTick20 to basic training, extend laser sight out way more (it was visible at top when completely zoomed out), move call of new turn to after AfterSwitchHedgehog to avoid lua issues in onNewTurn - if this causes problems, lua can do delayed actions in onGameTick
nemo
parents: 6501
diff changeset
   142
	if TurnTimeLeft < 40 and TurnTimeLeft > 0 then -- Round starts at 0, so we check if the round is finished by using 1
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   143
		GameLost = true -- You lost the game
12050
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   144
		Info(loc("Training"), loc("You did not make it in time, try again!"), -amSkip )
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   145
		if not StatsSent then
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   146
			SendStat(siGameResult, loc("You failed!"))
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   147
			SendStat(siCustomAchievement, loc("You did not make it in time, try again!"))
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   148
			StatsSent = true
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   149
		end
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   150
		SetHealth( Player, 0 ) -- Kill the player so he can't keep moving!
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   151
7838
5c2337f8dbb2 Issue #443 - change in syntax for effects
nemo
parents: 7827
diff changeset
   152
		SetEffect( Player, heResurrectable, 0 )
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   153
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   154
	end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   155
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   156
	-- If the player gets to the last target, they win OR
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   157
	-- If round is finished and your not at the target you lose
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   158
	-- in either case, end the game
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   159
	if (Objective == true) or (GameLost == true) then
12050
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   160
		if (WaitTime == 0 and not StatsSent) then
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   161
			SendStat(siGameResult, loc("You have finished the Basic Rope Training!"))
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   162
			SendStat(siCustomAchievement, loc("Good job!"))
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   163
			SendStat(siPlayerKills, "0", loc("Rope Team"))
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   164
			if RopeMaster then
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   165
				SendStat(siCustomAchievement, loc("You earned the \"Rope Master\" achievement for finishing in under 50 seconds."))
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   166
			end
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   167
			StatsSent = true
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   168
			EndGame()
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   169
		else
7165
aad1aea05f1e add onGameTick20 to basic training, extend laser sight out way more (it was visible at top when completely zoomed out), move call of new turn to after AfterSwitchHedgehog to avoid lua issues in onNewTurn - if this causes problems, lua can do delayed actions in onGameTick
nemo
parents: 6501
diff changeset
   170
			WaitTime = WaitTime - 20
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   171
		end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   172
	end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   173
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   174
	if FollowingGear == true then
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   175
		if FollowTime == 0 then
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   176
			FollowingGear = false
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   177
			FollowTime = 1500
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   178
			FollowGear( Player )
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   179
		else
7165
aad1aea05f1e add onGameTick20 to basic training, extend laser sight out way more (it was visible at top when completely zoomed out), move call of new turn to after AfterSwitchHedgehog to avoid lua issues in onNewTurn - if this causes problems, lua can do delayed actions in onGameTick
nemo
parents: 6501
diff changeset
   180
			FollowTime = FollowTime - 20
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   181
		end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   182
	end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   183
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   184
	for k, v in pairs( Timers ) do
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   185
		if v.End <= GetTime then
12050
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   186
			Info(loc("Training"), v.Message, -amRope )
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   187
			Timers[ k ] = nil
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   188
		end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   189
	end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   190
7165
aad1aea05f1e add onGameTick20 to basic training, extend laser sight out way more (it was visible at top when completely zoomed out), move call of new turn to after AfterSwitchHedgehog to avoid lua issues in onNewTurn - if this causes problems, lua can do delayed actions in onGameTick
nemo
parents: 6501
diff changeset
   191
	GetTime = GetTime + 20
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   192
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   193
	CheckPosition( Player, 70 ) -- Run the CheckPosition function to check if the player is close to a target
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   194
end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   195
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   196
function onAmmoStoreInit()
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   197
	SetAmmo( amRope, 9, 2, 0, 0 ) -- Player ammo, Rope
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   198
	SetAmmo( amBaseballBat, 9, 2, 0, 0 ) --Baseball bat
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   199
end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   200
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   201
function onGearDelete( Gear )
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   202
	if GetGearType( Gear ) == gtTarget then
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   203
		AutoSpawn() -- When a target is deleted / destroyed, spawn a new one!
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   204
	end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   205
end