[Mission] Target practice missions with simple Lua framework (INLCUDED IN HEDGEWARS)

4 replies [Last post]
Wuzzy
Wuzzy's picture
User offline. Last seen 3 weeks 2 days ago. Offline
Joined: 2012-06-20
Posts: 1301

Hi! I have created a couple of target practice missions.
They are very similar to the original cluster bomb training: You have a weapon infinitely times and you have to destroy a fixed sequence of targets in a given time.
These missions also all feature a basic score system, giving you score based on accuracy, hit targets and remaining time. You will see the score in the stats screen. It is mostly the same as seen in this thread: http://www.hedgewars.org/node/5951

Currently, the following missions have been created:

  • Cluster bomb on Trash map
  • Bazooka on Lonely_Island (easy)
  • Bazooka on SB_Grassy (hard)
  • Homing bee on Hedgewars map
  • Shotgun on SB_Haunty
  • Grenade on SB_Crystals (easy)
  • Grenade on SB_Crystals (hard)

Note that the bazooka and shotgun missions are different from those in official Hedgewars. The cluster bomb mission is just a reimplementation of the existing cluster bomb mission in official Hedgewars.

I hope I can create even more missions soon. I have also named them all “Target Practice” missions in order to seperate them from “Basic Training”. (I see “Basic Training” missions as tutorial, but target practice is technically not a tutorial anymore and therefore belongs into its own category.)

Here you can download the missions:
TargetPractice_v3.hwp
To use this, put this into your Hedgewars data directory.

I have created the missions with help of a framework I created for this, so target practise missions can be created very quickly. The main work of creating such a mission now just involves its specification (finding good target positions), balancing and playtesting, much less time in actual coding.

Info about the framework:
While I was creating more target practice missions, I quickly realized that they are extremely redundant.

The framework resulted from an update of the cluster bomb training, see here. A few missions posted here are made obsolete by my new missions.

The framework is an attempt to extremely simplify the creation of target practice missions. A target practice mission

To demonstrate how easy to use the framework is, I post here the full source code of my reimplementation of the cluster bomb training:

HedgewarsScriptLoad("/Scripts/TargetPractice.lua")

local params = {
	ammoType = amClusterBomb,
	gearType = gtClusterBomb,
	missionTitle = "Cluster Bomb Training",
	solidLand = false,
	map = "Trash",
	theme = "Golf",
	hog_x = 756,
	hog_y = 370,
	hogName = loc("Private Nolak"),
	hogHat = "war_desertgrenadier1",
	teamName = loc("The Hogies"),
	targets = {
		{ x = 628, y = 0 },
		{ x = 891, y = 0 },
		{ x = 1309, y = 0 },
		{ x = 1128, y = 0 },
		{ x = 410, y = 0 },
		{ x = 1564, y = 0 },
		{ x = 1248, y = 476 },
		{ x = 169, y = 0 },
		{ x = 1720, y = 0 },
		{ x = 1441, y = 0 },
		{ x = 599, y = 0 },
		{ x = 1638, y = 0 },
	},
	time = 180000,
	shootText = loc("You have thrown %d cluster bombs."),
}

TargetPracticeMission(params)

Yep, it’s just one script load and a single function call, the rest is just specification, and many fields are optional.

The framework is included in the HWP file above. To program using the framework, first extract the HWP file (it is a Zip file in reality). You will find the framework in Scripts/TargetPractice.lua. The comments in this file explain the parameters and you should quickly be able to create your own target practice missions (Lua skills required of course).
To find the coordinates, use an image editor like The GIMP. The coordinates used by Hedgewars are identical to the image coordinates.

EDIT: Oops, I accidentally added the sniper rifle mission to the HWP file. Please ignore it, it does not belong in here and does not use the framework.

EDIT 2: version 2 released.

Hi, I am a Hedgewars developer. Smile

mikade
mikade's picture
User offline. Last seen 15 weeks 4 hours ago. Offline
Joined: 2010-10-22
Posts: 355

Hm, only a brief comment to say I tried to test them, but they seem to crash my Hedgewars. Didn't investigate too deeply, yet. Did you actually test these already?

mikade
Hedgewars Developer

Wuzzy
Wuzzy's picture
User offline. Last seen 3 weeks 2 days ago. Offline
Joined: 2012-06-20
Posts: 1301

Oops, I had two bugs, on of them sneaked in right before release. I have fixed both bugs and now the scripts should work both in 0.9.20 and in development version of Hedgewars.

Download version v2:
TargetPractice_v2.hwp

EDIT:
Here are the descriptions for the missions:

Target_Practice_-_Bazooka_easy.name=Target Practice: Bazooka (easy)
Target_Practice_-_Bazooka_easy.desc="Alright, soldier, blow those targets up as fast as you can!"

Target_Practice_-_Bazooka_hard.name=Target Practice: Bazooka (hard)
Target_Practice_-_Bazooka_hard.desc="Can you hit the targets even when they are very far away?"

Target_Practice_-_Cluster_Bomb.name=Target Practice: Cluster Bomb
Target_Practice_-_Cluster_Bomb.desc="Someone needs hot shower!"

Target_Practice_-_Shotgun.name=Target Practice: Shotgun
Target_Practice_-_Shotgun.desc="Shoot first, ask questions later!"

Target_Practice_-_Homing_Bee.name=Target Practice: Homing Bee
Target_Practice_-_Homing_Bee.desc="Using the homing bee is trickier than it seems."

Target_Practice_-_Grenade_easy.name=Target Practice: Grenade (easy)
Target_Practice_-_Grenade_easy.desc="A warm-up training for the aspiring grenadier."

Target_Practice_-_Grenade_hard.name=Target Practice: Grenade (hard)
Target_Practice_-_Grenade_hard.desc="This is nothing for greenhorns! We will place the targets at some really tricky positions."

Sadly, I cannot package them because Hedgewars stores all mission descriptions in a single file. If you want description in-game, you have to add this text manually to Locale/missions_en.txt (but this is not required, the missions work anyways).

Hi, I am a Hedgewars developer. Smile

Wuzzy
Wuzzy's picture
User offline. Last seen 3 weeks 2 days ago. Offline
Joined: 2012-06-20
Posts: 1301

Hi! I have added two grenade missions: easy and hard, both on SB_Crystal
(this map is just too perfect for grenades Wink Smiley).

Here you can grab the next version of the HWP file:
TargetPractice_v3.hwp

(Please make sure to delete older versions of TargetPractice HWPs.)

I have updated the description texts in the previous post.

Now I have created target practice missions for the most important weapons in the game. Let’s see if I create more missions for more exotic weapons.

Hi, I am a Hedgewars developer. Smile

mikade
mikade's picture
User offline. Last seen 15 weeks 4 hours ago. Offline
Joined: 2010-10-22
Posts: 355

Alright, nice work. I added these and the updated trainings into repo with a small tweak that should allow some strings to actually be translated this version.

I think nemo has already mentioned this to you, but in future please version the individual files so that they don't conflict with older ones when people inevitably don't delete older versions of HWPs etc.

mikade
Hedgewars Developer

User login

Copyright © 2004-2024 Hedgewars Project. All rights reserved. [ contact ]