29 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") } |
29 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") } |
30 TargetPos[ 3 ] = { X = 2200, Y = 800, Message = loc("The next one is pretty hard! |Tip: You have to do multiple swings!") } |
30 TargetPos[ 3 ] = { X = 2200, Y = 800, Message = loc("The next one is pretty hard! |Tip: You have to do multiple swings!") } |
31 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!") } |
31 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!") } |
32 TargetPos[ 5 ] = { X = 4000, Y = 1750, Message = "" } |
32 TargetPos[ 5 ] = { X = 4000, Y = 1750, Message = "" } |
33 TargetPos[ 6 ] = { Modifier = true, Func = function() -- Last target is ALWAYS the "winning" target! |
33 TargetPos[ 6 ] = { Modifier = true, Func = function() -- Last target is ALWAYS the "winning" target! |
34 Info( "Congratulations", "Congratulations! You've completed the Rope tutorial! |- Tutorial ends in 10 seconds!", 0 ) -- Congrats |
34 Info( loc("Congratulations"), loc("Congratulations! You've completed the Rope tutorial! |- Tutorial ends in 10 seconds!"), 0 ) -- Congrats |
35 HogSay( Player, loc("Victory!"), SAY_SHOUT) -- You win! |
35 HogSay( Player, loc("Victory!"), SAY_SHOUT) -- You win! |
36 PlaySound( sndVictory ) |
36 PlaySound( sndVictory ) |
37 |
37 |
38 if TurnTimeLeft >= 250000 then -- If you very fast, unlock the ahievement "Rope Master!" |
38 if TurnTimeLeft >= 250000 then -- If you very fast, unlock the ahievement "Rope Master!" |
39 AddCaption( loc( "Achievement Unlocked" ) .. ": " .. loc( "Rope Master!" ),0xffba00ff,capgrpAmmoinfo ) |
39 AddCaption( loc( "Achievement Unlocked" ) .. ": " .. loc( "Rope Master!" ),0xffba00ff,capgrpAmmoinfo ) |
42 |
42 |
43 Objective = true |
43 Objective = true |
44 end } |
44 end } |
45 |
45 |
46 function Info( Title, Text, Icon ) -- I made a small wrapper to ease the process |
46 function Info( Title, Text, Icon ) -- I made a small wrapper to ease the process |
47 ShowMission( loc("Rope Training"), loc(Title), loc( Text ), Icon, 0 ) |
47 ShowMission( loc("Rope Training"), Title, Text, Icon, 0 ) |
48 end |
48 end |
49 |
49 |
50 function NewFollowGear( Gear ) |
50 function NewFollowGear( Gear ) |
51 FollowingGear = true |
51 FollowingGear = true |
52 FollowGear( Gear ) |
52 FollowGear( Gear ) |
65 TargetPos[ TargetNumber ].Func() |
65 TargetPos[ TargetNumber ].Func() |
66 return true |
66 return true |
67 end |
67 end |
68 |
68 |
69 if TargetNumber > 1 then |
69 if TargetNumber > 1 then |
70 Info( "Aiming Practice", TargetPos[ TargetNumber - 1 ].Message, -amRope ) |
70 Info(loc("Aiming Practice"), TargetPos[ TargetNumber - 1 ].Message, -amRope ) |
71 end |
71 end |
72 |
72 |
73 SpawnTarget( TargetPos[ TargetNumber ].X, TargetPos[ TargetNumber ].Y ) -- Spawn target on the next position |
73 SpawnTarget( TargetPos[ TargetNumber ].X, TargetPos[ TargetNumber ].Y ) -- Spawn target on the next position |
74 end |
74 end |
75 |
75 |
81 |
81 |
82 function CheckPosition( Hog, Distance ) -- Show a message when you get close to the current target! |
82 function CheckPosition( Hog, Distance ) -- Show a message when you get close to the current target! |
83 if (not BaseballIntro and not Objective) and (CurrentHedgehog ~= nil) then --Fail safe check |
83 if (not BaseballIntro and not Objective) and (CurrentHedgehog ~= nil) then --Fail safe check |
84 if InRange( Hog, 1100, 1100, Distance ) then -- Check if the player is within predefined position of the first target |
84 if InRange( Hog, 1100, 1100, Distance ) then -- Check if the player is within predefined position of the first target |
85 BaseballIntro = true |
85 BaseballIntro = true |
86 Info( "Aiming Practice", "Great work! Now hit it with your Baseball Bat! |Tip: You can change weapon with 'Right Click'!", -amRope ) -- Guide them |
86 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 |
87 Timer( 10000, "Remember: The rope only bend around objects, |if it doesn't hit anything it's always stright!" ) |
87 Timer( 10000, loc("Remember: The rope only bend around objects, |if it doesn't hit anything it's always stright!")) |
88 end |
88 end |
89 end |
89 end |
90 end |
90 end |
91 |
91 |
92 function Timer( Delay, Message ) |
92 function Timer( Delay, Message ) |
118 function onGameStart() -- Called when the game starts |
118 function onGameStart() -- Called when the game starts |
119 AutoSpawn() -- Spawn our 1st target using the wrapper function |
119 AutoSpawn() -- Spawn our 1st target using the wrapper function |
120 |
120 |
121 SetHealth( Player, 100 ) -- Give the player 100 Health points |
121 SetHealth( Player, 100 ) -- Give the player 100 Health points |
122 |
122 |
123 Info( "Aiming Practice", "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 |
123 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 |
124 Timer( 10000, "Tip: The rope physics are different than in the real world, |use it to your advantage!" ) -- After 15 sec, give them more help |
124 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 |
125 end |
125 end |
126 |
126 |
127 function onNewTurn() |
127 function onNewTurn() |
128 ParseCommand( "setweap " .. string.char( amRope ) ) -- Set the default weapon to Rope |
128 ParseCommand( "setweap " .. string.char( amRope ) ) -- Set the default weapon to Rope |
129 end |
129 end |
130 |
130 |
131 function onGameTick20() |
131 function onGameTick20() |
132 if TurnTimeLeft < 40 and TurnTimeLeft > 0 then -- Round starts at 0, so we check if the round is finished by using 1 |
132 if TurnTimeLeft < 40 and TurnTimeLeft > 0 then -- Round starts at 0, so we check if the round is finished by using 1 |
133 GameLost = true -- You lost the game |
133 GameLost = true -- You lost the game |
134 Info( "Aiming Practice", "You did not make it in time, try again!", -amSkip ) |
134 Info(loc("Aiming Practice"), loc("You did not make it in time, try again!"), -amSkip ) |
135 SetHealth( Player, 0 ) -- Kill the player so he can't keep moving! |
135 SetHealth( Player, 0 ) -- Kill the player so he can't keep moving! |
136 |
136 |
137 SetEffect( Player, heResurrectable, false ) |
137 SetEffect( Player, heResurrectable, false ) |
138 |
138 |
139 end |
139 end |
165 end |
165 end |
166 end |
166 end |
167 |
167 |
168 for k, v in pairs( Timers ) do |
168 for k, v in pairs( Timers ) do |
169 if v.End <= GetTime then |
169 if v.End <= GetTime then |
170 Info( "Aiming Practice", v.Message, -amRope ) |
170 Info(loc("Aiming Practice"), v.Message, -amRope ) |
171 Timers[ k ] = nil |
171 Timers[ k ] = nil |
172 end |
172 end |
173 end |
173 end |
174 |
174 |
175 GetTime = GetTime + 20 |
175 GetTime = GetTime + 20 |
183 end |
183 end |
184 |
184 |
185 function onGearResurrect( Gear ) |
185 function onGearResurrect( Gear ) |
186 if TargetNumber > 1 then |
186 if TargetNumber > 1 then |
187 SetGearPosition( Player, TargetPos[ TargetNumber - 1 ].X, TargetPos[ TargetNumber - 1 ].Y ) -- If the player dies spawn him where he last killed a target |
187 SetGearPosition( Player, TargetPos[ TargetNumber - 1 ].X, TargetPos[ TargetNumber - 1 ].Y ) -- If the player dies spawn him where he last killed a target |
188 Info( "Aiming Practice", "You have been respawned, at your last checkpoint!", -amRope ) |
188 Info(loc("Aiming Practice"), loc("You have been respawned, at your last checkpoint!"), -amRope ) |
189 else |
189 else |
190 SetGearPosition( Player, 420, 1750 ) -- If the player dies and didn't kill a target just spawn him at the default spawn |
190 SetGearPosition( Player, 420, 1750 ) -- If the player dies and didn't kill a target just spawn him at the default spawn |
191 Info( "Aiming Practice", "You have been respawned, be more carefull next time!", -amRope ) |
191 Info(loc("Aiming Practice"), loc("You have been respawned, be more carefull next time!"), -amRope ) |
192 end |
192 end |
193 end |
193 end |
194 |
194 |
195 function onGearDelete( Gear ) |
195 function onGearDelete( Gear ) |
196 if GetGearType( Gear ) == gtTarget then |
196 if GetGearType( Gear ) == gtTarget then |