# HG changeset patch # User mikade # Date 1337440512 -7200 # Node ID f5a5578be66b417cb5a624bfe964a7a9184b5e62 # Parent c9ca770fd7fc6e53b66e8b2edb67d7eb25814d57 A few scripts to try out. 2x challenge, 1x GSoC training, 1x user mission. diff -r c9ca770fd7fc -r f5a5578be66b share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Grenade.png Binary file share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Grenade.png has changed diff -r c9ca770fd7fc -r f5a5578be66b share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Grenade@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Grenade@2x.png has changed diff -r c9ca770fd7fc -r f5a5578be66b share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_RCPlane_Challenge.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_RCPlane_Challenge.png has changed diff -r c9ca770fd7fc -r f5a5578be66b share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_RCPlane_Challenge@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_RCPlane_Challenge@2x.png has changed diff -r c9ca770fd7fc -r f5a5578be66b share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Rope_Knock_Challenge.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Rope_Knock_Challenge.png has changed diff -r c9ca770fd7fc -r f5a5578be66b share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Rope_Knock_Challenge@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Rope_Knock_Challenge@2x.png has changed diff -r c9ca770fd7fc -r f5a5578be66b share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_The_Great_Escape.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_The_Great_Escape.png has changed diff -r c9ca770fd7fc -r f5a5578be66b share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_The_Great_Escape@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_The_Great_Escape@2x.png has changed diff -r c9ca770fd7fc -r f5a5578be66b share/hedgewars/Data/Locale/missions_en.txt --- a/share/hedgewars/Data/Locale/missions_en.txt Fri May 18 13:35:22 2012 -0400 +++ b/share/hedgewars/Data/Locale/missions_en.txt Sat May 19 17:15:12 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 diff -r c9ca770fd7fc -r f5a5578be66b share/hedgewars/Data/Missions/Training/Basic_Training_-_Grenade.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Grenade.lua Sat May 19 17:15:12 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 diff -r c9ca770fd7fc -r f5a5578be66b share/hedgewars/Data/Missions/Training/User_Mission_-_RCPlane_Challenge.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Missions/Training/User_Mission_-_RCPlane_Challenge.lua Sat May 19 17:15:12 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 diff -r c9ca770fd7fc -r f5a5578be66b share/hedgewars/Data/Missions/Training/User_Mission_-_Rope_Knock_Challenge.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Missions/Training/User_Mission_-_Rope_Knock_Challenge.lua Sat May 19 17:15:12 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", "NoHat",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 diff -r c9ca770fd7fc -r f5a5578be66b share/hedgewars/Data/Missions/Training/User_Mission_-_The_Great_Escape.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Missions/Training/User_Mission_-_The_Great_Escape.lua Sat May 19 17:15:12 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