This tutorial is basically about adding push mode to a map. I'll try to make it understandable even for someone who doesn't have any idea about the very basics of coding.
#1 Mapdata.pyMapdata.py is a file that makes FH2's custom scripts by map possible. Create a blank text file, name it "mapdata.py" and place in your map folder. From now on the game will run scripts you insert there on your map.
#2 Import needed plugins into your mapdata.pyThe first step to do with your mapdata.py is to import needed plugins. Let's say that besides push mode we want to have kit limits in our map (to make it more complicated and thus teaching you more about how to add custom scripts in future). You add this line at the beginning of mapdata.py:
from game.plugins import plugin, limitKit, push
As you can see it imports "plugin", "limitKit" nad "push" plugins. You can add further plugins by keeping the template.
#3 Providing data for pluginsFirst we define the kitlimit one. This is not the subject of this tutorial, if it is needed I'll write about this later (is it?). Just after import part you type in (for example):
kit_limits_64 = [
plugin(limitKit, team = 2, slot = 3, kit = 'BA_Limited_Support_Bren_No4', limit = 0.2),
plugin(limitKit, team = 1, slot = 3, kit = 'GA_Limited_Support_MG34_K98', limit = 0.2),
plugin(limitKit, team = 2, slot = 5, kit = 'BA_ATBoys_Limited', limit = 0.2),
plugin(limitKit, team = 1, slot = 5, kit = 'GA_ATPzB39_Limited', limit = 0.2),
]
Then, goes our push mode, and here I'll try to explain everything:
name_of_code = [
plugin(push, source = 'Sorce_controlpoint_name', target = 'Target_controlpoint_name', attacker = n),
]
name_of_code is just a name. Name it as you want, so you will recognize what's in it (like "push_64").
Sorce_controlpoint_name is the name of control point which is required to be taken for the attack on target control point to be possible.
Target_controlpoint_name is the target CP.
n is the ID of the attacking team.
#4 More features.Nice thing about this code is that we can set multiple arguments for the same flag, like this:
plugin(push, source = 'flag1', target = 'flag3', attacker = 2),
plugin(push, source = 'flag2', target = 'flag3', attacker = 2),
Which means both flag 1 and 2 have to be taken by team 2 for the attack on flag 3 to be possible. Something like one flag opening attack route for multiple flags is also possible.
One more thing... if you want to have the flag takeable only once, go to gameplayobjects.con of your map, find the control point of your interest there and add this line to it's code:
ObjectTemplate.onlyTakeableByTeam n
n being the attacker team Id of course.
#5 Mini-map markersYou don't place them. The push script does this automatically.
#6 Enabling the scriptsAt the bottom of your mapdata.py you have to tell the game which scripts to run in which game mode and mapsize (let me take only conquest in consideration). The template is simple:
gpm_cq = {
64: name1 + name2 + name3,
16: name1 + name2,
32: name1,
}
Once again you may add as many things to run for desired game mode or map size as you want.
#7 The exampleOK, time to show how it works all-in-one. Let's say we have 4 flags: flag1, flag2, flag3 and flag4. 1 and 2 are front flags, they open the attack on 3 together. 3 opens an attack on 4. Moreover, we want to have 1 and 2 capturable only once. We want kit limits in our map as well (in all mapsizes). Push mode we need only in 32 and 64 size. The attacking team is team 2.
This would be my mapdata.py:
from game.plugins import plugin, limitKit, push
kit_limits = [
plugin(limitKit, team = 2, slot = 3, kit = 'BA_Limited_Support_Bren_No4', limit = 0.2),
plugin(limitKit, team = 1, slot = 3, kit = 'GA_Limited_Support_MG34_K98', limit = 0.2),
plugin(limitKit, team = 2, slot = 5, kit = 'BA_ATBoys_Limited', limit = 0.2),
plugin(limitKit, team = 1, slot = 5, kit = 'GA_ATPzB39_Limited', limit = 0.2),
]
push_mode = [
plugin(push, source = 'flag1', target = 'flag3', attacker = 2),
plugin(push, source = 'flag2', target = 'flag3', attacker = 2),
plugin(push, source = 'flag3', target = 'flag4', attacker = 2),
]
gpm_cq = {
64: kit_limits + push_mode,
32: kit_limits + push_mode,
16: kit_limits,
}
Of course I'd add
ObjectTemplate.onlyTakeableByTeam 2
to the definition of flag 1 and 2 in gameplayobjects.con
One more note: Make sure you have proper FH2 standardised tmp.con, otherwise it will crash. You can find out how to setup this here (point 9):
http://fenring.bf1942.cl/tutorials/mappingstandards.php======================
That's it, hope it's heplful