--- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Rope.lua Wed Nov 23 23:54:55 2016 +0100
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Rope.lua Thu Nov 24 00:20:41 2016 +0100
@@ -14,8 +14,10 @@
local Target = nil -- Pointer to target hog
local GameLost = false -- You lost the game
local Objective = false -- Get to the target
+local RopeMaster = false -- Achievement
+local StatsSent = false -- Remember whether the stats have been sent already
-local WaitTime = 10000 -- Wait 10sec before quit
+local WaitTime = 1000 -- Wait 1sec before quit
local FollowTime = 1500 -- For use with FollowGear
local FollowingGear = false
local BaseballIntro = false -- Fail safe for ticker
@@ -26,20 +28,20 @@
local GetTime = 0
TargetPos[ 1 ] = { X = 1100, Y = 1100, Message = loc("Now find the next target! |Tip: Normally you lose health by falling down, so be careful!") }
-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") }
+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.") }
TargetPos[ 3 ] = { X = 2200, Y = 800, Message = loc("The next one is pretty hard! |Tip: You have to do multiple swings!") }
-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!") }
+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!") }
TargetPos[ 5 ] = { X = 4000, Y = 1750, Message = "" }
TargetPos[ 6 ] = { Modifier = true, Func = function() -- Last target is ALWAYS the "winning" target!
- Info( loc("Congratulations"), loc("Congratulations! You've completed the Rope tutorial! |- Tutorial ends in 10 seconds!"), 0 ) -- Congrats
- HogSay( Player, loc("Victory!"), SAY_SHOUT) -- You win!
- PlaySound( sndVictory )
+ Info( loc("Congratulations"), loc("Congratulations! You've completed the Basic Rope Training!"), 0 ) -- Congrats
+ PlaySound( sndVictory, Player )
+ AddCaption( loc( "Victory!" ))
if TurnTimeLeft >= 250000 then -- If you very fast, unlock the ahievement "Rope Master!"
- AddCaption( loc( "Achievement Unlocked" ) .. ": " .. loc( "Rope Master!" ),0xffba00ff,capgrpAmmoinfo )
+ RopeMaster = true
+ AddCaption( loc( "Achievement obtained: Rope Master!" ),0xffba00ff,capgrpAmmoinfo )
PlaySound( sndHomerun )
end
-
Objective = true
end }
@@ -67,7 +69,7 @@
end
if TargetNumber > 1 then
- Info(loc("Aiming Practice"), TargetPos[ TargetNumber - 1 ].Message, -amRope )
+ Info(loc("Training"), TargetPos[ TargetNumber - 1 ].Message, -amRope )
end
SpawnTarget( TargetPos[ TargetNumber ].X, TargetPos[ TargetNumber ].Y ) -- Spawn target on the next position
@@ -83,7 +85,7 @@
if (not BaseballIntro and not Objective) and (CurrentHedgehog ~= nil) then --Fail safe check
if InRange( Hog, 1100, 1100, Distance ) then -- Check if the player is within predefined position of the first target
BaseballIntro = true
- Info(loc("Aiming Practice"), loc("Great work! Now hit it with your Baseball Bat! |Tip: You can change weapon with 'Right Click'!"), -amRope ) -- Guide them
+ Info(loc("Training"), loc("Great work! Now hit it with your Baseball Bat! |Tip: You can change weapon with 'Right Click'!"), -amRope ) -- Guide them
Timer( 10000, loc("Remember: The rope only bend around objects, |if it doesn't hit anything it's always stright!"))
end
end
@@ -107,6 +109,10 @@
Delay = 1 -- We don't wont to wait between each round ( as the only is one )
Map = "Ropes" -- Map name
Theme = "Nature" -- Map theme
+ -- Disable Sudden Death
+ SuddenDeathTurns = 50
+ WaterRise = 0
+ HealthDecrease = 0
AddTeam( loc( "Rope Team" ), 14483456, "Simple", "Island", "Default", "cm_shoppa" ) -- Lets make the team
Player = AddHog( loc( "Hunter" ), 0, 1, "StrawHat" ) -- Add a hog for it, and name it "Hunter"
@@ -116,12 +122,16 @@
end
function onGameStart() -- Called when the game starts
+ SendHealthStatsOff()
AutoSpawn() -- Spawn our 1st target using the wrapper function
SetHealth( Player, 100 ) -- Give the player 100 Health points
- Info(loc("Aiming Practice"), loc("Get to the target using your rope! |Controls: Left & Right to swing the rope - Up & Down to Contract and Expand!"), -amRope ) -- Short intro to tell the player what to do
- Timer( 10000, loc("Tip: The rope physics are different than in the real world, |use it to your advantage!") ) -- After 15 sec, give them more help
+ PlaceGirder(46,1783, 0) -- Place a girder to prevent the player falling into the water
+
+ 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.")
+ Info(loc("Training"), message, -amRope ) -- Short intro to tell the player what to do
+ 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
end
function onNewTurn()
@@ -131,7 +141,12 @@
function onGameTick20()
if TurnTimeLeft < 40 and TurnTimeLeft > 0 then -- Round starts at 0, so we check if the round is finished by using 1
GameLost = true -- You lost the game
- Info(loc("Aiming Practice"), loc("You did not make it in time, try again!"), -amSkip )
+ Info(loc("Training"), loc("You did not make it in time, try again!"), -amSkip )
+ if not StatsSent then
+ SendStat(siGameResult, loc("You failed!"))
+ SendStat(siCustomAchievement, loc("You did not make it in time, try again!"))
+ StatsSent = true
+ end
SetHealth( Player, 0 ) -- Kill the player so he can't keep moving!
SetEffect( Player, heResurrectable, 0 )
@@ -142,14 +157,15 @@
-- If round is finished and your not at the target you lose
-- in either case, end the game
if (Objective == true) or (GameLost == true) then
- if (WaitTime == 0) then
- DismissTeam(loc( "Rope Team" ))
-
- --SetHealth( Player, 0 ) -- Kill the player so he can't keep moving!
- --SetEffect( Player, heResurrectable, 0 )
- TurnTimeLeft = 1
-
- WaitTime = -1
+ if (WaitTime == 0 and not StatsSent) then
+ SendStat(siGameResult, loc("You have finished the Basic Rope Training!"))
+ SendStat(siCustomAchievement, loc("Good job!"))
+ SendStat(siPlayerKills, "0", loc("Rope Team"))
+ if RopeMaster then
+ SendStat(siCustomAchievement, loc("You earned the \"Rope Master\" achievement for finishing in under 50 seconds."))
+ end
+ StatsSent = true
+ EndGame()
else
WaitTime = WaitTime - 20
end
@@ -167,7 +183,7 @@
for k, v in pairs( Timers ) do
if v.End <= GetTime then
- Info(loc("Aiming Practice"), v.Message, -amRope )
+ Info(loc("Training"), v.Message, -amRope )
Timers[ k ] = nil
end
end
@@ -182,16 +198,6 @@
SetAmmo( amBaseballBat, 9, 2, 0, 0 ) --Baseball bat
end
-function onGearResurrect( Gear )
- if TargetNumber > 1 then
- SetGearPosition( Player, TargetPos[ TargetNumber - 1 ].X, TargetPos[ TargetNumber - 1 ].Y ) -- If the player dies spawn him where he last killed a target
- Info(loc("Aiming Practice"), loc("You have been respawned, at your last checkpoint!"), -amRope )
- else
- SetGearPosition( Player, 420, 1750 ) -- If the player dies and didn't kill a target just spawn him at the default spawn
- Info(loc("Aiming Practice"), loc("You have been respawned, be more carefull next time!"), -amRope )
- end
-end
-
function onGearDelete( Gear )
if GetGearType( Gear ) == gtTarget then
AutoSpawn() -- When a target is deleted / destroyed, spawn a new one!