I know this topic is 30 days old but i think this is the right place to post this:
Ok i know how to add custom units.Its almost the same in Battlefont 1.But here for BF2 is a little different and i stuck on the final part where i rather than replacing old unit with my custom i decided to add it on a new spawn button.This is part of my luaC file:
--------------------------------------------------------------------------------------------
ReadDataFile("sound\\yav.lvl;yav1cw")
ReadDataFile("SIDE\\rep.lvl",
"rep_inf_ep3_rifleman",
"rep_inf_ep3_rocketeer",
"rep_inf_ep3_engineer",
"rep_inf_ep3_sniper",
"rep_inf_ep3_officer",
"rep_inf_ep3_jettrooper",
"rep_hover_fightertank",
"rep_hero_anakin",
"rep_hover_barcspeeder")
ReadDataFile("DC:SIDE\\qwe.lvl",
"qwe_inf_rancor",
"qwe_inf_ep3_rifleman")
ReadDataFile("SIDE\\cis.lvl",
"cis_inf_rifleman",
"cis_inf_rocketeer",
"cis_inf_engineer",
"cis_inf_sniper",
"cis_inf_officer",
"cis_inf_droideka",
"cis_hero_darthmaul",
"cis_hover_aat")
ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_laser",
"tur_bldg_tower")
SetupTeams{
rep = {
team = REP,
units = 20,
reinforcements = 150,
soldier = { "rep_inf_ep3_rifleman",9, 25},
assault = { "rep_inf_ep3_rocketeer",1, 4},
engineer = { "rep_inf_ep3_engineer",1, 4},
sniper = { "rep_inf_ep3_sniper",1, 4},
officer = {"rep_inf_ep3_officer",1, 4},
special = { "rep_inf_ep3_jettrooper",1, 4},
},
cis = {
team = CIS,
units = 20,
reinforcements = 150,
soldier = { "cis_inf_rifleman",9, 25},
assault = { "cis_inf_rocketeer",1, 4},
engineer = { "cis_inf_engineer",1, 4},
sniper = { "cis_inf_sniper",1, 4},
officer = {"cis_inf_officer",1, 4},
special = { "cis_inf_droideka",1, 4},
}
}
SetHeroClass(CIS, "cis_hero_darthmaul")
SetHeroClass(REP, "rep_hero_anakin")
AddUnitClass(REP, "qwe_inf_ep3_rifleman",1,4)
--------------------------------------------------------------------------------------------
As you see i added this on the end:
AddUnitClass(REP, "qwe_inf_ep3_rifleman",1,4)
When i munge ingame there is a new spawn button for the REP side but Anakin Skywalker is occupyed that slot.I dont see my custom soldier.Where is the problem?If someone know please help. :)
I think you should add your customs lines after "rep_infep3jettrooper"
Then save, munge and try the map
Hope it's help a little :confused:
How this is going to look in my lua?Please copy part of my lua and edit it so i can see exactly how this looks like.
Sorry for late answer :confused: I think and I HOPE this will work
Here's an example on how I set up a 7th unit:
ReadDataFile("sound\\yav.lvl;yav1cw")
ReadDataFile("dc:SIDE\\rep.lvl",
"newunits",
"rep_hero_plokoon",
"rep_walk_atte")
ReadDataFile("dc:SIDE\\cis.lvl",
"newunits",
"cis_hero_grievous",
"cis_walk_spider")
ReadDataFile("dc:SIDE\\snw.lvl",
"snw_inf_chain")
SetupTeams{
rep = {
team = REP,
units = 28,
reinforcements = 150,
soldier = { "rep_inf_ep2_rifleman",10, 25},
assault = { "rep_inf_ep2_rocketeer",1, 4},
engineer = { "rep_inf_ep2_engineer",1, 4},
sniper = { "rep_inf_ep2_sniper",1, 4},
officer = {"rep_inf_ep2_assault",1, 4},
special = { "rep_inf_ep2_melee",1, 4},
},
}
AddUnitClass(REP,"rep_inf_ep2_officer",1,2)
AddUnitClass(REP,"rep_inf_ep2_demolitions", 1,2)
AddUnitClass(REP,"rep_inf_ep2_flash",1,1)
SetupTeams{
cis = {
team = CIS,
units = 28,
reinforcements = 150,
soldier = { "cis_inf_rifleman_geo",10, 25},
assault = { "cis_inf_rocketeer_geo",1, 4},
engineer = { "cis_inf_engineer_geo",1, 4},
sniper = { "cis_inf_sniper_geo",1, 4},
officer = {"cis_inf_sbd",1, 4},
special = { "cis_inf_officer_geo",1, 4},
},
}
AddUnitClass(CIS,"cis_inf_sbd_heavy",1,2)
AddUnitClass(CIS,"cis_inf_droideka",1,2)
AddUnitClass(CIS,"cis_inf_magnaguard", 1,2)
SetHeroClass(CIS, "cis_hero_grievous")
SetHeroClass(REP, "rep_hero_plokoon")
You add the "AddUnitClass" lines before the "SetHeroClass" lines.
So yours would be something like:
--------------------------------------------------------------------------------------------
ReadDataFile("sound\\yav.lvl;yav1cw")
ReadDataFile("SIDE\\rep.lvl",
"rep_inf_ep3_rifleman",
"rep_inf_ep3_rocketeer",
"rep_inf_ep3_engineer",
"rep_inf_ep3_sniper",
"rep_inf_ep3_officer",
"rep_inf_ep3_jettrooper",
"rep_hover_fightertank",
"rep_hero_anakin",
"rep_hover_barcspeeder")
ReadDataFile("DC:SIDE\\qwe.lvl",
"qwe_inf_rancor",
"qwe_inf_ep3_rifleman")
ReadDataFile("SIDE\\cis.lvl",
"cis_inf_rifleman",
"cis_inf_rocketeer",
"cis_inf_engineer",
"cis_inf_sniper",
"cis_inf_officer",
"cis_inf_droideka",
"cis_hero_darthmaul",
"cis_hover_aat")
ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_laser",
"tur_bldg_tower")
SetupTeams{
rep = {
team = REP,
units = 20,
reinforcements = 150,
soldier = { "rep_inf_ep3_rifleman",9, 25},
assault = { "rep_inf_ep3_rocketeer",1, 4},
engineer = { "rep_inf_ep3_engineer",1, 4},
sniper = { "rep_inf_ep3_sniper",1, 4},
officer = {"rep_inf_ep3_officer",1, 4},
special = { "rep_inf_ep3_jettrooper",1, 4},
},
}
AddUnitClass(REP, "qwe_inf_ep3_rifleman",1,4)
SetupTeams{
cis = {
team = CIS,
units = 20,
reinforcements = 150,
soldier = { "cis_inf_rifleman",9, 25},
assault = { "cis_inf_rocketeer",1, 4},
engineer = { "cis_inf_engineer",1, 4},
sniper = { "cis_inf_sniper",1, 4},
officer = {"cis_inf_officer",1, 4},
special = { "cis_inf_droideka",1, 4},
}
}
SetHeroClass(CIS, "cis_hero_darthmaul")
SetHeroClass(REP, "rep_hero_anakin")
That should work.
I tryed your methods guys however it gives me a error in the mungelog.Probably cuz im windows 7.However i fix it.It was just needed to switch this AddUnitClass(REP, "qwe_inf_ep3_rifleman",1,4) from under to above this line:
SetHeroClass(CIS, "cis_hero_darthmaul")
SetHeroClass(REP, "rep_hero_anakin")
I have read how to make it working 20 times but I suck.....And I have this problem.....Why? :blink:
Here we have my lua ad my errors:
Quote from: Cdt Fox on November 18, 2015, 11:19:49 AM
I have read how to make it working 20 times but I suck.....And I have this problem.....Why? :blink:
Here we have my lua ad my errors:
You may have already fixed the problem by now, but the problem is these two lines:
ReadDataFile("SIDE\\rep.lvl"
"rep_inf_ep3_cody" ,1, 4)
It should be:
ReadDataFile("dc:SIDE\\rep.lvl"
"rep_inf_ep3_cody")
Basically, you need to add "dc:" in the "ReadDataFile" line so that it loads your custom rep.lvl and you shouldn't set the maximum/minimum Ai at this line.
Quote from: Ginev on September 22, 2015, 01:49:48 PM
I know this topic is 30 days old but i think this is the right place to post this:
...
Ok i know how to add custom units.Its almost the same in Battlefont 1.But here for BF2 is a little different and i stuck on the final part where i rather than replacing old unit with my custom i decided to add it on a new spawn button.This is part of my luaC file:
When i munge ingame there is a new spawn button for the REP side but Anakin Skywalker is occupyed that slot.I dont see my custom soldier.Where is the problem?If someone know please help. :)
If you haven't solved the problem I can tell you something useful in these cases, as someone pointed out before, when you test with AddUnitClass you have to declare it before the Hero line.