Archived copy of war3source.com, the War3Source forum (2009–2020), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2012-10-25 (original capture). Forum · All archived topics · Wiki · Bug tracker · Blog

War3:Source

Development => Tutorials => Topic started by: rostex on March 09, 2011, 01:58:00 PM



Title: [How To] Add translation in custom race
Post by: rostex on March 09, 2011, 01:58:00 PM
First of all you need to download race in .sp format.
So, then open .sp file in notepad.

Add this line in public OnPluginStart()
Code:
LoadTranslations("w3s.race.<shortname>.phrases");

<shortname> - short name of race. For example paladin => w3s.race.paladin.phrases

Then you need to edit some description in public OnWar3LoadRaceOrItemOrdered2()
Example code without translation
Code:
thisRaceID=War3_CreateNewRace("Full_race_name","Short_race_name");
SKILL_DEFENSIVE=War3_AddRaceSkill(thisRaceID,"Name_of_Skill1","Description_of_Skill1",false,4);
SKILL_OFFENSIVE=War3_AddRaceSkill(thisRaceID,"Name_of_Skill2","Description_of_Skill2",false,4);
SKILL_HEALING=War3_AddRaceSkill(thisRaceID,"Name_of_Skill3","Description_of_Skill3",false,4);
ULT_OVERDRIVE=War3_AddRaceSkill(thisRaceID,"Name_of_Skill4","Description_of_Skill4",true,4);
War3_CreateRaceEnd(thisRaceID);

It should look like that
Code:
thisRaceID=War3_CreateNewRaceT("paladin");
SKILL_DEFENSIVE=War3_AddRaceSkillT(thisRaceID,"Name_of_Skill1",false,4);
SKILL_OFFENSIVE=War3_AddRaceSkillT(thisRaceID,"Name_of_Skill2",false,4);
SKILL_HEALING=War3_AddRaceSkillT(thisRaceID,"Name_of_Skill3",false,4);
ULT_OVERDRIVE=War3_AddRaceSkillT(thisRaceID,"Name_of_Skill4",true,4);
War3_CreateRaceEnd(thisRaceID);

Pay attention on T after War3_AddRaceSkill. Only with this code translation would be work correctly.
Yes, you need to remove "Description_of_Skill". We add description later. "Name_of_Skill" should be without space.
Save file...

Ok, now creat a txt file and we add translation.
Example of translation:
Code:
"Phrases"
{
//<shortname>_RaceName
"<shortname>_RaceName"
{
"en" "Full_race_name"
}

//skills:
//<shortname>_skill_<SkillNameIdentifier> for the skill name
//<shortname>_skill_<SkillNameIdentifier>_desc for the skill description
"<shortname>_skill_<SkillNameIdentifier>"
{
"en" "Name of Skill1"
}
"<shortname>_skill_<SkillNameIdentifier>_desc"
{
"en" "Description of Skill4"
}

"<shortname>_skill_<SkillNameIdentifier>"
{
"en" "Name of Skill1"
}
"<shortname>_skill_<SkillNameIdentifier>_desc"
{
"en" "Description of Skill4"
}

"<shortname>_skill_<SkillNameIdentifier>"
{
"en" "Name of Skill1"
}
"<shortname>_skill_<SkillNameIdentifier>_desc"
{
"en" "Description of Skill4"
}

"<shortname>_skill_<SkillNameIdentifier>"
{
"en" "Name of Skill1"
}
"<shortname>_skill_<SkillNameIdentifier>_desc"
{
"en" "Description of Skill4"
}

}

This code have same hints but im repeat that

"<shortname>_RaceName" - it easy... example: "paladin_RaceName"
"<shortname>_skill_<SkillNameIdentifier>" - for the skill name. Example: "paladin_skill_DefensiveAura"
"<shortname>_skill_<SkillNameIdentifier>_desc" - for the skill description. Example: "paladin_skill_DefensiveAura_desc"

If you want to add another language you need edit "en" to your language (for example "ru") and translate description.

How it looks...
Code:
"Phrases"
{
//<shortname>_RaceName
"paladin_RaceName"
{
"en" "Paladin"
}

//skills:
//<shortname>_skill_<SkillNameIdentifier> for the skill name
//<shortname>_skill_<SkillNameIdentifier>_desc for the skill description
"paladin_skill_DefensiveAura"
{
"en" "Defensive Aura"
}
"paladin_skill_DefensiveAura_desc"
{
"en" "Give your teammates extra armor. You receive half of the benefits."
}

"paladin_skill_OffensiveAura"
{
"en" "Offensive Aura"
}
"paladin_skill_OffensiveAura_desc"
{
"en" "Give your teammates extra damage. You receive half of the benefits."
}

"paladin_skill_HealingAura"
{
"en" "Healing Aura"
}
"paladin_skill_HealingAura_desc"
{
"en" "Give your teammates passive regeneration. You receive half of the benefits."
}

"paladin_skill_AuraOverdrive"
{
"en" "Aura Overdrive"
}
"paladin_skill_AuraOverdrive_desc"
{
"en" "Activate all auras at once, giving you full benefits."
}

}

Finally, save your translation.
Translation should named w3s.race.<shortname>.phrases.txt (example: w3s.race.paladin.phrases.txt)

I think thats all...
You need to compile the .sp file, upload into the server, restart your server...

P.S. Sorry for English. If you find some mistake correct me...


Title: Re: [How To] Add translation in custom race
Post by: -El Diablo on May 12, 2012, 08:01:40 AM
I understand what your saying so far, but I don't see where some of these translations are coming from unless you watch for them in game:

For example: w3s.race.undead.phrases

   "Suicide bomber BUILDING damage: {amount} at distance {amount}"
   {
      "#format"   "{1:d},{2:f}"
      "en"      "[W3S] Suicide bomber BUILDING damage: {1} at distance {2}"
   }
   "Player {player} has immunity (protecting buildings)"
   {
      "#format"   "{1:d}"
      "en"      "[W3S] Player {1} has immunity (protecting buildings)"
   }
   "Suicide bomber damage: {amount} to {amount} at distance {amount}"
   {
      "#format"   "{1:d},{2:d},{3:f}"
      "en"      "[W3S] Suicide bomber damage: {1} to {2} at distance {3}"
   }
   "Could not damage player {player} due to immunity"
   {
      "#format"   "{1:d}"
      "en"      "[W3S] Could not damage player {1} due to immunity"
   }
   "Leeched +{amount} HP"
   {
      "#format"   "{1:d}"
      "en"      "[W3S] Leeched +{1} HP"
   }
}


Inside the source file War3Source_001_UndeadScourge.sp
I can not find these phrases.  It's as if these phrases must be during the game play and the phrase file is catching them??

I've read the Translations (SourceMod Scripting) webpage, and I think I'm on the right track, but can someone help me further understand the extras that are inside the phrases.txt files for the races?

I want to add translations to my new races.  Thanks.


Title: Re: [How To] Add translation in custom race
Post by: Ownz on May 14, 2012, 06:05:01 PM
yes he did miss the part of changing the phrases in prints inside the races themselves