Page 1 of 1

Inconsistent localization for ambush/local teams [solved]

Posted: Wed Jan 07, 2009 3:20 pm
by Eggman
The mission I'm working with calls for one local team and a number of ambushes. When the player kills some of the units, the message shows up as "Player killed [NULL]," a pretty common problem. I've tried following the methods to localizing local teams as described in these topics, with no luck:

http://www.gametoast.com/forums/viewtop ... illed+null
http://www.gametoast.com/forums/viewtop ... =27&t=6088

I imagine that I'm missing a step somewhere, but what baffles me is that the problem is inconsistent - that is, not all units from the local/ambush teams show up as [NULL], only some of them. I thought the problem might come from the properly localized units using shipped names (example, cis_inf_sniper appears as "Player killed Assassin Droid") while [NULL] units used new names (cis_inf_b2 appears as "Player killed [NULL]." However, I later noticed that some new units did have localization; for example, "rep_inf_sergeant" appeared as "Player killed Clone Sergeant." Further confusing me is the fact that the units such as that one appeared with localization even though I had not yet done any localization work for local sides. I had only given them names in their scope under "entity."

So, I'd like help figuring out why some units appear localized while others do not, and from there localizing the [NULL] units.

Parts of script dealing with team setup:
Hidden/Spoiler:
-- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;
AmbushTeam = 3
ATM = AmbushTeam
AmbushTeam2 = 4
AT2 = AmbushTeam2
AmbushTeam3 = 5
AT3 = AmbushTeam3
AmbushTeam4 = 6
AT4 = AmbushTeam4
AmbushTeam5 = 7
AT5 = AmbushTeam5
Hidden/Spoiler:
ReadDataFile("dc:SIDE\\rep2.lvl",
"rep_inf_trooper",
"rep_inf_trooper_story",
"rep_inf_sergeant",
"rep_inf_lieutenant",
"rep_inf_engineer",
"rep_inf_captain",
"rep_inf_commander",
"rep_hover_fightertank")
ReadDataFile("dc:SIDE\\cis2.lvl",
"cis_inf_b1",
"cis_inf_rocketeer",
"cis_inf_engineer",
"cis_inf_sniper",
"cis_inf_b2",
"cis_inf_commander",
"cis_inf_droideka",
"cis_hover_aat")

Hidden/Spoiler:
SetupTeams{
rep = {
team = REP,
units = 1,
reinforcements = 5,
soldier = { "rep_inf_trooper_story",1, 1},

},
cis = {
team = CIS,
units = 15,
reinforcements = -1,
soldier = { "cis_inf_b1",9, 20},
assault = { "cis_inf_rocketeer",1, 1},
engineer = { "cis_inf_engineer",1, 1},
sniper = { "cis_inf_sniper",0, 0},
officer = {"cis_inf_b2",0, 0},
special = { "cis_inf_commander",1, 1},
},

atm = {
team = ATM,
units = 9,
reinforcements = -1,
soldier = { "rep_inf_trooper",7, 7},
assault = { "rep_inf_sergeant",1, 1},
engineer = { "rep_inf_lieutenant",0, 0},
sniper = { "rep_inf_engineer",1, 1},
officer = {"rep_inf_captain",0, 0},
special = { "rep_inf_commander",0, 0},
},

at2 = {
team = AT2,
units = 9,
reinforcements = -1,
soldier = {"cis_inf_b1", 9, 9},
},

at3 = {
team = AT3,
units = 9,
reinforcements = -1,
soldier = {"cis_inf_b2", 5, 5},
},

at4 = {
team = AT4,
units = 1,
reinforcements = -1,
soldier = {"cis_inf_sniper", 1, 1},
},

at5 = {
team = AT5,
units = 3,
reinforcements = -1,
soldier = {"cis_inf_droideka", 3, 3},
}
}
Hidden/Spoiler:
SetTeamName (3, "rep")
SetTeamAsFriend(ATM, REP)
SetTeamAsFriend(REP, ATM)
SetTeamAsEnemy(ATM, CIS)
SetTeamAsEnemy(CIS, ATM)
SetTeamName(ATM, REP)
ClearAIGoals(ATM)
AddAIGoal(ATM, "Deathmatch", 1000)


SetTeamName (4, "cis")
SetTeamAsFriend(AT2, CIS)
SetTeamAsFriend(CIS, AT2)
SetTeamAsEnemy(AT2, REP)
SetTeamAsEnemy(REP, AT2)
SetTeamName(AT2, CIS)
ClearAIGoals(AT2)
AddAIGoal(AT2, "Deathmatch", 1000)


