Binary file share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Grenade.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Grenade@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_RCPlane_Challenge.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_RCPlane_Challenge@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Rope_Knock_Challenge.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Rope_Knock_Challenge@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_The_Great_Escape.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_The_Great_Escape@2x.png has changed
--- a/share/hedgewars/Data/Locale/missions_en.txt Sun May 20 01:00:00 2012 -0400
+++ b/share/hedgewars/Data/Locale/missions_en.txt Sun May 20 10:54:52 2012 +0200
@@ -1,38 +1,47 @@
-Basic_Training_-_Bazooka.name=Basic Bazooka Training
-Basic_Training_-_Bazooka.desc="Using the wind to your advantage is key!"
-
-Basic_Training_-_Grenade.name=Basic Grenade Training
-Basic_Training_-_Grenade.desc="Remember, you pull the pin out AND throw!"
-
-Basic_Training_-_Cluster_Bomb.name=Basic Cluster Bomb Training
-Basic_Training_-_Cluster_Bomb.desc="Someone needs hot shower!"
-
-Basic_Training_-_Shotgun.name=Basic Shotgun Training
-Basic_Training_-_Shotgun.desc="Shoot first, ask questions later!"
-
-Basic_Training_-_Sniper_Rifle.name=Basic Sniper Rifle Training
-Basic_Training_-_Sniper_Rifle.desc="Boom, headshot!"
-
-Basic_Training_-_Rope.name=Basic Rope Training
-Basic_Training_-_Rope.desc="Get out there and swing!"
-
-User_Mission_-_Dangerous_Ducklings.name=Mission: Dangerous Ducklings
-User_Mission_-_Dangerous_Ducklings.desc="Alright, rookie! Time to put what we learned in Basic Training into practice!"
-
-User_Mission_-_Diver.name=Mission: Diver
-User_Mission_-_Diver.desc="This 'amphibious assault' thing is harder than it looks..."
-
-User_Mission_-_Teamwork.name=Mission: Teamwork
-User_Mission_-_Teamwork.desc="Sometimes, love hurts."
-
-User_Mission_-_Spooky_Tree.name=Mission: Spooky Tree
-User_Mission_-_Spooky_Tree.desc="Lots of crates out here. I sure hope that bird ain't feeling hungry."
-
-User_Mission_-_Bamboo_Thicket.name=Mission: Bamboo Thicket
-User_Mission_-_Bamboo_Thicket.desc="Death comes from above."
-
-User_Mission_-_That_Sinking_Feeling.name=Mission: That Sinking Feeling
-User_Mission_-_That_Sinking_Feeling.desc="The water is rising rapidly and time is limited. Many have tried and failed. Can you save them all?"
-
-User_Mission_-_Newton_and_the_Hammock.name=Mission: Newton and the Hammock
-User_Mission_-_Newton_and_the_Hammock.desc="Remember hoglets: The velocity of a body remains constant unless the body is acted upon by an external force!"
+Basic_Training_-_Bazooka.name=Basic Bazooka Training
+Basic_Training_-_Bazooka.desc="Using the wind to your advantage is key!"
+
+Basic_Training_-_Grenade.name=Basic Grenade Training
+Basic_Training_-_Grenade.desc="Remember, you pull the pin out AND throw!"
+
+Basic_Training_-_Cluster_Bomb.name=Basic Cluster Bomb Training
+Basic_Training_-_Cluster_Bomb.desc="Someone needs hot shower!"
+
+Basic_Training_-_Shotgun.name=Basic Shotgun Training
+Basic_Training_-_Shotgun.desc="Shoot first, ask questions later!"
+
+Basic_Training_-_Sniper_Rifle.name=Basic Sniper Rifle Training
+Basic_Training_-_Sniper_Rifle.desc="Boom, headshot!"
+
+Basic_Training_-_Rope.name=Basic Rope Training
+Basic_Training_-_Rope.desc="Get out there and swing!"
+
+User_Mission_-_Dangerous_Ducklings.name=Mission: Dangerous Ducklings
+User_Mission_-_Dangerous_Ducklings.desc="Alright, rookie! Time to put what we learned in Basic Training into practice!"
+
+User_Mission_-_Diver.name=Mission: Diver
+User_Mission_-_Diver.desc="This 'amphibious assault' thing is harder than it looks..."
+
+User_Mission_-_Teamwork.name=Mission: Teamwork
+User_Mission_-_Teamwork.desc="Sometimes, love hurts."
+
+User_Mission_-_Spooky_Tree.name=Mission: Spooky Tree
+User_Mission_-_Spooky_Tree.desc="Lots of crates out here. I sure hope that bird ain't feeling hungry."
+
+User_Mission_-_Bamboo_Thicket.name=Mission: Bamboo Thicket
+User_Mission_-_Bamboo_Thicket.desc="Death comes from above."
+
+User_Mission_-_That_Sinking_Feeling.name=Mission: That Sinking Feeling
+User_Mission_-_That_Sinking_Feeling.desc="The water is rising rapidly and time is limited. Many have tried and failed. Can you save them all?"
+
+User_Mission_-_Newton_and_the_Hammock.name=Mission: Newton and the Hammock
+User_Mission_-_Newton_and_the_Hammock.desc="Remember hoglets: The velocity of a body remains constant unless the body is acted upon by an external force!"
+
+User_Mission_-_The_Great_Escape.name=Mission: The Great Escape
+User_Mission_-_The_Great_Escape.desc="You think you can cage me!?"
+
+User_Mission_-_Rope_Knock_Challenge.name=Challenge: Rope Knocking
+User_Mission_-_Rope_Knock_Challenge.desc="Look behind you!"
+
+User_Mission_-_RCPlane_Challenge.name=Challenge: RC Plane
+User_Mission_-_RCPlane_Challenge.desc="Feeling pretty confident, eh, flyboy?"
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Grenade.lua Sun May 20 10:54:52 2012 +0200
@@ -0,0 +1,190 @@
+-- Hedgewars Grenade Training
+-- Scripting Example
+
+-- Lines such as this one are comments - they are ignored
+-- by the game, no matter what kind of text is in there.
+-- It's also possible to place a comment after some real
+-- instruction as you see below. In short, everything
+-- following "--" is ignored.
+
+---------------------------------------------------------------
+-- At first we implement the localization library using loadfile.
+-- This allows us to localize strings without needing to think
+-- about translations.
+-- We can use the function loc(text) to localize a string.
+
+loadfile(GetDataPath() .. "Scripts/Locale.lua")()
+
+-- This variable will hold the number of destroyed targets.
+local score = 0
+-- This variable represents the number of targets to destroy.
+local score_goal = 5
+-- This variable controls how many milliseconds/ticks we'd
+-- like to wait before we end the round once all targets
+-- have been destroyed.
+local end_timer = 4000 -- 5000 ms = 5 s
+-- This variable is set to true if the game is lost (i.e.
+-- time runs out).
+local game_lost = false
+-- This variable ensures that the death function isn't called
+-- repeatedly when game is over.
+local team_death = false
+-- This variable will point to the hog's gear
+local player = nil
+-- This variable will grab the time left at the end of the round
+local time_goal = 0
+
+-- This is a custom function to make it easier to
+-- spawn more targets with just one line of code
+-- You may define as many custom functions as you
+-- like.
+function spawnTarget()
+ -- add a new target gear
+ gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0)
+
+ -- move it to a random position within 0 and
+ -- LAND_WIDTH - the width of the map
+ FindPlace(gear, true, 0, LAND_WIDTH-1350)
+
+ -- move the target to a higher vertical position
+ -- to ensure it's not somewhere down below
+ x, y = GetGearPosition(gear)
+ SetGearPosition(gear, x, 500)
+end
+
+-- This function is called before the game loads its
+-- resources.
+-- It's one of the predefined function names that will
+-- be called by the game. They give you entry points
+-- where you're able to call your own code using either
+-- provided instructions or custom functions.
+function onGameInit()
+ -- At first we have to overwrite/set some global variables
+ -- that define the map, the game has to load, as well as
+ -- other things such as the game rules to use, etc.
+ -- Things we don't modify here will use their default values.
+
+ -- The base number for the random number generator
+ Seed = 1
+ -- Game settings and rules
+ GameFlags = gfInfAttack + gfOneClanMode
+ -- The time the player has to move each round (in ms)
+ TurnTime = 60000
+ -- The frequency of crate drops
+ CaseFreq = 0
+ -- The number of mines being placed
+ MinesNum = 0
+ -- The number of explosives being placed
+ Explosives = 0
+ -- The delay between each round
+ Delay = 1
+ -- The map to be played
+ Map = "Battlefield"
+ -- The theme to be used
+ Theme = "Castle"
+
+ -- Create the player team
+ AddTeam(loc("Grenadiers"), 14483456, "Simple", "Island", "Default")
+ -- And add a hog to it
+ player = AddHog(loc("Nade Boy"), 0, 1, "war_grenadier1")
+ SetGearPosition(player, 1530, 1100)
+end
+
+-- This function is called when the round starts
+-- it spawns the first target that has to be destroyed.
+-- In addition it shows the scenario goal(s).
+function onGameStart()
+ -- Spawn the first target.
+ spawnTarget()
+
+ -- Show some nice mission goals.
+ -- Parameters are: caption, sub caption, description,
+ -- extra text, icon and time to show.
+ -- A negative icon parameter (-n) represents the n-th weapon icon
+ -- A positive icon paramter (n) represents the (n+1)-th mission icon
+ -- A timeframe of 0 is replaced with the default time to show.
+ ShowMission(loc("Grenade Training"), loc("Aiming Practice"), loc("Eliminate all targets before your time runs out.|You have unlimited ammo for this mission."), -amGrenade, 0)
+end
+
+function onNewTurn()
+ ParseCommand("setweap " .. string.char(amGrenade))
+end
+
+-- This function is called every game tick.
+-- Note that there are 1000 ticks within one second.
+-- You shouldn't try to calculate too complicated
+-- code here as this might slow down your game.
+function onGameTick()
+ -- If time's up, set the game to be lost.
+ -- We actually check the time to be "1 ms" as it
+ -- will be at "0 ms" right at the start of the game.
+ if TurnTimeLeft == 1 and score < score_goal then
+ game_lost = true
+ -- ... and show a short message.
+ ShowMission(loc("Grenade Training"), loc("Aiming Practice"), loc("Oh no! Time's up! Just try again."), -amSkip, 0)
+ -- How about killing our poor hog due to his poor performance?
+ SetHealth(player, 0)
+ -- Just to be sure set the goal time to 1 ms
+ time_goal = 1
+ end
+ -- If the goal is reached or we've lost ...
+ if score == score_goal or game_lost then
+ -- ... check to see if the time we'd like to
+ -- wait has passed and then ...
+ if end_timer == 0 then
+ -- Override the 'Draw' message with the appropriate message.
+ if game_lost then
+ AddCaption("Mission lost!", 0xffba00ff,capgrpGameState)
+ else
+ AddCaption("Mission won!", 0xffba00ff,capgrpGameState)
+ end
+ -- Remove the team to end the game. Only do this once.
+ if team_death == false then
+ team_death = true
+ ParseCommand("teamgone " .. "Grenadiers")
+ end
+ else
+ -- ... or just lower the timer by 1.
+ end_timer = end_timer - 1
+ -- Reset the time left to stop the timer
+ TurnTimeLeft = time_goal
+ end
+ end
+end
+
+-- This function is called when the game is initialized
+-- to request the available ammo and probabilities
+function onAmmoStoreInit()
+ -- add an unlimited supply of bazooka ammo
+ SetAmmo(amGrenade, 9, 0, 0, 0)
+end
+
+-- This function is called when a new gear is added.
+-- We don't need it for this training, so we can
+-- keep it empty.
+function onGearAdd(gear)
+end
+
+-- This function is called before a gear is destroyed.
+-- We use it to count the number of targets destroyed.
+function onGearDelete(gear)
+ -- We're only interested in target gears.
+ if GetGearType(gear) == gtTarget then
+ -- Add one point to our score/counter
+ score = score + 1
+ -- If we haven't reached the goal ...
+ if score < score_goal then
+ -- ... spawn another target.
+ spawnTarget()
+ else
+ if not game_lost then
+ -- Otherwise show that the goal was accomplished
+ ShowMission(loc("Grenade Training"), loc("Aiming Practice"), loc("Congratulations! You've eliminated all targets|within the allowed time frame."), 0, 0)
+ -- Also let the hogs shout "victory!"
+ PlaySound(sndVictory)
+ -- Save the time left so we may keep it.
+ time_goal = TurnTimeLeft
+ end
+ end
+ end
+end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Missions/Training/User_Mission_-_RCPlane_Challenge.lua Sun May 20 10:54:52 2012 +0200
@@ -0,0 +1,338 @@
+loadfile(GetDataPath() .. "Scripts/Locale.lua")()
+
+local player = nil
+local RCGear = nil
+local planesUsed = 0
+local cratesLeft = 0
+
+function onGameInit()
+
+ Seed = 1
+ GameFlags = gfInfAttack + gfInvulnerable + gfOneClanMode + gfSolidLand
+
+ TurnTime = 90 * 1000
+
+ Map = "Ropes"
+ Theme = "Eyes"
+
+ CaseFreq = 0
+ MinesNum = 0
+ Explosives = 0
+
+ AddTeam(loc("Wannabe Flyboys"), 14483456, "Simple", "Island", "Default", "Hedgewars")
+ player = AddHog(loc("Ace"), 0, 80, "Gasmask") --NoHat
+ SetGearPosition(player, 1380, 1500)
+
+end
+
+
+
+function onGameStart()
+
+ ShowMission (
+ loc("RC PLANE TRAINING"),
+ loc("a Hedgewars challenge"),
+
+ loc("Collect or destroy all the health crates.") .. "|" ..
+ loc("Compete to use as few planes as possible!") .. "|" ..
+ "", -amRCPlane, 4000
+ )
+
+ PlaceGirder(2192, 508, 6)
+ PlaceGirder(2192, 670, 6)
+ PlaceGirder(2193, 792, 2)
+ PlaceGirder(2100, 825, 4)
+ PlaceGirder(2009, 899, 6)
+ PlaceGirder(2084, 992, 4)
+ PlaceGirder(2145, 1087, 6)
+ PlaceGirder(2199, 1235, 5)
+ PlaceGirder(2308, 1296, 0)
+ PlaceGirder(2424, 1234, 7)
+ PlaceGirder(2473, 1129, 2)
+ PlaceGirder(2437, 1046, 1)
+ PlaceGirder(2409, 927, 6)
+ PlaceGirder(2408, 763, 6)
+ PlaceGirder(2404, 540, 6)
+ PlaceGirder(2426, 423, 3)
+ PlaceGirder(2550, 400, 4)
+ PlaceGirder(2668, 425, 1)
+ PlaceGirder(2707, 541, 6)
+ PlaceGirder(2706, 703, 6)
+ PlaceGirder(2705, 867, 6)
+ PlaceGirder(2779, 962, 4)
+ PlaceGirder(2894, 924, 3)
+ PlaceGirder(2908, 802, 6)
+ PlaceGirder(2907, 639, 6)
+ PlaceGirder(3052, 566, 4)
+ PlaceGirder(2971, 394, 4)
+ PlaceGirder(3103, 448, 7)
+ PlaceGirder(3047, 654, 0)
+ PlaceGirder(3043, 746, 6)
+ PlaceGirder(3265, 1583, 6)
+ PlaceGirder(3256, 1491, 4)
+ PlaceGirder(3187, 1401, 6)
+ PlaceGirder(3326, 1400, 6)
+ PlaceGirder(774, 530, 5)
+ PlaceGirder(922, 595, 4)
+ PlaceGirder(1079, 533, 7)
+ PlaceGirder(1139, 386, 6)
+ PlaceGirder(1074, 237, 5)
+ PlaceGirder(723, 381, 6)
+ PlaceGirder(781, 229, 7)
+ PlaceGirder(927, 746, 6)
+ PlaceGirder(874, 736, 0)
+ PlaceGirder(982, 737, 0)
+ PlaceGirder(2430, 1730, 4)
+
+ PlaceGirder(1613, 1104, 7)
+ PlaceGirder(1564, 1256, 6)
+ PlaceGirder(1643, 1341, 5)
+ PlaceGirder(1780, 1372, 4)
+ PlaceGirder(1869, 1296, 7)
+ PlaceGirder(1858, 1163, 5)
+ PlaceGirder(1739, 1044, 5)
+ PlaceGirder(1621, 926, 5)
+ PlaceGirder(1597, 985, 5)
+ PlaceGirder(1449, 939, 4)
+ PlaceGirder(1473, 874, 4)
+ PlaceGirder(2092, 1352, 7)
+ PlaceGirder(2145, 1444, 7)
+ PlaceGirder(2004, 1443, 3)
+ PlaceGirder(1978, 1523, 2)
+ PlaceGirder(2021, 1596, 1)
+ PlaceGirder(2103, 1625, 0)
+ PlaceGirder(2208, 1551, 7)
+ PlaceGirder(2327, 1431, 7)
+ PlaceGirder(2395, 1478, 6)
+ PlaceGirder(2396, 1600, 2)
+ PlaceGirder(2495, 1285, 6)
+ PlaceGirder(2494, 1408, 2)
+ PlaceGirder(2547, 530, 0)
+
+ PlaceGirder(2451, 1551, 0)
+ PlaceGirder(2551, 706, 6)
+ PlaceGirder(2551, 869, 6)
+ PlaceGirder(2623, 1016, 5)
+ PlaceGirder(2773, 1083, 4)
+ PlaceGirder(2924, 1019, 7)
+ PlaceGirder(2568, 1491, 7)
+ PlaceGirder(2618, 1346, 6)
+ PlaceGirder(2674, 1195, 7)
+ PlaceGirder(2822, 1142, 4)
+ PlaceGirder(2963, 1069, 7)
+ PlaceGirder(3067, 938, 5)
+ PlaceGirder(2803, 1373, 2)
+ PlaceGirder(2811, 1559, 2)
+
+ tempG = SpawnHealthCrate(930, 557)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(979, 692)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(876, 703)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(2309, 1260)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(1733, 1127)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(1738, 1320)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(3249, 1460)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(3051, 617)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(2972, 353)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(2548, 358)
+
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(2090, 1580)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(1752, 1753)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(1865, 1758)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(1985, 1760)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(2429, 1760)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(2810, 1480)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(2800, 1277)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(2806, 1107)
+ SetHealth(tempG, 25)
+
+ PlaceGirder(1897, 903, 6)
+ PlaceGirder(1916, 784, 3)
+ PlaceGirder(2010, 732, 4)
+ PlaceGirder(2082, 639, 6)
+ PlaceGirder(2081, 516, 2)
+ PlaceGirder(1985, 487, 4)
+ PlaceGirder(1862, 407, 5)
+ PlaceGirder(1855, 224, 7)
+ PlaceGirder(2006, 163, 4)
+ PlaceGirder(2128, 187, 1)
+ PlaceGirder(2251, 213, 4)
+ PlaceGirder(2413, 213, 4)
+ PlaceGirder(1952, 618, 0)
+ PlaceGirder(957, 1068, 4)
+ PlaceGirder(794, 1069, 4)
+ PlaceGirder(728, 1163, 6)
+ PlaceGirder(728, 1287, 2)
+ PlaceGirder(802, 1342, 4)
+ PlaceGirder(966, 1342, 4)
+ PlaceGirder(674, 1032, 1)
+ PlaceGirder(554, 1011, 4)
+ PlaceGirder(445, 1056, 3)
+ PlaceGirder(422, 1174, 6)
+ PlaceGirder(369, 1341, 5)
+ PlaceGirder(495, 1313, 5)
+ PlaceGirder(568, 1379, 3)
+ PlaceGirder(577, 1202, 2)
+ PlaceGirder(744, 1490, 5)
+ PlaceGirder(760, 1617, 7)
+ PlaceGirder(622, 1693, 4)
+ PlaceGirder(476, 1623, 5)
+ PlaceGirder(376, 1697, 1)
+ PlaceGirder(955, 1746, 2)
+ PlaceGirder(1025, 1746, 2)
+ PlaceGirder(1090, 1745, 2)
+ PlaceGirder(1156, 1746, 2)
+ PlaceGirder(3806, 1530, 2)
+ PlaceGirder(3880, 1464, 2)
+ PlaceGirder(3738, 1458, 2)
+ PlaceGirder(3806, 1390, 2)
+ PlaceGirder(3805, 1588, 0)
+ PlaceGirder(3676, 1609, 3)
+ PlaceGirder(3930, 1615, 1)
+ PlaceGirder(3719, 1295, 0)
+ PlaceGirder(3888, 1294, 0)
+ PlaceGirder(3661, 1385, 2)
+ PlaceGirder(3955, 1377, 2)
+ PlaceGirder(3982, 1518, 0)
+ PlaceGirder(3378, 440, 2)
+ PlaceGirder(3447, 492, 4)
+ PlaceGirder(3564, 529, 1)
+ PlaceGirder(3596, 647, 6)
+ PlaceGirder(3521, 740, 4)
+ PlaceGirder(3524, 838, 4)
+ PlaceGirder(3644, 819, 3)
+ PlaceGirder(3691, 708, 6)
+ PlaceGirder(3690, 545, 6)
+ PlaceGirder(3612, 433, 5)
+ PlaceGirder(3463, 383, 4)
+ PlaceGirder(2815, 122, 7)
+ PlaceGirder(2960, 72, 4)
+ PlaceGirder(3032, 123, 2)
+ PlaceGirder(3063, 174, 0)
+ PlaceGirder(3095, 124, 2)
+ PlaceGirder(3169, 71, 4)
+ PlaceGirder(3320, 124, 5)
+ PlaceGirder(3210, 179, 2)
+ PlaceGirder(2932, 181, 2)
+
+ tempG = SpawnHealthCrate(3804, 1461)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(3269, 1742)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(3066, 121)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(3207, 104)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(2928, 103)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(1997, 202)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(2253, 159)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(2132, 774)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(2549, 490)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(3527, 694)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(3777, 78)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(1124, 1746)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(1056, 1740)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(993, 1742)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(799, 1298)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(577, 1126)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(596, 1463)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(3854, 1043)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(1944, 567)
+ SetHealth(tempG, 25)
+ tempG = SpawnHealthCrate(338, 1748)
+ SetHealth(tempG, 25)
+
+
+end
+
+function onGameTick()
+
+ --if RCGear ~= nil then
+ -- AddCaption(GetTimer(RCGear))
+ --end
+
+end
+
+function onNewTurn()
+ TurnTimeLeft = -1
+end
+
+function onGearAdd(gear)
+
+ if GetGearType(gear) == gtRCPlane then
+ RCGear = gear
+ planesUsed = planesUsed + 1
+ end
+
+ if GetGearType(gear) == gtCase then
+ cratesLeft = cratesLeft + 1
+ end
+
+end
+
+function onGearDelete(gear)
+
+ if GetGearType(gear) == gtRCPlane then
+
+ RCGear = nil
+ AddCaption(loc("Planes Used:") .. " " .. planesUsed)
+
+ elseif GetGearType(gear) == gtCase then
+
+ AddCaption(loc("Crates Left:") .. " " .. cratesLeft)
+ cratesLeft = cratesLeft - 1
+
+ if cratesLeft == 0 then
+
+ ShowMission (
+ loc("CHALLENGE COMPLETE"),
+ loc("Congratulations!"),
+ loc("Planes Used") .. ": " .. planesUsed .. "|" ..
+ "", 0, 0
+ )
+
+
+ ParseCommand("teamgone Wannabe Flyboys")
+ end
+
+ if RCGear ~= nil then
+ SetTimer(RCGear, GetTimer(RCGear) + 10000)
+ end
+
+ end
+
+end
+
+function onAmmoStoreInit()
+ SetAmmo(amRCPlane, 9, 0, 0, 0)
+end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Missions/Training/User_Mission_-_Rope_Knock_Challenge.lua Sun May 20 10:54:52 2012 +0200
@@ -0,0 +1,221 @@
+loadfile(GetDataPath() .. "Scripts/Locale.lua")()
+
+local hhs = {}
+local missionWon = nil
+local endTimer = 1000
+local hogsKilled = 0
+
+local HogData = {
+ {"Bufon", "ShaggyYeti",false},
+ {"burp", "lambda",false},
+ {"Blue", "cap_blue",false},
+ {"bender", "NoHat",false},
+ {"Castell", "NoHat",false},
+ {"cekoto", "NoHat",false},
+ {"CheezeMonkey", "NoHat",false},
+ {"claymore", "NoHat",false},
+ {"CIA-144", "cyborg1",false},
+ {"doomy ", "NoHat",false},
+ {"Falkenauge", "NoHat",false},
+ {"FadeOne", "NoHat",false},
+ {"hayaa", "NoHat",false},
+ {"Hermes", "laurel",false},
+ {"HedgeKing", "NoHat",false},
+ {"Izack1535", "NoHat",false},
+ {"Kiofspa", "NoHat",false},
+ {"Komplex", "NoHat",false},
+ {"koda", "poke_mudkip",false},
+ {"Lalo", "NoHat",false},
+ {"Logan", "NoHat",false},
+ {"lollkiller", "NoHat",false},
+ {"Luelle", "NoHat",false},
+ {"mikade", "Skull",false},
+ {"Mushi", "sm_daisy",false},
+ {"Naboo", "NoHat",false},
+ {"nemo", "bb_bub",false},
+ {"practice", "NoHat",false},
+ {"Prof. Panic", "NoHat",false},
+ {"Randy", "zoo_Sheep",false},
+ {"rhino", "NinjaTriangle",false},
+ {"Radissthor", "NoHat",false},
+ {"Sami", "sm_peach",false},
+ {"soreau", "NoHat",false},
+ {"sdw195", "NoHat",false},
+ {"sphrix", "TeamTopHat",false},
+ {"sheepluva", "zoo_Sheep",false},
+ {"Smaxx", "NoHat",false},
+ {"shadowzero", "NoHat",false},
+ {"Star and Moon", "SparkleSuperFun",false},
+ {"The 24", "NoHat",false},
+ {"TLD", "NoHat",false},
+ {"Tiyuri", "sf_ryu",false},
+ {"unC0Rr", "cyborg1",false},
+ {"Waldsau", "cyborg1",false},
+ {"wolfmarc", "knight",false},
+ {"Xeli", "android",false}
+
+ }
+
+function GenericEnd()
+ ParseCommand("teamgone " .. loc("Wannabe Shoppsta"))
+ ParseCommand("teamgone " .. loc("Unsuspecting Louts"))
+ ParseCommand("teamgone " .. loc("Unlucky Sods"))
+end
+
+function GameOverMan()
+ missionWon = false
+ ShowMission(loc("ROPE-KNOCKING"), loc("MISSION FAILED"), loc("Oh no! Just try again!"), -amSkip, 0)
+ PlaySound(sndHellish)
+end
+
+function GG()
+ missionWon = true
+ ShowMission(loc("ROPE-KNOCKING"), loc("MISSION SUCCESS"), loc("Congratulations!") .. "|" .. loc("COMPLETION TIME") .. ": " .. (TurnTime - TurnTimeLeft) / 1000, 0, 0)
+ PlaySound(sndHomerun)
+end
+
+function AssignCharacter(p)
+
+ done = false
+ sanityCheck = 0
+
+ while(done == false) do
+
+ i = 1+ GetRandom(#HogData)
+ if HogData[i][3] == false then
+ HogData[i][3] = true
+ done = true
+ SetHogName(hhs[p], HogData[i][1])
+ SetHogHat(hhs[p], HogData[i][2])
+ elseif HogData[i][3] == true then
+ sanityCheck = sanityCheck +1
+ if sanityCheck == 100 then
+ done = true
+ SetHogName(hhs[p], "Newbie")
+ SetHogHat(hhs[p], "NoHat")
+ end
+ end
+
+ end
+
+end
+
+function onGameInit()
+
+ --Seed = 1
+ GameFlags = gfBorder + gfSolidLand
+
+ TurnTime = 180 * 1000
+ Delay = 500
+ Map = "Ropes"
+ Theme = "Eyes"
+
+ CaseFreq = 0
+ MinesNum = 0
+ Explosives = 0
+
+ AddTeam(loc("Wannabe Shoppsta"), 1175851, "Simple", "Island", "Default", "Hedgewars")
+ hhs[0] = AddHog(loc("Ace"), 0, 1, "Gasmask")
+ SetGearPosition(player, 1380, 1500)
+
+ AddTeam(loc("Unsuspecting Louts"), 14483456, "Simple", "Island", "Default", "Hedgewars")
+ for i = 1, 8 do
+ hhs[i] = AddHog("generic", 0, 1, "NoHat")
+ end
+
+ AddTeam(loc("Unlucky Sods"), 14483456, "Simple", "Island", "Default", "Hedgewars")
+ for i = 9, 16 do
+ hhs[i] = AddHog("generic", 0, 1, "NoHat")
+ end
+
+end
+
+
+
+function onGameStart()
+
+ ShowMission (
+ loc("ROPE-KNOCKING"),
+ loc("a Hedgewars challenge"),
+ loc("Use the rope to knock your enemies to their doom.") .. "|" ..
+
+ "", -amRope, 4000
+ )
+
+ SetGearPosition(hhs[0], 2419, 1769)
+ SetGearPosition(hhs[1], 3350, 570)
+ SetGearPosition(hhs[2], 3039, 1300)
+ SetGearPosition(hhs[3], 2909, 430)
+ SetGearPosition(hhs[4], 2150, 879)
+ SetGearPosition(hhs[5], 1735, 1136)
+ SetGearPosition(hhs[6], 1563, 553)
+ SetGearPosition(hhs[7], 679, 859)
+ SetGearPosition(hhs[8], 1034, 251)
+ SetGearPosition(hhs[9], 255, 67)
+ SetGearPosition(hhs[10], 2671, 7)
+ SetGearPosition(hhs[11], 2929, 244)
+ SetGearPosition(hhs[12], 1946, 221)
+ SetGearPosition(hhs[13], 3849, 1067)
+ SetGearPosition(hhs[14], 3360, 659)
+ SetGearPosition(hhs[15], 3885, 285)
+ SetGearPosition(hhs[16], 935, 1160)
+
+ for i = 1, 16 do
+ AssignCharacter(i)
+ end
+
+end
+
+function onGameTick()
+
+ if (TurnTimeLeft == 1) and (missionWon == nil) then
+ GameOverMan()
+ end
+
+ if missionWon ~= nil then
+
+ endTimer = endTimer - 1
+ if endTimer == 1 then
+ GenericEnd()
+ end
+
+ if missionWon == true then
+ AddCaption(loc("GG!"), 0xffba00ff,capgrpGameState)
+ else
+ AddCaption(loc("Ouch!"), 0xffba00ff,capgrpGameState)
+ end
+
+ end
+
+end
+
+function onGearDamage(gear, damage)
+
+ if gear ~= hhs[0] then
+
+ AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
+ DeleteGear(gear)
+ PlaySound(sndExplosion)
+
+ hogsKilled = hogsKilled +1
+ if hogsKilled == 15 then
+ PlaySound(sndRideOfTheValkyries)
+ elseif hogsKilled == 16 then
+ GG()
+ end
+
+ end
+
+end
+
+function onGearDelete(gear)
+
+ if (gear == hhs[0]) and (missionWon == nil) then
+ GameOverMan()
+ end
+
+end
+
+function onAmmoStoreInit()
+ SetAmmo(amRope, 9, 0, 0, 0)
+end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Missions/Training/User_Mission_-_The_Great_Escape.lua Sun May 20 10:54:52 2012 +0200
@@ -0,0 +1,122 @@
+loadfile(GetDataPath() .. "Scripts/Locale.lua")()
+
+local player = nil
+local enemy = nil
+
+function onGameInit()
+
+ Map = "Castle"
+ Theme = "Nature"
+ Seed = 0
+ GameFlags = gfInfAttack
+
+ TurnTime = 45 * 1000
+
+ CaseFreq = 0
+ MinesNum = 0
+ Explosives = 0
+
+ AddTeam(loc("Hero Team"), 14483456, "Simple", "Island", "Default", "Hedgewars")
+ player = AddHog(loc("Good Dude"), 0, 80, "NoHat") --NoHat
+
+ AddTeam(loc("Bad Team"), 1175851, "Simple", "Island", "Default", "Hedgewars")
+ enemy = AddHog("Bad Guy", 1, 40, "NoHat")
+
+end
+
+function onGameStart()
+
+ShowMission(loc("The Great Escape"), loc("Get out of there!"), loc("Elimate your captor."), -amGrenade, 0)
+
+------ GIRDER LIST ------
+PlaceGirder(2066, 1588, 0)
+PlaceGirder(2052, 1498, 6)
+PlaceGirder(2098, 1498, 6)
+PlaceGirder(2074, 1409, 0)
+PlaceGirder(2199, 1755, 7)
+PlaceGirder(2476, 1929, 2)
+PlaceGirder(2546, 1879, 4)
+PlaceGirder(2520, 1924, 3)
+PlaceGirder(2706, 1879, 4)
+PlaceGirder(2797, 1911, 2)
+PlaceGirder(2671, 1925, 1)
+PlaceGirder(2895, 1907, 6)
+PlaceGirder(2895, 1747, 6)
+PlaceGirder(2798, 1792, 6)
+PlaceGirder(2797, 1791, 6)
+PlaceGirder(2845, 1928, 1)
+PlaceGirder(2846, 1826, 3)
+PlaceGirder(2844, 1747, 1)
+PlaceGirder(2806, 1702, 4)
+PlaceGirder(2846, 1685, 0)
+PlaceGirder(2846, 1668, 0)
+PlaceGirder(2766, 1668, 0)
+PlaceGirder(2766, 1685, 0)
+PlaceGirder(2718, 1700, 2)
+PlaceGirder(2927, 1659, 0)
+------ HEALTH CRATE LIST ------
+SpawnHealthCrate(2500, 1193)
+SpawnHealthCrate(2575, 1201)
+SpawnHealthCrate(2610, 1224)
+SpawnHealthCrate(2463, 1213)
+SpawnHealthCrate(2425, 1235)
+SpawnHealthCrate(2657, 1234)
+------ MINE LIST ------
+tempG = AddGear(2034, 1704, gtMine, 0, 0, 0, 0)
+SetTimer(tempG, 1)
+tempG = AddGear(2055, 1744, gtMine, 0, 0, 0, 0)
+SetTimer(tempG, 1)
+tempG = AddGear(2063, 1772, gtMine, 0, 0, 0, 0)
+SetTimer(tempG, 1)
+tempG = AddGear(2075, 1801, gtMine, 0, 0, 0, 0)
+SetTimer(tempG, 1)
+tempG = AddGear(2089, 1820, gtMine, 0, 0, 0, 0)
+SetTimer(tempG, 1)
+tempG = AddGear(2118, 1824, gtMine, 0, 0, 0, 0)
+SetTimer(tempG, 1)
+------ REPOSITION LIST ------
+SetGearPosition(player, 2074, 1558)
+SetGearPosition(enemy, 2536, 1182)
+SetHealth(player, 1)
+SetHealth(enemy, 1)
+------ AMMO CRATE LIST ------
+SpawnAmmoCrate(2656, 1967, 5)
+SpawnAmmoCrate(2747, 1912, 12)
+SpawnAmmoCrate(2939, 1623, 1)
+------ UTILITY CRATE LIST ------
+SpawnUtilityCrate(2543, 1969, 15)
+SpawnUtilityCrate(2251, 1664, 6)
+SpawnUtilityCrate(2440, 1937, 18)
+------ END LOADING DATA ------
+
+end
+
+function onGameTick()
+
+ if TurnTimeLeft == TurnTime-1 then
+ SetWind(100)
+ end
+
+end
+
+function onGearDelete(gear)
+ if (GetGearType(gear) == gtCase) and (CurrentHedgehog == player) then
+ if GetHealth(gear) > 0 then
+ AddGear(GetX(gear), GetY(gear), gtGrenade, 0, 0, 0, 1)
+ end
+ elseif gear == player then
+ ShowMission(loc("The Great Escape"), loc("MISSION FAILED"), loc("Oh no! Just try again!"), -amSkip, 0)
+ elseif gear == enemy then
+ ShowMission(loc("The Great Escape"), loc("MISSION SUCCESSFUL"), loc("Congratulations!"), 0, 0)
+ end
+end
+
+function onAmmoStoreInit()
+ SetAmmo(amGrenade, 1, 0, 0, 1)
+ SetAmmo(amParachute, 1, 0, 0, 1)
+ SetAmmo(amFirePunch, 0, 0, 0, 3)
+ SetAmmo(amPickHammer, 0, 0, 0, 1)
+ SetAmmo(amBlowTorch, 0, 0, 0, 1)
+ SetAmmo(amShotgun, 0, 0, 0, 1)
+ SetAmmo(amSkip, 9, 0, 0, 0)
+end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Scripts/Multiplayer/WxW.cfg Sun May 20 10:54:52 2012 +0200
@@ -0,0 +1,2 @@
+Shoppa
+Shoppa
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Scripts/Multiplayer/WxW.lua Sun May 20 10:54:52 2012 +0200
@@ -0,0 +1,751 @@
+
+----------------------
+-- WALL TO WALL 0.4
+----------------------
+-- a shoppa minigame
+-- by mikade
+
+-- feel free to add map specific walls to LoadConfig, or post additional
+-- wall suggestions on our forum at: http://www.hedgewars.org/forum
+
+----------------
+--0.1
+----------------
+-- concept test
+
+----------------
+--0.2
+----------------
+-- unhardcoded turntimeleft, now uses shoppa default of 45s
+-- changed some things behind the scenes
+-- fixed oooooold radar bug
+-- added radar / script support for multiple crates
+-- tweaked weapons tables
+-- added surfing and changed crate spawn requirements a bit
+
+----------------
+--0.3
+----------------
+-- stuffed dirty clothes into cupboard
+-- improved user feedback
+-- added/improved experimental config system, input masks included :D
+
+----------------
+--0.4
+----------------
+-- for version 0.9.18, now detects border in correct location
+-- fix 0.3 config constraint
+-- remove unnecessary vars
+-- oops, remove hardcoding of minesnum,explosives
+-- ... and unhardcode turntime (again)... man, 30s is hard :(
+-- move some initialisations around
+-- numerous improvements to user feedback
+-- walls disappear after being touched
+-- added backwards compatibility with 0.9.17
+
+----------------
+--TO DO
+----------------
+-- achievements / try detect shoppa moves? :|
+-- maybe add ability for the user to place zones like in Racer?
+-- add more hard-coded values for specific maps
+
+-----------------------------
+-- GO PONIES, GO PONIES, GO!
+-----------------------------
+
+loadfile(GetDataPath() .. "Scripts/Locale.lua")()
+loadfile(GetDataPath() .. "Scripts/Tracker.lua")()
+loadfile(GetDataPath() .. "Scripts/Utils.lua")()
+
+-- experimental menu stuff
+local menuIndex = 1
+local menu = {}
+local preMenuCfg
+local postMenuCfg
+local roundN = 0
+
+-- config and wall variables
+local AFR = false
+local allowCrazyWeps = false
+local requireSurfer = true
+local wX = {}
+local wY = {}
+local wWidth = {}
+local wHeight = {}
+local wTouched = {}
+--local margin
+local wallsLeft = 0
+
+local highestY = 0
+local surferTimer = 0
+local hasSurfed = false
+local allWallsHit = false
+
+local gTimer = 1
+local effectTimer = 1
+
+local ropeG = nil
+local crateG = nil
+local allowCrate = true
+
+-- crate radar vars
+local rCirc = {}
+local rAlpha = 255
+local rPingTimer = 0
+local m2Count = 0
+
+local weapons = {}
+
+--[[local unlisted = {amTardis, amLandGun,amExtraTime,amExtraDamage,
+ amVampiric, amSwitch, amInvulnerable, amGirder, amJetpack,
+ amPortalGun, amTeleport, amResurrector, amLaserSight, amLowGravity,
+ amAirAttack, amNapalm, amMineStrike, amDrillStrike,
+ amKamikaze, amSnowball, amSeduction}]]
+
+local crazyWeps = {amWatermelon, amHellishBomb, amBallgun, amRCPlane}
+
+local groundWeps = {amBee, amShotgun,amDEagle,amFirePunch, amWhip,
+ amPickHammer, amBaseballBat, amCake,amBallgun,
+ amRCPlane, amSniperRifle, amBirdy, amBlowTorch, amGasBomb,
+ amFlamethrower, amSMine, amMortar, amHammer}
+
+local ropeWeps = {amGrenade, amClusterBomb, amBazooka, amMine, amDynamite,
+ amWatermelon, amHellishBomb, amDrill, amMolotov}
+
+-- 0.9.18+ extra custom data for preset maps
+local MapList =
+ {
+ --name, surfer, roof, LRwalls
+ {"Atlantis Shoppa", true, false, true},
+ {"BambooPlinko", true, false, true},
+ {"BrickShoppa", false, false, true},
+ {"BubbleFlow", true, false, true},
+ {"Cave", false, false, true},
+ {"Glass Shoppa", true, false, true},
+ {"HardIce", false, false, true},
+ {"Industrial", false, false, true},
+ {"Islands", true, false, true},
+ {"Hedgelove", true, false, true},
+ {"NeonStyle", false, false, true},
+ {"Octorama", false, false, true},
+ {"red vs blue - Castle", true, false, true},
+ {"red vs blue - castle2", true, false, true},
+ {"red vs blue - True Shoppa Sky", true, false, true},
+ {"Ropes", false, false, true},
+ {"Ropes Rearranged", false, false, true},
+ {"RopesRevenge Flipped", true, false, true},
+ {"Ropes Three", false, false, true},
+ {"RopesTwo", false, false, true},
+ {"ShapeShoppa1.0", true, false, true},
+ {"ShappeShoppa Darkhow", true, false, true},
+ {"ShoppaCave2", true, false, true},
+ {"ShoppaFun", true, false, true},
+ {"ShoppaGolf", false, false, true},
+ {"ShoppaHell", false, true, false},
+ {"ShoppaKing", false, false, false},
+ {"ShoppaNeon", false, false, true},
+ {"ShoppaSky", false, false, true},
+ {"Shoppawall", false, false, true},
+ {"SkatePark", false, false, true},
+ {"SloppyShoppa", false, false, true},
+ {"Sticks", true, false, true},
+ {"Symmetrical Ropes ", false, false, true},
+ {"Tetris", false, false, true},
+ {"TransRopes2", false, false, true},
+ {"Wildmap", false, false, true},
+ {"Winter Shoppa", false, false, true},
+ {"2Cshoppa", true, false, true}
+ }
+
+function BoolToCfgTxt(p)
+ if p == false then
+ return("Disabled")
+ else
+ return("Enabled")
+ end
+end
+
+function LoadConfig(p)
+
+ margin = 20
+ mapID = nil
+
+ -- 0.9.17
+ if Map == "CHANGE_ME" then
+ AddCaption(loc("For improved features/stability, play 0.9.18+"))
+ --AddWall(10,10,4085,margin)
+ AddWall(10,10,margin,2025)
+ AddWall(4085-margin,10,margin,2025)
+ end
+
+ --0.9.18+
+ for i = 1, #MapList do
+ if Map == MapList[i][1] then
+ mapID = i
+ --AddCaption(MapList[i][1] .. " found. reqSurf is " .. BoolToCfgTxt(MapList[i][2]))
+ end
+ end
+
+ if (p == 1) and (mapID ~= nil) then
+ requireSurfer = MapList[mapID][2]
+ end
+
+ if mapID ~= nil then
+
+ -- add a wall to the roof
+ if MapList[mapID][3] == true then
+ AddWall(LeftX+10,TopY+10,RightX-LeftX-20,margin)
+ end
+
+ -- add walls on the left and right border
+ if MapList[mapID][4] == true then
+ AddWall(LeftX+10,TopY+10,margin,WaterLine)
+ AddWall(RightX-10-margin,TopY+10,margin,WaterLine)
+ end
+
+ -- add map specific walls
+ if Map == "Ropes" then
+ AddWall(1092,934,54,262)
+ AddWall(2822,323,33,137)
+ elseif Map == "ShoppaKing" then
+ AddWall(3777,1520,50,196)
+ AddWall(1658,338,46,670)
+ elseif Map == "ShoppaHell" then
+ AddWall(2035,831,30,263)
+ AddWall(3968,1668,31,383)
+ elseif Map == "ShoppaNeon" then
+ AddWall(980,400,20,300)
+ AddWall(1940,400,20,300)
+ AddWall(3088,565,26,284)
+ AddWall(187,270,28,266)
+ end
+
+ -- if map is unrecognized, add two walls on the side borders
+ -- also, if version of hw is not 0.9.17 or lower
+ elseif Map ~= "CHANGE_ME" then
+ AddWall(LeftX+10,TopY+10,margin,WaterLine)
+ AddWall(RightX-10-margin,TopY+10,margin,WaterLine)
+ end
+
+
+end
+
+function AddWall(zXMin,zYMin, zWidth, zHeight)
+
+ table.insert(wX, zXMin)
+ table.insert(wY, zYMin)
+ table.insert(wWidth, zWidth)
+ table.insert(wHeight, zHeight)
+ table.insert(wTouched, false)
+
+end
+
+function DrawBlip(gear)
+ SetVisualGearValues(getGearValue(gear,"CIRC"), getGearValue(gear,"RX"), getGearValue(gear,"RY"), 100, 255, 1, 10, 0, 40, 3, GetClanColor(GetHogClan(CurrentHedgehog))-rAlpha)
+end
+
+function TrackRadarBlip(gear)
+
+ -- work out the distance to the target
+ g1X, g1Y = GetGearPosition(CurrentHedgehog)
+ g2X, g2Y = GetX(gear), GetY(gear)
+ q = g1X - g2X
+ w = g1Y - g2Y
+ r = math.sqrt( (q*q) + (w*w) ) --alternate
+
+ RCX = getGearValue(gear,"RX")
+ RCY = getGearValue(gear,"RY")
+
+ rCircDistance = r -- distance to circle
+
+ opp = w
+ if opp < 0 then
+ opp = opp*-1
+ end
+
+ -- work out the angle (theta) to the target
+ t = math.deg ( math.asin(opp / r) )
+
+ -- based on the radius of the radar, calculate what x/y displacement should be
+ NR = 150 -- radius at which to draw circs
+ NX = math.cos( math.rad(t) ) * NR
+ NY = math.sin( math.rad(t) ) * NR
+
+ if rCircDistance < NR then
+ RCX = g2X
+ elseif q > 0 then
+ RCX = g1X - NX
+ else
+ RCX = g1X + NX
+ end
+
+ if rCircDistance < NR then
+ RCY = g2Y
+ elseif w > 0 then
+ RCY = g1Y - NY
+ else
+ RCY = g1Y + NY
+ end
+
+ setGearValue(gear, "RX", RCX)
+ setGearValue(gear, "RY", RCY)
+
+end
+
+
+function HandleCircles()
+
+ -- enable this if you want the radar to only show for a few seconds
+ -- after you spawn the crate
+ --[[if rAlpha ~= 255 then
+
+ rPingTimer = rPingTimer + 1
+ if rPingTimer == 100 then
+ rPingTimer = 0
+
+ rAlpha = rAlpha + 5
+ if rAlpha >= 255 then
+ rAlpha = 255
+ end
+ end
+
+ end]]
+
+ runOnGears(DrawBlip)
+
+ m2Count = m2Count + 1
+ if m2Count == 25 then
+ m2Count = 0
+
+ if (CurrentHedgehog ~= nil) and (rAlpha ~= 255) then
+ runOnGears(TrackRadarBlip)
+ end
+
+ end
+
+end
+
+
+function CheckCrateConditions()
+
+ crateSpawn = true
+
+ if requireSurfer == true then
+ if hasSurfed == false then
+ crateSpawn = false
+ end
+ end
+
+ if #wTouched > 0 then
+ if allWallsHit == false then
+ crateSpawn = false
+ end
+ end
+
+ if crateSpawn == true then
+ if allowCrate == true then
+ --if (crateG == nil) and (allowCrate == true) then
+ --AddCaption("")
+ SpawnAmmoCrate(0, 0, weapons[1+GetRandom(#weapons)] )
+ rPingTimer = 0
+ rAlpha = 0
+ PlaySound(sndWarp)
+ end
+ end
+
+end
+
+function CheckSurfer()
+
+ if GetY(CurrentHedgehog) > highestY then
+ highestY = GetY(CurrentHedgehog)
+ end
+
+ if (highestY == (WaterLine-8)) and (hasSurfed == false) then
+
+ surferTimer = surferTimer +1
+ if (surferTimer == 40) then
+ hasSurfed = true
+ AddCaption(loc("Surfer!"),0xffba00ff,capgrpMessage2)
+ end
+ end
+
+end
+
+
+
+function WallHit(id, zXMin,zYMin, zWidth, zHeight)
+
+ if wTouched[id] == false then
+ tempE = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtBigExplosion, 0, false)
+ PlaySound(sndExplosion)
+ wallsLeft = wallsLeft - 1
+
+ if wallsLeft == 0 then
+ AddCaption(loc("All walls touched!"))
+ allWallsHit = true
+ if (requireSurfer == true) and (hasSurfed == false) then
+ AddCaption(loc("Go surf!"),0xffba00ff,capgrpMessage2)
+ end
+ else
+ AddCaption(loc("Walls Left") .. ": " .. wallsLeft)
+ end
+
+ end
+
+ wTouched[id] = true
+ tempE = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmoke, 0, false)
+ --PlaySound(sndVaporize) -- yeah, this is just annoying as shit
+
+end
+
+function CheckForWallCollision()
+
+ for i = 1, #wTouched do
+ if gearIsInBox(CurrentHedgehog, wX[i],wY[i],wWidth[i],wHeight[i]) then
+ WallHit(i, wX[i],wY[i],wWidth[i],wHeight[i])
+ end
+ end
+
+end
+
+function BorderSpark(zXMin,zYMin, zWidth, zHeight, bCol)
+
+ eX = zXMin + GetRandom(zWidth+10)
+ eY = zYMin + GetRandom(zHeight+10)
+
+ tempE = AddVisualGear(eX, eY, vgtDust, 0, false)
+ if tempE ~= 0 then
+ g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
+ SetVisualGearValues(tempE, eX, eY, g3, g4, g5, g6, g7, 1, g9, bCol )
+ end
+
+end
+
+
+function HandleBorderEffects()
+
+ effectTimer = effectTimer + 1
+ if effectTimer > 15 then --25
+
+ effectTimer = 1
+
+ for i = 1, #wTouched do
+ if wTouched[i] == true then
+ --bCol = GetClanColor(GetHogClan(CurrentHedgehog))
+ else
+ --bCol = 0xFFFFFFFF
+ bCol = GetClanColor(GetHogClan(CurrentHedgehog))
+ BorderSpark(wX[i],wY[i],wWidth[i],wHeight[i], bCol)
+ end
+ --BorderSpark(wX[i],wY[i],wWidth[i],wHeight[i], bCol)
+ end
+
+ end
+
+end
+
+function onLJump()
+ if roundN < 2 then
+ roundN = 100
+ SetInputMask(0xFFFFFFFF)
+ TurnTimeLeft = 1
+ AddCaption(loc("Configuration accepted."),0xffba00ff,capgrpMessage)
+ HideMission()
+ end
+end
+
+function onAttack()
+
+ if roundN < 2 then
+
+ if menuIndex == 1 then
+
+ if #wTouched > 0 then
+ for i = 1, #wTouched do
+ wTouched[i] = nil
+ wX[i] = nil
+ wY[i] = nil
+ wWidth[i] = nil
+ wHeight[i] = nil
+ end
+ else
+ LoadConfig(2)
+ end
+
+ elseif menuIndex == 2 then
+ requireSurfer = not(requireSurfer)
+ elseif menuIndex == 3 then
+ AFR = not(AFR)
+ elseif menuIndex == 4 then
+ allowCrazyWeps = not(allowCrazyWeps)
+ end
+
+ UpdateMenu()
+ configureWeapons()
+ HandleStartingStage()
+
+ elseif (AFR == true) then
+
+ if (GetCurAmmoType() ~= amRope) and
+ (GetCurAmmoType() ~= amSkip) and
+ (GetCurAmmoType() ~= amNothing)
+ then
+ AddCaption(loc("You may only attack from a rope!"),0xffba00ff,capgrpMessage2)
+ end
+
+ end
+
+end
+
+function onDown()
+ if roundN < 2 then
+ menuIndex = menuIndex +1
+ if menuIndex > #menu then
+ menuIndex = 1
+ end
+ HandleStartingStage()
+ end
+end
+
+function onUp()
+ if roundN < 2 then
+ menuIndex = menuIndex -1
+ if menuIndex == 0 then
+ menuIndex = #menu
+ end
+ HandleStartingStage()
+ end
+end
+
+function onGameInit()
+
+ GameFlags = gfRandomOrder + gfBorder + gfSolidLand --+ gfInfAttack
+ HealthCaseProb = 0
+ CaseFreq = 0
+
+end
+
+function configureWeapons()
+
+ -- reset wep array
+ for i = 1, #weapons do
+ weapons[i] = nil
+ end
+
+ -- add rope weps
+ for i, w in pairs(ropeWeps) do
+ table.insert(weapons, w)
+ end
+
+ -- add ground weps
+ for i, w in pairs(groundWeps) do
+ table.insert(weapons, w)
+ end
+
+ -- remove ground weps if attacking from rope is mandatory
+ if AFR == true then
+ for i = 1, #weapons do
+ for w = 1, #groundWeps do
+ if groundWeps[w] == weapons[i] then
+ table.remove(weapons, i)
+ end
+ end
+ end
+ end
+
+ -- remove crazy weps is crazy weps aren't allowed
+ if allowCrazyWeps == false then
+ for i = 1, #weapons do
+ for w = 1, #crazyWeps do
+ if crazyWeps[w] == weapons[i] then
+ table.remove(weapons, i)
+ end
+ end
+ end
+ end
+
+end
+
+function onGameStart()
+
+ LoadConfig(1)
+ configureWeapons()
+ UpdateMenu()
+ HandleStartingStage()
+
+end
+
+function onNewTurn()
+
+ wallsLeft = #wTouched
+
+ for i = 1, #wTouched do
+ wTouched[i] = false
+ end
+
+ allowCrate = true
+
+ surferTimer = 0
+ hasSurfed = false
+ allWallsHit = false
+ highestY = 0
+
+ crateG = nil
+
+ -- new config stuff
+ roundN = roundN + 1
+ if roundN < 2 then
+ TurnTimeLeft = -1
+ SetInputMask(band(0xFFFFFFFF, bnot(gmAnimate+gmAttack+gmDown+gmHJump+gmLeft+gmLJump+gmPrecise+gmRight+gmSlot+gmSwitch+gmTimer+gmUp+gmWeapon)))
+ allowCrate = false
+ HandleStartingStage() -- new
+ end
+
+end
+
+function UpdateMenu()
+
+ preMenuCfg = loc("Spawn the crate, and attack!") .. "|"
+ postMenuCfg = loc("Press [Enter] to accept this configuration.")
+
+ menu = {
+ loc("Walls Required") .. ": " .. #wTouched .. "|",
+ loc("Surf Before Crate") .. ": " .. BoolToCfgTxt(requireSurfer) .. "|",
+ loc("Attack From Rope") .. ": " .. BoolToCfgTxt(AFR) .. "|",
+ loc("Super Weapons") .. ": " .. BoolToCfgTxt(allowCrazyWeps) .. "|"
+ }
+end
+
+function HandleStartingStage()
+
+ temp = menu[menuIndex]
+ menu[menuIndex] = "--> " .. menu[menuIndex]
+
+ missionComment = ""
+ for i = 1, #menu do
+ missionComment = missionComment .. menu[i]
+ end
+
+ ShowMission (
+ loc("WALL TO WALL") .. " 0.4",
+ loc("a shoppa minigame"),
+ preMenuCfg..
+ missionComment ..
+ postMenuCfg ..
+ --" " .. "|" ..
+ "", 4, 300000
+ )
+
+ menu[menuIndex] = temp
+
+end
+
+function onGameTick()
+
+ if CurrentHedgehog ~= nil then
+
+ --AddCaption(Map)
+ --AddCaption(RightX ..";" .. GetX(CurrentHedgehog))
+
+ CheckSurfer()
+
+ gTimer = gTimer + 1
+ if gTimer == 25 then
+ gTimer = 1
+
+ CheckForWallCollision()
+ CheckCrateConditions()
+
+ if (crateG == GetFollowGear()) and (crateG ~= nil) then
+ FollowGear(CurrentHedgehog)
+ end
+
+ -- if attackfromrope is set, forbid firing unless using rope
+ if (AFR == true) and (roundN >= 2) then
+ if (GetCurAmmoType() == amRope) or
+ (GetCurAmmoType() == amSkip) or
+ (GetCurAmmoType() == amNothing)
+ then
+ SetInputMask(0xFFFFFFFF)
+ elseif ropeG == nil then
+ SetInputMask(band(0xFFFFFFFF, bnot(gmAttack)))
+ end
+ end
+
+ end
+
+ HandleBorderEffects()
+ HandleCircles()
+
+ end
+
+end
+
+function onGearAdd(gear)
+
+ if GetGearType(gear) == gtRope then
+ ropeG = gear
+ elseif GetGearType(gear) == gtCase then
+
+ crateG = gear
+ trackGear(gear)
+
+ table.insert(rCirc, AddVisualGear(0,0,vgtCircle,0,true) )
+ setGearValue(gear,"CIRC",rCirc[#rCirc])
+ setGearValue(gear,"RX",0)
+ setGearValue(gear,"RY",0)
+ SetVisualGearValues(rCirc[#rCirc], 0, 0, 100, 255, 1, 10, 0, 40, 3, 0xff00ffff)
+
+ allowCrate = false
+
+ rPingTimer = 0
+ rAlpha = 0
+
+ end
+
+end
+
+function onGearDelete(gear)
+
+ if gear == ropeG then
+ ropeG = nil
+ elseif GetGearType(gear) == gtCase then
+
+ if gear == crateG then
+ crateG = nil
+ -- rAlpha = 255
+ end
+
+ for i = 1, #rCirc do
+ if rCirc[i] == getGearValue(gear,"CIRC") then
+ DeleteVisualGear(rCirc[i])
+ table.remove(rCirc, i)
+ end
+ end
+
+ trackDeletion(gear)
+
+ end
+
+end
+
+function onAmmoStoreInit()
+
+ for i, w in pairs(ropeWeps) do
+ SetAmmo(w, 0, 0, 0, 1)
+ end
+
+ for i, w in pairs(groundWeps) do
+ SetAmmo(w, 0, 0, 0, 1)
+ end
+
+ for i, w in pairs(crazyWeps) do
+ SetAmmo(w, 0, 0, 0, 1)
+ end
+
+ SetAmmo(amRope, 9, 0, 0, 0)
+ SetAmmo(amSkip, 9, 0, 0, 0)
+
+end