SetTeamName (5, "cis")
SetTeamAsFriend(AT3, CIS)
SetTeamAsFriend(CIS, AT3)
SetTeamAsEnemy(AT3, REP)
SetTeamAsEnemy(REP, AT3)
SetTeamName(AT3, CIS)
ClearAIGoals(AT3)
AddAIGoal(AT3, "Deathmatch", 1000)


SetTeamName (6, "cis")
SetTeamAsFriend(AT4, CIS)
SetTeamAsFriend(CIS, AT4)
SetTeamAsEnemy(AT4, REP)
SetTeamAsEnemy(REP, AT4)
SetTeamName(AT4, CIS)
ClearAIGoals(AT4)
AddAIGoal(AT4, "Deathmatch", 1000)


SetTeamName (7, "cis")
SetTeamAsFriend(AT5, CIS)
SetTeamAsFriend(CIS, AT5)
SetTeamAsEnemy(AT5, REP)
SetTeamAsEnemy(REP, AT5)
SetTeamName(AT5, CIS)
ClearAIGoals(AT5)
AddAIGoal(AT5, "Deathmatch", 1000)
In the localization tool, I have things set up as level -> AL3 -> cis and level -> AL3 -> rep. I *think* the problem lies somewhere in either how I have "SetTeamName" set up or how I have the localization set up.

Re: Inconsistent localization for ambush/local teams

Posted: Wed Jan 07, 2009 10:28 pm
by [RDH]Zerted
I'm not sure what you were thinking when you wrote that code (I'm guessing you just copied/pasted...) but you're calling SetTeamName() three times for each team (first at3, second "cis", third 2). People tend to forget that SetupTeams automatically configures the team's name and icon when you use it. I don't know if swbf2 uses the first or last name call and I don't know if its a problem when you have two teams set to the same name.
at3 = {
team = AT3,
units = 9,
reinforcements = -1,
soldier = {"cis_inf_b2", 5, 5},
},

...

SetTeamName (5, "cis")
SetTeamAsFriend(AT3, CIS)
SetTeamAsFriend(CIS, AT3)
SetTeamAsEnemy(AT3, REP)
SetTeamAsEnemy(REP, AT3)
SetTeamName(AT3, CIS)
ClearAIGoals(AT3)
AddAIGoal(AT3, "Deathmatch", 1000)

Re: Inconsistent localization for ambush/local teams

Posted: Wed Jan 07, 2009 11:20 pm
by Eggman
[RDH]Zerted wrote:I'm not sure what you were thinking when you wrote that code (I'm guessing you just copied/pasted...) but you're calling SetTeamName() three times for each team (first at3, second "cis", third 2). People tend to forget that SetupTeams automatically configures the team's name and icon when you use it. I don't know if swbf2 uses the first or last name call and I don't know if its a problem when you have two teams set to the same name.
at3 = {
team = AT3,
units = 9,
reinforcements = -1,
soldier = {"cis_inf_b2", 5, 5},
},

...

SetTeamName (5, "cis")
SetTeamAsFriend(AT3, CIS)
SetTeamAsFriend(CIS, AT3)
SetTeamAsEnemy(AT3, REP)
SetTeamAsEnemy(REP, AT3)
SetTeamName(AT3, CIS)
ClearAIGoals(AT3)
AddAIGoal(AT3, "Deathmatch", 1000)
Alright, I definitely see what you mean now about that making no sense. I hadn't realized that I had two "SetTeamName" lines within the sections for defining friends/enemies. I must have added one as I was trying to figure things out, forgotten about it, then added another one in. And just as you said, I wasn't thinking that SetupTeams configured the name. I think a lot of my confusion came from setting up the teams a while back following the setup in the tutorial on setting up ambushes, then trying to follow localization tutorials that used teams with the names of shipped sides (all, imp, etc.), and not being able to transfer the knowledge when looking at different names.

I'm pretty sure I see what I need to do to fix that up.

EDIT: And for the record, it wasn't just blind copying/pasting. When I'm still getting a feel for how to do something, as was the case with setting up the extra teams, I follow the format from the tutorials or other scripts I'm looking at as a guide, but I do make an effort to understand how it's all put together. :wink:

EDIT 2: Problem solved. I removed the unnecessary SetTeamName lines, and after that it was as simple as adding a localization key for each extra team under the level scope (example: level -> AL3 -> at3). I could have sworn that was the first thing I tried, but either way it works now.