Merge nemo's VideoRec commit
authorWuzzy <Wuzzy2@mail.ru>
Fri, 21 Dec 2018 16:55:34 +0100
changeset 14498 e78c44ae94da
parent 14497 6c62f7ebea45 (diff)
parent 14481 f86bd14a7613 (current diff)
child 14499 cc358e997e32
Merge nemo's VideoRec commit
--- a/ChangeLog.txt	Wed Dec 19 19:00:29 2018 -0500
+++ b/ChangeLog.txt	Fri Dec 21 16:55:34 2018 +0100
@@ -11,6 +11,7 @@
  + Restructure credits
  + Credits screen in main menu is now translatable
  + Don't show crate spawn message for initial crates in missions
+ * Use player-chosen team identity in campaigns and singleplayer missions
  * Fix last 2 characters in demo chat being missing
  * King Mode: Fix team sometimes not being killed properly if king drowned
  * King Mode: Kill resurrected minions if king is not alive
@@ -23,8 +24,13 @@
  + New call: GetMissionVar(varname): Get value of mission variable
  + New call: SetTurnTimePaused(isPaused): Call with true to pause turn time, false to unpause
  + New call: GetTurnTimePaused(): Returns true if turn time is paused due to Lua
+ + New call: AddMissionTeam(color): Add mission team, i.e. the team selected by player in campaign/mission page
+ + New call: AddMissionHog(health): Add a hedgehog for the mission team
+ + New return value: AddTeam/AddMissionTeam return <real team name>, <team index>
  + Utils library: New calls: getReadableChallengeRecord, updateChallengeRecord
  + New callback: onGameResult(winningClan): Called when the game ends normally. winningClan = index of winning clan or -1 on draw
+ + SimpleMission: Add isMissionTeam attribute for teams
+ + SpeedShoppa/TargetPractice libraries: Remove custom hog and team info settings
  + Params explode, poison in the SpawnFake*Crate functions now optional and default to false
 
 ====================== 0.9.25 ======================
--- a/QTfrontend/game.cpp	Wed Dec 19 19:00:29 2018 -0500
+++ b/QTfrontend/game.cpp	Fri Dec 21 16:55:34 2018 +0100
@@ -29,6 +29,8 @@
 
 #include "hwform.h"
 #include "ui/page/pageoptions.h"
+#include "ui/page/pagetraining.h"
+#include "ui/page/pagecampaign.h"
 #include "game.h"
 #include "hwconsts.h"
 #include "gameuiconfig.h"
@@ -183,6 +185,14 @@
 {
     QByteArray traincfg;
     HWProto::addStringToBuffer(traincfg, "TL");
+
+    HWTeam missionTeam = HWTeam();
+    missionTeam.setName(config->Form->ui.pageTraining->CBTeam->currentText());
+    missionTeam.loadFromFile();
+    missionTeam.setNumHedgehogs(HEDGEHOGS_PER_TEAM);
+    missionTeam.setMissionTeam(true);
+    HWProto::addStringListToBuffer(traincfg, missionTeam.teamGameConfig(100));
+
     HWProto::addStringToBuffer(traincfg, "eseed " + QUuid::createUuid().toString());
     HWProto::addStringToBuffer(traincfg, "escript " + trainingScript);
 
@@ -193,8 +203,15 @@
 {
     QByteArray campaigncfg;
     HWProto::addStringToBuffer(campaigncfg, "TL");
+
+    HWTeam missionTeam = HWTeam();
+    missionTeam.setName(config->Form->ui.pageCampaign->CBTeam->currentText());
+    missionTeam.loadFromFile();
+    missionTeam.setNumHedgehogs(HEDGEHOGS_PER_TEAM);
+    missionTeam.setMissionTeam(true);
+    HWProto::addStringListToBuffer(campaigncfg, missionTeam.teamGameConfig(100));
+
     HWProto::addStringToBuffer(campaigncfg, "eseed " + QUuid::createUuid().toString());
-
     HWProto::addStringToBuffer(campaigncfg, "escript " + campaignScript);
 
     RawSendIPC(campaigncfg);
--- a/QTfrontend/team.cpp	Wed Dec 19 19:00:29 2018 -0500
+++ b/QTfrontend/team.cpp	Fri Dec 21 16:55:34 2018 +0100
@@ -35,6 +35,7 @@
     , m_difficulty(0)
     , m_numHedgehogs(4)
     , m_isNetTeam(false)
+    , m_isMissionTeam(false)
 {
     m_name = teamname;
     OldTeamName = m_name;
@@ -61,6 +62,7 @@
     QObject(0)
     , m_numHedgehogs(4)
     , m_isNetTeam(true)
+    , m_isMissionTeam(false)
 {
     // net teams are configured from QStringList
     if(strLst.size() != 23) throw HWTeamConstructException();
@@ -88,6 +90,7 @@
     , m_difficulty(0)
     , m_numHedgehogs(4)
     , m_isNetTeam(false)
+    , m_isMissionTeam(false)
 {
     m_name = QString("Team");
     for (int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
@@ -125,6 +128,7 @@
     , m_numHedgehogs(other.m_numHedgehogs)
     , m_color(other.m_color)
     , m_isNetTeam(other.m_isNetTeam)
+    , m_isMissionTeam(other.m_isMissionTeam)
     , m_owner(other.m_owner)
 //      , AchievementProgress(other.AchievementProgress)
 {
@@ -149,6 +153,7 @@
         m_isNetTeam = other.m_isNetTeam;
         m_owner = other.m_owner;
         m_color = other.m_color;
+        m_isMissionTeam = other.m_isMissionTeam;
     }
 
     return *this;
@@ -243,12 +248,25 @@
 QStringList HWTeam::teamGameConfig(quint32 InitHealth) const
 {
     QStringList sl;
+    QString cmdAddHog = "eaddhh";
+
     if (m_isNetTeam)
     {
         sl.push_back(QString("eaddteam %3 %1 %2").arg(qcolor().rgb() & 0xffffff).arg(m_name).arg(QString(QCryptographicHash::hash(m_owner.toUtf8(), QCryptographicHash::Md5).toHex())));
         sl.push_back("erdriven");
     }
-    else sl.push_back(QString("eaddteam %3 %1 %2").arg(qcolor().rgb() & 0xffffff).arg(m_name).arg(playerHash));
+    else
+    {
+        if (m_isMissionTeam)
+        {
+            sl.push_back(QString("esetmissteam %3 %1 %2").arg(qcolor().rgb() & 0xffffff).arg(m_name).arg(playerHash));
+            cmdAddHog = "eaddmisshh";
+        }
+        else
+        {
+            sl.push_back(QString("eaddteam %3 %1 %2").arg(qcolor().rgb() & 0xffffff).arg(m_name).arg(playerHash));
+        }
+    }
 
     sl.push_back(QString("egrave " + m_grave));
     sl.push_back(QString("efort " + m_fort));
@@ -260,7 +278,7 @@
 
     for (int t = 0; t < m_numHedgehogs; t++)
     {
-        sl.push_back(QString("eaddhh %1 %2 %3")
+        sl.push_back(QString(cmdAddHog + " %1 %2 %3")
                      .arg(QString::number(m_difficulty),
                           QString::number(InitHealth),
                           m_hedgehogs[t].Name));
@@ -281,6 +299,15 @@
     return m_isNetTeam;
 }
 
+void HWTeam::setMissionTeam(bool isMissionTeam)
+{
+    m_isMissionTeam = isMissionTeam;
+}
+
+bool HWTeam::isMissionTeam() const
+{
+    return m_isMissionTeam;
+}
 
 bool HWTeam::operator==(const HWTeam& t1) const
 {
--- a/QTfrontend/team.h	Wed Dec 19 19:00:29 2018 -0500
+++ b/QTfrontend/team.h	Fri Dec 21 16:55:34 2018 +0100
@@ -72,6 +72,7 @@
         QString grave() const;
         const HWHog & hedgehog(unsigned int idx) const;
         bool isNetTeam() const;
+        bool isMissionTeam() const;
         QString keyBind(unsigned int idx) const;
         QString name() const;
         unsigned char numHedgehogs() const;
@@ -89,6 +90,7 @@
         void setNumHedgehogs(unsigned char num);
         void setVoicepack(const QString & voicepack);
         void setNetTeam(bool isNetTeam);
+        void setMissionTeam(bool isMissionTeam);
 
         // convert team info into strings for further computation
         QStringList teamGameConfig(quint32 InitHealth) const;
@@ -119,6 +121,7 @@
         quint8 m_numHedgehogs;
         int m_color;
         bool m_isNetTeam;
+        bool m_isMissionTeam;
         QString m_owner;
 
         // class members that contain statistics, etc.
--- a/hedgewars/uScript.pas	Wed Dec 19 19:00:29 2018 -0500
+++ b/hedgewars/uScript.pas	Fri Dec 21 16:55:34 2018 +0100
@@ -2290,7 +2290,9 @@
         else
             begin
             OutError('Lua error: AddTeam: Invalid ''color'' argument, must be between '+IntToStr(-cClanColors)+' and 0xffffffff!', true);
-            lc_addteam:= 0;
+            lua_pushnil(L);
+            lua_pushnil(L);
+            lc_addteam:= 2;
             exit;
             end;
         ParseCommand('addteam x ' + colorStr + ' ' + lua_tostring(L, 1), true, true);
@@ -2298,13 +2300,64 @@
         ParseCommand('fort ' + lua_tostring(L, 4), true, true);
         ParseCommand('voicepack ' + lua_tostring(L, 5), true, true);
         if (np = 6) then ParseCommand('flag ' + lua_tostring(L, 6), true, true);
-        CurrentTeam^.Binds:= DefaultBinds
-        // fails on x64
-        //lua_pushnumber(L, LongInt(CurrentTeam));
+        CurrentTeam^.Binds:= DefaultBinds;
+        // push team name and index
+        lua_pushstring(L, str2pchar(CurrentTeam^.TeamName));
+        lua_pushnumber(L, TeamsCount - 1);
+        end
+    else
+        begin
+        lua_pushnil(L);
+        lua_pushnil(L);
         end;
-    //else
-        //lua_pushnil(L)
-    lc_addteam:= 0;//1;
+    lc_addteam:= 2;
+end;
+
+function lc_addmissionteam(L : Plua_State) : LongInt; Cdecl;
+var colorArg: Int64;
+    colorStr: shortstring;
+begin
+    if CheckLuaParamCount(L, 1, 'AddMissionTeam', 'color') then
+        begin
+        if(MissionTeam = nil) then
+            begin
+            OutError('Lua error: AddMissionTeam: Could not add team. Note: This function only works in singleplayer missions!', true);
+            lc_addmissionteam:= 0;
+            exit;
+            end;
+
+        colorArg:= Trunc(lua_tonumber(L, 1));
+        if (colorArg < 0) and (abs(colorArg) <= cClanColors) then
+            // Pick clan color from settings (recommended)
+            colorStr:= IntToStr(ClanColorArray[Pred(abs(colorArg))])
+        else if (colorArg >= 0) and (colorArg <= $ffffffff) then
+            // Specify color directly
+            colorStr:= IntToStr(colorArg)
+        else
+            begin
+            OutError('Lua error: AddMissionTeam: Invalid ''color'' argument, must be between '+IntToStr(-cClanColors)+' and 0xffffffff!', true);
+            lua_pushnil(L);
+            lua_pushnil(L);
+            lc_addmissionteam:= 2;
+            exit;
+            end;
+
+        ParseCommand('addteam x ' + colorStr + ' ' + MissionTeam^.TeamName, true, true);
+        ParseCommand('grave ' + MissionTeam^.GraveName, true, true);
+        ParseCommand('fort ' + MissionTeam^.FortName, true, true);
+        ParseCommand('voicepack ' + MissionTeam^.Voicepack^.name, true, true);
+        ParseCommand('flag ' + MissionTeam^.Flag, true, true);
+        CurrentTeam^.Binds:= DefaultBinds;
+        // push real team name and team index
+        lua_pushstring(L, str2pchar(CurrentTeam^.TeamName));
+        lua_pushnumber(L, TeamsCount - 1);
+        end
+    else
+        begin
+        lua_pushnil(L);
+        lua_pushnil(L);
+        end;
+    lc_addmissionteam:= 2;
 end;
 
 function lc_setteamlabel(L : Plua_State) : LongInt; Cdecl;
@@ -2499,13 +2552,13 @@
 
 
 function lc_addhog(L : Plua_State) : LongInt; Cdecl;
-var temp: ShortString;
+var hatName: ShortString;
 begin
     if CheckLuaParamCount(L, 4, 'AddHog', 'hogname, botlevel, health, hat') then
         begin
-        temp:= lua_tostring(L, 4);
+        hatName:= lua_tostring(L, 4);
         ParseCommand('addhh ' + lua_tostring(L, 2) + ' ' + lua_tostring(L, 3) + ' ' + lua_tostring(L, 1), true, true);
-        ParseCommand('hat ' + temp, true, true);
+        ParseCommand('hat ' + hatName, true, true);
         lua_pushnumber(L, CurrentHedgehog^.Gear^.uid);
         end
     else
@@ -2513,6 +2566,31 @@
     lc_addhog:= 1;
 end;
 
+function lc_addmissionhog(L : Plua_State) : LongInt; Cdecl;
+var hatName: ShortString;
+begin
+    if CheckLuaParamCount(L, 1, 'AddMissionHog', 'health') then
+        begin
+        if(MissionTeam = nil) then
+            begin
+            OutError('Lua error: AddMissionHog: Could not add hog. Mission team is not set!', true);
+            lua_pushnil(L);
+            lc_addmissionhog:= 1;
+            exit;
+            end;
+        with MissionTeam^.Hedgehogs[CurrentTeam^.HedgehogsNumber] do
+            begin
+            hatName:= Hat;
+            ParseCommand('addhh ' + IntToStr(BotLevel) + ' ' + lua_tostring(L, 1) + ' ' + Name, true, true);
+            ParseCommand('hat ' + hatName, true, true);
+            end;
+        lua_pushnumber(L, CurrentHedgehog^.Gear^.uid);
+        end
+    else
+        lua_pushnil(L);
+    lc_addmissionhog:= 1;
+end;
+
 function lc_hogturnleft(L : Plua_State) : LongInt; Cdecl;
 var gear: PGear;
 begin
@@ -4289,8 +4367,10 @@
 lua_register(luaState, _P'GetTeamIndex', @lc_getteamindex);
 lua_register(luaState, _P'GetTeamClan', @lc_getteamclan);
 lua_register(luaState, _P'AddTeam', @lc_addteam);
+lua_register(luaState, _P'AddMissionTeam', @lc_addmissionteam);
 lua_register(luaState, _P'SetTeamLabel', @lc_setteamlabel);
 lua_register(luaState, _P'AddHog', @lc_addhog);
+lua_register(luaState, _P'AddMissionHog', @lc_addmissionhog);
 lua_register(luaState, _P'AddAmmo', @lc_addammo);
 lua_register(luaState, _P'GetAmmoCount', @lc_getammocount);
 lua_register(luaState, _P'HealHog', @lc_healhog);
--- a/hedgewars/uTeams.pas	Wed Dec 19 19:00:29 2018 -0500
+++ b/hedgewars/uTeams.pas	Fri Dec 21 16:55:34 2018 +0100
@@ -29,6 +29,7 @@
 procedure freeModule;
 
 function  AddTeam(TeamColor: Longword): PTeam;
+function  SetMissionTeam(): PTeam;
 procedure SwitchHedgehog;
 procedure AfterSwitchHedgehog;
 procedure InitTeams;
@@ -476,6 +477,19 @@
     end;
 end;
 
+function SetMissionTeam(): PTeam;
+var team: PTeam;
+begin
+New(team);
+if checkFails(team <> nil, 'AddTeam: team = nil', true) then exit(nil);
+FillChar(team^, sizeof(TTeam), 0);
+team^.HedgehogsNumber:= 0;
+
+CurrentTeam:= team;
+MissionTeam:= team;
+SetMissionTeam:= team;
+end;
+
 function AddTeam(TeamColor: Longword): PTeam;
 var team: PTeam;
     c: LongInt;
@@ -679,6 +693,30 @@
                     end
 end;
 
+procedure chAddMissionHH(var id: shortstring);
+var s: shortstring;
+    Health: LongInt;
+begin
+s:= '';
+if (not isDeveloperMode) then
+    exit;
+if checkFails((CurrentTeam <> nil), 'Can''t add hedgehogs yet, add a team first!', true) then exit;
+with CurrentTeam^ do
+    begin
+    if checkFails(HedgehogsNumber<=cMaxHHIndex, 'Can''t add hedgehog to "' + TeamName + '"! (already ' + intToStr(HedgehogsNumber) + ' hogs)', true) then exit;
+    SplitBySpace(id, s);
+    CurrentHedgehog:= @Hedgehogs[HedgehogsNumber];
+    CurrentHedgehog^.BotLevel:= StrToInt(id);
+    CurrentHedgehog^.Team:= CurrentTeam;
+    SplitBySpace(s, id);
+    Health:= StrToInt(s);
+    if checkFails((Health > 0) and (Health <= cMaxHogHealth), 'Invalid hedgehog health (must be between 1 and '+IntToStr(cMaxHogHealth)+')', true) then exit;
+    CurrentHedgehog^.Name:= id;
+    CurrentHedgehog^.InitialHealth:= Health;
+    inc(HedgehogsNumber)
+    end
+end;
+
 procedure chAddHH(var id: shortstring);
 var s: shortstring;
     Gear: PGear;
@@ -729,6 +767,58 @@
     loadBinds('bind', s);
 end;
 
+// Make sure the team name of chTeam is unique.
+// If it isn't, the name is changed to be unique.
+procedure makeTeamNameUnique(chTeam: PTeam);
+var tail: shortstring;
+    t, numLen, numTail: LongInt;
+    valOK: Word;
+    nameDupeCheck: boolean;
+    chChar: char;
+begin
+    nameDupeCheck:= false;
+    while(nameDupeCheck = false) do
+        begin
+        nameDupeCheck:= true;
+        for t:=0 to TeamsCount - 1 do
+            begin
+            // Name collision?
+            if (chTeam <> teamsArray[t]) and (TeamsArray[t]^.TeamName = chTeam^.TeamName) then
+                begin
+                // Change the name by appending a sequence number, starting from 2
+                numLen:= 0;
+                chChar:= chTeam^.TeamName[Length(chTeam^.TeamName) - numLen];
+                // Parse number at end of team name (if any)
+                while (chChar >= '0') and (chChar <= '9') and (numLen < Length(chTeam^.TeamName)) do
+                    begin
+                    inc(numLen);
+                    chChar:= chTeam^.TeamName[Length(chTeam^.TeamName) - numLen];
+                    end;
+
+                if numLen > 0 then
+                    // Number found: Increment it by 1
+                    begin
+                    tail:= Copy(chTeam^.TeamName, Length(chTeam^.TeamName) - numLen + 1, numLen);
+                    valOK:= 1;
+                    Val(tail, numTail, valOK);
+                    Inc(numTail);
+                    if valOK = 0 then
+                        tail:= IntToStr(numTail)
+                    else
+                        // This should not happen
+                        tail:= 'X';
+                    chTeam^.TeamName:= Copy(chTeam^.TeamName, 0, Length(chTeam^.TeamName) - numLen) + tail;
+                    end
+                else
+                    // No number at team end: Just append a '2'
+                    chTeam^.TeamName:= chTeam^.TeamName + ' 2';
+                nameDupeCheck:= false;
+                break;
+                end;
+            end;
+        end;
+end;
+
 procedure chAddTeam(var s: shortstring);
 var Color: Longword;
     ts, cs: shortstring;
@@ -744,10 +834,12 @@
     // color is always little endian so the mask must be constant also in big endian archs
     Color:= Color or $FF000000;
     AddTeam(Color);
-    
+
     if CurrentTeam <> nil then
         begin
         CurrentTeam^.TeamName:= ts;
+        makeTeamNameUnique(CurrentTeam);
+
         CurrentTeam^.PlayerHash:= s;
         loadTeamBinds(ts);
 
@@ -759,6 +851,27 @@
     end
 end;
 
+procedure chSetMissionTeam(var s: shortstring);
+var ts, cs: shortstring;
+begin
+cs:= '';
+ts:= '';
+if isDeveloperMode then
+    begin
+    SplitBySpace(s, cs);
+    SplitBySpace(cs, ts);
+
+    SetMissionTeam();
+
+    if CurrentTeam <> nil then
+        begin
+        CurrentTeam^.TeamName:= ts;
+        CurrentTeam^.PlayerHash:= s;
+        CurrentTeam^.voicepack:= AskForVoicepack('Default')
+        end
+    end
+end;
+
 procedure chSetHHCoords(var x: shortstring);
 var y: shortstring;
     t: Longint;
@@ -941,7 +1054,9 @@
 procedure initModule;
 begin
 RegisterVariable('addhh', @chAddHH, false);
+RegisterVariable('addmisshh', @chAddMissionHH, false);
 RegisterVariable('addteam', @chAddTeam, false);
+RegisterVariable('setmissteam', @chSetMissionTeam, false);
 RegisterVariable('hhcoords', @chSetHHCoords, false);
 RegisterVariable('bind', @chBind, true );
 RegisterVariable('teamgone', @chTeamGone, true );
--- a/hedgewars/uVariables.pas	Wed Dec 19 19:00:29 2018 -0500
+++ b/hedgewars/uVariables.pas	Fri Dec 21 16:55:34 2018 +0100
@@ -2488,6 +2488,7 @@
 
     CurrentTeam: PTeam;
     PreviousTeam: PTeam;
+    MissionTeam: PTeam;
     CurrentHedgehog: PHedgehog;
     TeamsArray: array[0..Pred(cMaxTeams)] of PTeam;
     TeamsCount: Longword; // number of teams on game start
@@ -2941,6 +2942,7 @@
     GearsList:= nil;
     CurrentTeam:= nil;
     PreviousTeam:= nil;
+    MissionTeam:= nil;
     CurrentHedgehog:= nil;
     FollowGear:= nil;
     lastVisualGearByUID:= nil;
--- a/share/hedgewars/Data/Locale/campaigns_de.txt	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Locale/campaigns_de.txt	Fri Dec 21 16:55:34 2018 +0100
@@ -19,10 +19,10 @@
 A_Classic_Fairytale-dragon.desc="Unser Held muss auf die andere Seite des Sees kommen. Werd zum Seilprofi und vermeide es, von feindlichen Schüssen getroffen zu werden."
 
 A_Classic_Fairytale-family.name="7. Mission: Familientreffen"
-A_Classic_Fairytale-family.desc="Unser Held muss erneut die Eingeborenen retten. Eliminiere die feindlichen Igel und befreie deine Kameraden. Benutze deine Ressourcen vorsichtig, weil sie begrenzt sind. Bohr ein paar Löcher an den richtigen Stellen und nähere dich der Prinzessin."
+A_Classic_Fairytale-family.desc="Unser Held muss erneut den Stamm retten. Eliminiere die feindlichen Igel und befreie deine Kameraden. Benutze deine Ressourcen vorsichtig, weil sie begrenzt sind. Bohr ein paar Löcher an den richtigen Stellen und nähere dich der Prinzessin."
 
 A_Classic_Fairytale-queen.name="8. Mission: Lang lebe die Königin"
-A_Classic_Fairytale-queen.desc="Die Eingeborenen müssen noch einmal kämpfen. Um zu gewinnen, müssen sie den Verräter bekämpfen und alle verfügbaren Ressourcen benutzen. Besieg den Feind!"
+A_Classic_Fairytale-queen.desc="Der Stamm muss noch einmal kämpfen. Um zu gewinnen, müssen die Igel den Verräter bekämpfen und alle verfügbaren Ressourcen benutzen. Besieg den Feind!"
 
 A_Classic_Fairytale-enemy.name="9. Mission: Der Feind meines Feindes"
 A_Classic_Fairytale-enemy.desc="Was für eine umwerfende Wendung! Undichte Stelle muss mit den … »Kannibalen« gegen den gemeinsamen Feind – die bösen Cyborgs – kämpfen!"
@@ -33,43 +33,43 @@
 A_Space_Adventure.name="Ein Weltraumabenteuer"
 
 A_Space_Adventure-cosmos.name="Menü: Weltraumreise"
-A_Space_Adventure-cosmos.desc="Hogera, der Igelplanet, wird bald von einem riesigen Meteorit getroffen. In diesem Wettlauf ums Überleben musst du PAdIs besten Piloten, Igel Einsam, in einer Weltraumreise um die Nachbarplaneten führen, um alle 4 Teile des lang verschollenem Antigravitationsgeräts zu finden!"
+A_Space_Adventure-cosmos.desc="Hogera, der Igelplanet, wird bald von einem riesigen Meteorit getroffen. In diesem Wettlauf ums Überleben musst du einen mutigen Igel, der von der Planetaren Assoziation der Igel (PAdI) beauftragt wurde, in einer Weltraumreise um die Nachbarplaneten führen, um alle 4 Teile des lang verschollenem Antigravitationsgeräts zu finden."
 
 A_Space_Adventure-moon01.name="Hauptmission: Der erste Halt"
-A_Space_Adventure-moon01.desc="Igel Einsam ist auf dem Mond gelandet, um seine fliegende Untertasse aufzutanken, aber Prof. Bösigel war zuerst da und hat einen Hinterhalt aufgestellt! Rette die gefangenen PAdI-Forscher und verscheuche Prof. Bösigel!"
+A_Space_Adventure-moon01.desc="Unser Held ist auf dem Mond gelandet, um die fliegende Untertasse aufzutanken, aber Prof. Bösigel war zuerst da und hat einen Hinterhalt aufgestellt! Rette die gefangenen PAdI-Forscher und verscheuche Prof. Bösigel!"
 
 A_Space_Adventure-moon02.name="Nebenmission: Jag den blauen Igel"
-A_Space_Adventure-moon02.desc="Igel Einsam besucht einen Eremiten, einen alten PAdI-Veteran, der im Mond lebt, um Prof. Bösigel auszuspionieren. Allerdings muss er den Eremiten, Verrückter Renner, zuerst in einem Wettlauf besiegen!"
+A_Space_Adventure-moon02.desc="Unser Held besucht einen Eremiten, einen alten PAdI-Veteranen, der im Mond lebt, um Prof. Bösigel auszuspionieren. Allerdings musst du den Eremiten, Verrückter Renner, zuerst in einem Wettlauf besiegen!"
 
 A_Space_Adventure-ice01.name="Hauptmission: Ein frostiges Abenteuer"
-A_Space_Adventure-ice01.desc="Willkommen auf dem Planeten des Eises. Hier ist es so kalt, dass die meisten Waffen von Igel Einsam nicht funktionieren werden. Du musst dir das verlorene Teil von dem Banditenanführer Thanta ergattern, indem du die Waffen, die du hier findest, verwendest!"
+A_Space_Adventure-ice01.desc="Willkommen auf dem Planeten des Eises. Hier ist es so kalt, dass die meisten Waffen nicht funktionieren werden. Du musst dir das verlorene Teil von dem Banditenanführer Thanta ergattern, indem du die Waffen, die du hier findest, verwendest!"
 
 A_Space_Adventure-ice02.name="Nebenmission: Schwerer Flug"
-A_Space_Adventure-ice02.desc="Igel Einsam konnte nicht einfach nur den Eisplaneten besuchen, ohne das Olympiastadion des Untertassenfliegens zu besuchen! In dieser Mission kannst du deine Flugkünste unter Beweis stellen und deinen Platz unter den Besten einnehmen!"
+A_Space_Adventure-ice02.desc="Unser Held konnte nicht einfach nur den Eisplaneten besuchen, ohne das Olympiastadion des Untertassenfliegens zu besuchen! In dieser Mission kannst du deine Flugkünste unter Beweis stellen und deinen Platz unter den Besten einnehmen!"
 
 A_Space_Adventure-desert01.name="Hauptmission: Suche im Staub"
-A_Space_Adventure-desert01.desc="Du bist auf dem Planeten aus Sand gelandet! Igel Einsam muss das fehlende Teil in den Bergwerksstollen finden. Sei vorsichtig, weil bösartige Schmuggler nur darauf warten, dich anzugreifen und auszurauben!"
+A_Space_Adventure-desert01.desc="Du bist auf dem Planeten aus Sand gelandet! Unser Held muss das fehlende Teil in den Bergwerksstollen finden. Sei vorsichtig, weil bösartige Schmuggler nur darauf warten, dich anzugreifen und auszurauben!"
 
 A_Space_Adventure-desert02.name="Nebenmission: Lauf um dein Leben"
-A_Space_Adventure-desert02.desc="Igel Einsam suchte nach dem Teil in diesem Tunnel, als er unerwarteterweise anfing, geflutet zu werden! Komm so schnell wie möglich zur Oberfläche und pass auf, keine Mine auszulösen."
+A_Space_Adventure-desert02.desc="Unser Held suchte nach dem Teil in diesem Tunnel, als er unerwarteterweise anfing, geflutet zu werden! Komm so schnell wie möglich zur Oberfläche und pass auf, keine Mine auszulösen."
 
 A_Space_Adventure-desert03.name="Nebenmission: Präzisionsfliegen"
-A_Space_Adventure-desert03.desc="Igel Einsam hat etwas Zeit, um sein Funkflugzeug zu fliegen und etwas Spaß zu haben. Flieg das Funkflugzeug und triff alle Ziele!"
+A_Space_Adventure-desert03.desc="Unser Held hat etwas Zeit, um mit Funkflugzeugen zu spielen und etwas Spaß zu haben. Flieg das Funkflugzeug und triff alle Ziele!"
 
 A_Space_Adventure-fruit01.name="Hauptmission: Schlechtes Timing"
 A_Space_Adventure-fruit01.desc="Auf dem Obstplaneten laufen die Dinge nicht so gut. Igel sammeln kein Obst, sondern sie bereiten sich auf den Kampf vor. Du musst dich entscheiden, ob du kämpfen oder fliehen wirst."
 
 A_Space_Adventure-fruit02.name="Hauptmission: Zum Greifen nah"
-A_Space_Adventure-fruit02.desc="Igel Einsam nähert sich dem verlorenen Teil des Obstplaneten. Wird ihn Leutnant Limone dabei helfen, das Teil zu besorgen? Oder nicht?"
+A_Space_Adventure-fruit02.desc="Unser Held nähert sich dem verlorenen Teil des Obstplaneten. Wird ihn Leutnant Limone dabei helfen, das Teil zu besorgen? Oder nicht?"
 
 A_Space_Adventure-fruit03.name="Nebenmission: Präzisionsschießen"
-A_Space_Adventure-fruit03.desc="Igel Einsam hat sich verlaufen und ist in dem Hinterhalt der Roten Erdbeeren geraten. Hilf ihm, sie zu eliminieren, um etwas zusätzliche Munition für die Mission »Zum Greifen nah« zu gewinnen."
+A_Space_Adventure-fruit03.desc="Unser Held hat sich verlaufen und ist in dem Hinterhalt der Roten Erdbeeren geraten. Hilf ihm, sie zu eliminieren, um etwas zusätzliche Munition für die Mission »Zum Greifen nah« zu gewinnen."
 
 A_Space_Adventure-death01.name="Hauptmission: Das letzte Gefecht" 
-A_Space_Adventure-death01.desc="Auf dem Todesplaneten, dem sterilsten Planeten in der Gegend, ist Igel Einsam ganz kurz davor, das letzte Teil des Geräts zu holen! Allerdings erwartet ihn eine unangenehme Überraschung."
+A_Space_Adventure-death01.desc="Auf dem Todesplaneten, dem sterilsten Planeten in der Gegend, ist unser Held ganz kurz davor, das letzte Teil des Geräts zu holen! Allerdings erwartet ihn eine unangenehme Überraschung."
 
 A_Space_Adventure-death02.name="Nebenmission: Die Spezialisten töten"
-A_Space_Adventure-death02.desc="Igel Einsam ist wieder in eine schwierige Situation geraten. Hilf ihm, die »5 tödlichen Igel« in ihrem eigenem Spiel zu besiegen!"
+A_Space_Adventure-death02.desc="Unser Held ist wieder in eine schwierige Situation geraten. Besiege die »5 tödlichen Igel« in ihrem eigenem Spiel!"
 
 A_Space_Adventure-final.name="Hauptmission: Der große Knall"
-A_Space_Adventure-final.desc="Igel Einsam muss ein paar Sprengkörper, die auf dem Meteoriten platziert wurden, detonieren. Hilf ihm, diese Mission zu beenden, ohne verletzt zu werden!"
+A_Space_Adventure-final.desc="Unser Held muss ein paar Sprengkörper, die auf dem Meteoriten platziert wurden, detonieren. Beende diese Mission, ohne verletzt zu werden!"
--- a/share/hedgewars/Data/Locale/campaigns_en.txt	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Locale/campaigns_en.txt	Fri Dec 21 16:55:34 2018 +0100
@@ -19,10 +19,10 @@
 A_Classic_Fairytale-dragon.desc="Our hero has to get to the other side of the lake. Become a rope master and avoid getting hit by the enemy shots."
 
 A_Classic_Fairytale-family.name="Mission 7: Family Reunion"
-A_Classic_Fairytale-family.desc="Our hero has to save the natives once more. Eliminate the enemy hogs and free your comrades. Use your resources carefully as they are limited. Drill some holes in the right spot and get close to the princess."
+A_Classic_Fairytale-family.desc="Our hero has to save the tribe once more. Eliminate the enemy hogs and free your comrades. Use your resources carefully as they are limited. Drill some holes in the right spot and get close to the princess."
 
 A_Classic_Fairytale-queen.name="Mission 8: Long Live The Queen"
-A_Classic_Fairytale-queen.desc="The natives have to fight once again. In order to win, they'll have to fight the traitor and use all the resources available. Defeat the enemy!"
+A_Classic_Fairytale-queen.desc="The tribe has to fight once again. In order to win, they'll have to fight the traitor and use all the resources available. Defeat the enemy!"
 
 A_Classic_Fairytale-enemy.name="Mission 9: The Enemy Of My Enemy"
 A_Classic_Fairytale-enemy.desc="What a great twist! Leaks a Lot has to fight side by side with the … “cannibals” against the common enemy: The evil cyborgs!"
@@ -32,30 +32,30 @@
 
 A_Space_Adventure.name="A Space Adventure"
 A_Space_Adventure-cosmos.name="Menu: Spacetrip"
-A_Space_Adventure-cosmos.desc="Hogera, the planet of hogs is about to be hit by a gigantic meteorite. In this race for survival you have to lead PAotH's best pilot, Hog Solo, in a space trip around the neighbor planets to collect all the 4 pieces of the long lost anti gravity device!"
+A_Space_Adventure-cosmos.desc="Hogera, the planet of hogs, is about to be hit by a gigantic meteorite. In this race for survival you have to lead a brave hedgehog, who was commissioned by the Planetary Association of the Hedgehogs (PAotH), on a space trip around the neighbor planets to collect all the 4 pieces of the long lost anti gravity device."
 A_Space_Adventure-moon01.name="Main Mission: The first stop"
-A_Space_Adventure-moon01.desc="Hog Solo has landed on the moon to refuel his saucer but professor Hogevil has gone there first and set an ambush! Rescue the captured PAotH researchers and drive Professor Hogevil away!"
+A_Space_Adventure-moon01.desc="Our hero has landed on the moon to refuel the flying saucer but Professor Hogevil has gone there first and set an ambush! Rescue the captured PAotH researchers and drive Professor Hogevil away!"
 A_Space_Adventure-moon02.name="Side Mission: Chasing the blue hog"
-A_Space_Adventure-moon02.desc="Hog Solo visits an hermit, old PAotH veteran, who lives on the moon in order to gather some intel about Prof. Hogevil. However, he has to beat the hermit, Soneek the Crazy Runner, in a chase game first!"
+A_Space_Adventure-moon02.desc="Our hero visits an hermit, old PAotH veteran, who lives on the moon in order to gather some intel about Prof. Hogevil. However, you have to beat the hermit, Crazy Runner, in a chase game first!"
 A_Space_Adventure-ice01.name="Main Mission: A frozen adventure"
-A_Space_Adventure-ice01.desc="Welcome to the planet of ice. Here, it's so cold that most of Hog Solo's weapons won't work. You have to get the lost part from the bandit leader Thanta using the weapons that you'll find there!"
+A_Space_Adventure-ice01.desc="Welcome to the planet of ice. Here, it's so cold that most weapons won't work. You have to get the lost part from the bandit leader Thanta using the weapons that you'll find there!"
 A_Space_Adventure-ice02.name="Side Mission: Hard flying"
-A_Space_Adventure-ice02.desc="Hog Solo couldn't just visit the Ice Planet without visiting the Olympic Stadium of Saucer Flying! In this mission you can prove your flying skills and claim your place among the best!"
+A_Space_Adventure-ice02.desc="Our hero couldn't just visit the Ice Planet without visiting the Olympic Stadium of Saucer Flying! In this mission you can prove your flying skills and claim your place among the best!"
 A_Space_Adventure-desert01.name="Main Mission: Searching in the dust"
-A_Space_Adventure-desert01.desc="You have landed to the planet of sand! Hog Solo has to find the missing part in the underground tunnels. Be careful as vicious smugglers await to attack and rob you!"
+A_Space_Adventure-desert01.desc="You have landed to the planet of sand! Our hero has to find the missing part in the underground tunnels. Be careful as vicious smugglers await to attack and rob you!"
 A_Space_Adventure-desert02.name="Side Mission: Running for survival"
-A_Space_Adventure-desert02.desc="Hog Solo was searching for the part in this tunnel when it unexpectedly start getting flooded! Get to the surface as soon as possible and be careful not to trigger a mine."
+A_Space_Adventure-desert02.desc="Our hero was searching for the part in this tunnel when it unexpectedly start getting flooded! Get to the surface as soon as possible and be careful not to trigger a mine."
 A_Space_Adventure-desert03.name="Side Mission: Precise flying"
-A_Space_Adventure-desert03.desc="Hog Solo has some time to fly his RC plane and have some fun. Fly the RC plane and hit all the targets!"
+A_Space_Adventure-desert03.desc="Our hero has some time to play with RC planes and have some fun. Fly the RC plane and hit all the targets!"
 A_Space_Adventure-fruit01.name="Main Mission: Bad timing"
-A_Space_Adventure-fruit01.desc="In the fruit planet things aren't going so well. Hogs aren't collecting fruits but they are preparing for battle. You'll have to choose if you'll fight or if you'll flee."
+A_Space_Adventure-fruit01.desc="On the fruit planet things aren't going so well. Hogs aren't collecting fruits but they are preparing for battle. You'll have to choose if you'll fight or if you'll flee."
 A_Space_Adventure-fruit02.name="Main Mission: Getting to the device"
-A_Space_Adventure-fruit02.desc="Hog Solo gets closer to the lost part on the Fruit Planet. Will Captain Lime help him acquire the part or not?"
+A_Space_Adventure-fruit02.desc="Our hero gets closer to the lost part on the Fruit Planet. Will Captain Lime help you acquire the part or not?"
 A_Space_Adventure-fruit03.name="Main Mission: Precise shooting"
-A_Space_Adventure-fruit03.desc="Hog Solo got lost and got ambushed by the Red Strawberries. Help him eliminate them and win some extra ammo for the mission “Getting to the device”."
+A_Space_Adventure-fruit03.desc="Our hero got lost and got ambushed by the Red Strawberries. Eliminate them and win some extra ammo for the mission “Getting to the device”."
 A_Space_Adventure-death01.name="Main Mission: The last encounter"
-A_Space_Adventure-death01.desc="On the Death Planet, the most infertile planet around, Hog Solo is very close to get the last part of the device! However, an unpleasant surprise awaits him ..."
+A_Space_Adventure-death01.desc="On the Death Planet, the most infertile planet around, our hero is very close to get the last part of the device! However, an unpleasant surprise awaits ..."
 A_Space_Adventure-death02.name="Side Mission: Killing the specialists"
-A_Space_Adventure-death02.desc="Again Hog Solo has got himself in a difficult situation. Help him defeat the “5 Deadly Hogs“ in their own game!"
+A_Space_Adventure-death02.desc="Again our hero has gotten in a difficult situation. Defeat the “5 Deadly Hogs“ in their own game!"
 A_Space_Adventure-final.name="Main Mission: The big bang"
-A_Space_Adventure-final.desc="Hog Solo has to detonate some explosives that have been placed on the meteorite. Help him complete his mission without getting hurt!"
+A_Space_Adventure-final.desc="Our hero has to detonate some explosives that have been placed on the meteorite. Complete this mission without getting hurt!"
--- a/share/hedgewars/Data/Locale/missions_de.txt	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Locale/missions_de.txt	Fri Dec 21 16:55:34 2018 +0100
@@ -59,7 +59,7 @@
 Big_Armory.desc="Du bist alleine, hast ein volles Arsenal und musst 8 Igel besiegen, bevor die Zeit abläuft."
 
 Bazooka_Battlefield.name=Bazookaschlachtfeld
-Bazooka_Battlefield.desc="Deine treuen Ritter haben den Feind in einen Hinterhalt gelockt. Zerstöre sie nur mit Bazookas! Aber trödel nicht zu lange, denn das Wasser wird bald steigen."
+Bazooka_Battlefield.desc="Deine treuen Igel haben den Feind in einen Hinterhalt gelockt. Zerstöre sie nur mit Bazookas! Aber trödel nicht zu lange, denn das Wasser wird bald steigen."
 
 Tentacle_Terror.name=Tentakel-Terror
 Tentacle_Terror.desc="Unter einem furchtbaren Monster versteckt sich dein Feind wie ein Feigling und wird dich mit Luftangriffen angreifen, sobald du aus der Deckung gehst. Zeig ihm, wer in der Hölle das Sagen hat! Aber du brauchst schon teuflisch gute Seilfähigkeiten, um überhaupt eine Chance zu haben."
--- a/share/hedgewars/Data/Locale/missions_en.txt	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Locale/missions_en.txt	Fri Dec 21 16:55:34 2018 +0100
@@ -53,7 +53,7 @@
 Big_Armory.desc="You are alone, have a full armory and must defeat 8 hedgehogs before the time runs out."
 
 Bazooka_Battlefield.name=Bazooka Battlefield
-Bazooka_Battlefield.desc="Your loyal knights have ambushed the enemy. Destroy them only with bazookas! But don't take too long, the water will rise soon."
+Bazooka_Battlefield.desc="Your loyal hedgehogs have ambushed the enemy. Destroy them only with bazookas! But don't take too long, the water will rise soon."
 
 Tentacle_Terror.name=Tentacle Terror
 Tentacle_Terror.desc="Below a terrible monster, your enemy is hiding like a coward and will attack you with air strikes as soon you lose cover. Show him who's the real boss in Hell! But you need some devilish good roping skills to even stand a chance."
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/backstab.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/backstab.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -143,6 +143,11 @@
 highJumped = false
 TurnsLeft = 0
 startNativesNum = 0
+nativesTeamName = nil
+tribeTeamName = nil
+cyborgTeamName = nil
+cannibalsTeamName1 = nil
+cannibalsTeamName2 = nil
 
 startAnim = {}
 afterChoiceAnim = {}
@@ -680,9 +685,9 @@
 
 function DoDeployedDead()
   ShowMission(loc("Backstab"), loc("Brutus"), loc("You have failed to save the tribe!"), 0, 6000)
-  DismissTeam(loc("Natives"))
-  DismissTeam(loc("Tribe"))
-  DismissTeam(loc("011101001"))
+  DismissTeam(nativesTeamName)
+  DismissTeam(tribeTeamName)
+  DismissTeam(cyborgTeamName)
   EndTurn(true)
 end
 
@@ -725,8 +730,8 @@
 
 function DoKilledOther()
   ShowMission(loc("Backstab"), loc("Brutus"), loc("You have killed an innocent hedgehog!"), 0, 6000)
-  DismissTeam(loc("Natives"))
-  DismissTeam(loc("Tribe"))
+  DismissTeam(nativesTeamName)
+  DismissTeam(tribeTeamName)
   EndTurn(true)
 end
 
@@ -833,10 +838,10 @@
     end
   end
 
-  DismissTeam(loc("Tribe"))
-  DismissTeam(loc("Assault Team"))
-  DismissTeam(loc("Reinforcements"))
-  DismissTeam(loc("011101001"))
+  DismissTeam(tribeTeamName)
+  DismissTeam(cannibalsTeamName1)
+  DismissTeam(cannibalsTeamName2)
+  DismissTeam(cyborgTeamName)
   EndTurn(true)
 end
 
@@ -956,28 +961,28 @@
 end
 
 function AddHogs()
-  AddTeam(loc("Tribe"), -2, "Bone", "Island", "HillBilly", "cm_birdy")
+  tribeTeamName = AddTeam(loc("Tribe"), -2, "Bone", "Island", "HillBilly", "cm_birdy")
   for i = 8, 9 do
     natives[i] = AddHog(nativeNames[i], 0, 100, nativeHats[i])
   end
 
-  AddTeam(loc("Natives"), -2, "Bone", "Island", "HillBilly", "cm_birdy")
+  nativesTeamName = AddMissionTeam(-2)
   for i = 1, 7 do
     natives[i] = AddHog(nativeNames[i], 0, 100, nativeHats[i])
   end
   nativesNum = 7
 
-  AddTeam(loc("Assault Team"), -1, "skull", "Island", "Pirate", "cm_vampire")
+  cannibalsTeamName1 = AddTeam(loc("Assault Team"), -1, "skull", "Island", "Pirate", "cm_vampire")
   for i = 1, 6 do
     cannibals[i] = AddHog(cannibalNames[i], 3, 50, "vampirichog")
   end
 
-  AddTeam(loc("Reinforcements"), -1, "skull", "Island", "Pirate", "cm_vampire")
+  cannibalsTeamName2 = AddTeam(loc("Reinforcements"), -1, "skull", "Island", "Pirate", "cm_vampire")
   for i = 7, 9 do
     cannibals[i] = AddHog(cannibalNames[i], 2, 50, "vampirichog")
   end
 
-  AddTeam(loc("011101001"), -1, "ring", "UFO", "Robot", "cm_binary")
+  cyborgTeamName = AddTeam(loc("011101001"), -1, "ring", "UFO", "Robot", "cm_binary")
   cyborg = AddHog(loc("Unit 334a$7%;.*"), 0, 200, "cyborg1")
 
   for i = 1, 9 do
@@ -1118,13 +1123,13 @@
     AddCaption(string.format(loc("Turns until arrival: %d"), TurnsLeft))
   end
   if deployedHog then
-    if GetHogTeamName(CurrentHedgehog) == loc("Natives") then
+    if GetHogTeamName(CurrentHedgehog) == nativesTeamName then
       AnimSwitchHog(deployedHog)
     end
   end
 
   if stage == spyKillStage then
-    if GetHogTeamName(CurrentHedgehog) ~= loc("Natives") then
+    if GetHogTeamName(CurrentHedgehog) ~= nativesTeamName then
       EndTurn(true)
     else
       if CurrentHedgehog == spyHog then
@@ -1134,7 +1139,7 @@
       SetTurnTimeLeft(MAX_TURN_TIME)
     end
   else
-    if freshDead ~= nil and GetHogTeamName(CurrentHedgehog) == loc("Natives") then
+    if freshDead ~= nil and GetHogTeamName(CurrentHedgehog) == nativesTeamName then
       SetupHogDeadAnim(freshDead)
       AddAnim(hogDeadAnim)
       AddFunction({func = AfterHogDeadAnim, args = {}})
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/dragon.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/dragon.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -170,6 +170,8 @@
 cyborgsPos = {{2937, 831}, {2945, 1264}, {2335, 1701}, {448, 484}}
 cyborgsDir = {"Left", "Left", "Left", "Right"}
 
+cyborgTeamName, fighterTeamName = nil, nil
+
 cratePos = {
             {{788, 1919, amGirder, 2}, true}, {{412, 1615, amGirder, 1}, true},
             {{209, 1474, amSniperRifle, 1}}, {{1178, 637, amDEagle, 1}},
@@ -625,17 +627,17 @@
 end
 
 function AddHogs()
-  AddTeam(loc("Natives"), -2, "Bone", "Island", "HillBilly", "cm_birdy")
+  AddMissionTeam(-2)
   for i = 1, 7 do
     natives[i] = AddHog(nativeNames[i], 0, 200, nativeHats[i])
     gearDead[natives[i]] = false
   end
 
-  AddTeam(loc("011101001"), -1, "ring", "UFO", "Robot", "cm_binary")
+  cyborgTeamName = AddTeam(loc("011101001"), -1, "ring", "UFO", "Robot", "cm_binary")
   cyborg = AddHog(loc("Unit 334a$7%;.*"), 0, 200, "cyborg1")
   gearDead[cyborg] = false
 
-  AddTeam(loc("011101000"), -9, "ring", "UFO", "Robot", "cm_binary")
+  fighterTeamName = AddTeam(loc("011101000"), -9, "ring", "UFO", "Robot", "cm_binary")
   for i = 1, 4 do
     cyborgs[i] = AddHog(cyborgNames[i], 2, 100, "cyborg2")
     gearDead[cyborgs[i]] = false
@@ -710,7 +712,7 @@
 function onGearDelete(gear)
   gearDead[gear] = true
   if GetGearType(gear) == gtHedgehog then
-    if GetHogTeamName(gear) == loc("011101000") then
+    if GetHogTeamName(gear) == fighterTeamName then
       freshDead = GetHogName(gear)
       cyborgsLeft = cyborgsLeft - 1
     end
@@ -740,13 +742,13 @@
     AddFunction({func = AfterStartAnim, args = {}})
     firstTurn = false
   end
-  if GetHogTeamName(CurrentHedgehog) == loc("011101000") then
+  if GetHogTeamName(CurrentHedgehog) == fighterTeamName then
     if TotalRounds % 6 == 0 then
       AddAmmo(CurrentHedgehog, amSniperRifle, 1)
       AddAmmo(CurrentHedgehog, amDEagle, 1)
     end
     SetTurnTimeLeft(30000)
-  elseif GetHogTeamName(CurrentHedgehog) == loc("011101001") then
+  elseif GetHogTeamName(CurrentHedgehog) == cyborgTeamName then
     EndTurn(true)
   end
 end
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/enemy.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/enemy.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -78,6 +78,12 @@
 leaderPos = {3474, 151}
 leaderDir = "Left"
 
+cyborgTeamName = nil
+nativesTeamName = nil
+cannibalsTeamName = nil
+hedgecogsTeamName = nil
+leaderTeamName = nil
+
 -----------------------------Variables---------------------------------
 natives = {}
 origNatives = {}
@@ -419,9 +425,9 @@
 end
 
 function LoseMission()
-  DismissTeam(loc("Natives"))
-  DismissTeam(loc("Cannibals"))
-  DismissTeam(loc("011101001"))
+  DismissTeam(nativesTeamName)
+  DismissTeam(cannibalsTeamName)
+  DismissTeam(cyborgTeamName)
   EndTurn(true)
 end
 
@@ -437,7 +443,7 @@
   if progress and progress<9 then
     SaveCampaignVar("Progress", "9")
   end
-  DismissTeam(loc("011101001"))
+  DismissTeam(cyborgTeamName)
   EndTurn(true)
 end
 -----------------------------Misc--------------------------------------
@@ -519,10 +525,10 @@
 end
 
 function AddHogs()
-  AddTeam(loc("011101001"), -1, "ring", "UFO", "Robot", "cm_binary")
+  cyborgTeamName = AddTeam(loc("011101001"), -1, "ring", "UFO", "Robot", "cm_binary")
   cyborg = AddHog(loc("Unit 334a$7%;.*"), 0, 200, "cyborg1")
 
-  AddTeam(loc("Natives"), -2, "Bone", "Island", "HillBilly", "cm_birdy")
+  nativesTeamName = AddMissionTeam(-2)
   -- There are 3-4 natives in this mission
   natives[1] = AddHog(nativeNames[leaksNum], 0, 100, nativeHats[leaksNum])
   if m5DeployedNum ~= leaksNum and m8DeployedLeader == 0 then
@@ -540,7 +546,7 @@
     table.insert(players, natives[i])
   end
 
-  AddTeam(loc("Cannibals"), -2, "Bone", "Island", "HillBilly", "cm_birdy")
+  cannibalsTeamName = AddTeam(loc("Cannibals"), -2, "skull", "Island", "Pirate", "cm_vampire")
   for i = 1, cannibalsNum do
     cannibals[i] = AddHog(cannibalNames[i], 0, 100, "Zombi")
     table.insert(players, cannibals[i])
@@ -548,13 +554,13 @@
   playersNum = #players
   playersLeft = playersNum
 
-  AddTeam(loc("Hedge-cogs"), -9, "ring", "UFO", "Robot", "cm_cyborg")
+  hedgecogsTeamName = AddTeam(loc("Hedge-cogs"), -9, "ring", "UFO", "Robot", "cm_cyborg")
   for i = 1, cyborgsNum do
     cyborgs[i] = AddHog(cyborgNames[i], 2, 80, "cyborg2")
   end
 
   if m8EnemyFled == 1 then
-    AddTeam(loc("Leader"), -9, "ring", "UFO", "Robot", "cm_cyborg")
+    leaderTeamName = AddTeam(loc("Leader"), -9, "ring", "UFO", "Robot", "cm_cyborg")
     if m8Scene == denseScene then
       leader = AddHog(loc("Dense Cloud"), 2, 200, nativeHats[denseNum])
     elseif m8Scene == waterScene then
@@ -628,7 +634,7 @@
 function onGearDelete(gear)
   gearDead[gear] = true
   if GetGearType(gear) == gtHedgehog then
-    if GetHogTeamName(gear) == loc("Natives") then
+    if GetHogTeamName(gear) == nativesTeamName then
       for i = 1, nativesLeft do
         if natives[i] == gear then
           table.remove(natives, i)
@@ -637,7 +643,7 @@
           playersLeft = playersLeft - 1
         end
       end
-    elseif GetHogTeamName(gear) == loc("Cannibals") then
+    elseif GetHogTeamName(gear) == cannibalsTeamName then
       for i = 1, cannibalsLeft do
         if cannibals[i] == gear then
           table.remove(cannibals, i)
@@ -646,7 +652,7 @@
           playersLeft = playersLeft - 1
         end
       end
-    elseif GetHogTeamName(gear) == loc("Hedge-cogs") then
+    elseif GetHogTeamName(gear) == hedgecogsTeamName then
       for i = 1, cyborgsLeft do
         if cyborgs[i] == gear then
           table.remove(cyborgs, i)
@@ -684,11 +690,11 @@
   elseif cyborgsDeadFresh then
     cyborgsDeadFresh = false
     WonMission()
-  elseif nativesDeadFresh and GetHogTeamName(CurrentHedgehog) == loc("Cannibals") then
-    AnimSay(CurrentHedgehog, loc("Your deaths will be avenged, Natives!"), SAY_SHOUT, 0)
+  elseif nativesDeadFresh and GetHogTeamName(CurrentHedgehog) == cannibalsTeamName then
+    AnimSay(CurrentHedgehog, string.format(loc("Your deaths will be avenged, %s!"), nativesTeamName), SAY_SHOUT, 0)
     nativesDeadFresh = false
-  elseif cannibalsDeadFresh and GetHogTeamName(CurrentHedgehog) == loc("Natives") then
-    AnimSay(CurrentHedgehog, loc("Your deaths will be avenged, Cannibals!"), SAY_SHOUT, 0)
+  elseif cannibalsDeadFresh and GetHogTeamName(CurrentHedgehog) == nativesTeamName then
+    AnimSay(CurrentHedgehog, string.format(loc("Your deaths will be avenged, %s!"), cannibalsTeamName), SAY_SHOUT, 0)
     cannibalsDeadFresh = false
   end
 end
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/epil.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/epil.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -311,23 +311,24 @@
 end
 
 function AddHogs()
-	AddTeam(loc("Natives"), -2, "Bone", "Island", "HillBilly", "cm_birdy")
+  local nativesTeamName = AddMissionTeam(-2)
   for i = 1, 5 do
     natives[i] = AddHog(nativeNames[i], 0, 100, nativeHats[i])
   end
 
-	AddTeam(loc("More Natives"), -2, "Bone", "Island", "HillBilly", "cm_birdy")
+  local grave, voice, flag = GetHogGrave(natives[1]), GetHogVoicepack(natives[1]), GetHogFlag(natives[1])
+  AddTeam(string.format(loc("%s (contd.)"), nativesTeamName), -2, grave, "Island", voice, flag)
   for i = 6, 10 do
     natives[i] = AddHog(nativeNames[i], 0, 100, nativeHats[i])
   end
 
-	AddTeam(loc("Cannibals"), -2, "skull", "Island", "HillBilly", "cm_birdy")
+  AddTeam(loc("Cannibals"), -2, "skull", "Island", "Pirate", "cm_vampire")
   for i = 1, 5 do
     cannibals[i] = AddHog(cannibalNames[i], 0, 100, cannibalHats[i])
   end
 
   if m8Scene == denseScene or m8Scene == waterScene then
-    AddTeam(loc("Traitors"), -2, "Bone", "Island", "HillBilly", "cm_bloodyblade")
+    AddTeam(loc("Traitors"), -2, grave, "Island", voice, "cm_bloodyblade")
     if m8Scene == denseScene then
       DeleteGear(natives[2])
       natives[2] = AddHog(nativeNames[2], 0, 100, nativeHats[2])
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/family.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/family.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -104,6 +104,11 @@
               {3749, 1040}, {2475, 1338}, {3853, 881}}
 cyborgsDir = {"Left", "Left", "Left", "Left", "Left", "Right"}
 
+princessTeamName = nil
+nativesTeamName = nil
+biomechanicTeamName = nil
+cyborgTeamName = nil
+
 princessPos = {3737, 1181}
 crateConsts = {}
 reactions = {}
@@ -379,7 +384,7 @@
       SaveCampaignVar("Progress", "7")
     end
     princessFreed = true
-    DismissTeam(loc("011101001"))
+    DismissTeam(cyborgTeamName)
     EndTurn(true)
   end
 end
@@ -435,8 +440,8 @@
     RemoveEventFunc(CheckCloseToPrincess)
     RemoveEventFunc(CheckPrincessFreed)
     AddCaption(loc("So the princess was never heard of again ..."))
-    DismissTeam(loc("Natives"))
-    DismissTeam(loc("Princess"))
+    DismissTeam(nativesTeamName)
+    DismissTeam(princessTeamName)
     EndTurn(true)
   end
 end
@@ -519,22 +524,22 @@
 end
 
 function AddHogs()
-  AddTeam(loc("Princess"), -2, "Bone", "Island", "HillBilly", "cm_birdy")
+  princessTeamName = AddTeam(loc("Princess"), -2, "Bone", "Island", "HillBilly", "cm_female")
   princess = AddHog(loc("Fell From Heaven"), 0, 333, "tiara")
   SetGearAIHints(princess, aihDoesntMatter)
   gearDead[princess] = false
 
-  AddTeam(loc("Natives"), -2, "Bone", "Island", "HillBilly", "cm_birdy")
+  nativesTeamName = AddMissionTeam(-2)
   for i = 7, 9 do
     natives[i-6] = AddHog(nativeNames[i], 0, 100, nativeHats[i])
     gearDead[natives[i-6]] = false
   end
 
-  AddTeam(loc("011101001"), -1, "ring", "UFO", "Robot", "cm_binary")
+  cyborgTeamName = AddTeam(loc("011101001"), -1, "ring", "UFO", "Robot", "cm_binary")
   cyborg = AddHog(loc("Unit 334a$7%;.*"), 0, 200, "cyborg1")
   gearDead[cyborg] = false
 
-  AddTeam(loc("Biomechanic Team"), -1, "ring", "UFO", "Robot", "cm_cyborg")
+  biomechanicTeamName = AddTeam(loc("Biomechanic Team"), -1, "ring", "UFO", "Robot", "cm_cyborg")
   for i = 1, cyborgsNum do
     cyborgs[i] = AddHog(cyborgNames[i], cyborgsDif[i], cyborgsHealth[i], "cyborg2")
     gearDead[cyborgs[i]] = false
@@ -613,7 +618,7 @@
 function onGearDelete(gear)
   gearDead[gear] = true
   if GetGearType(gear) == gtHedgehog then
-    if GetHogTeamName(gear) == loc("Biomechanic Team") then
+    if GetHogTeamName(gear) == biomechanicTeamName then
       cyborgsLeft = cyborgsLeft - 1
     end
   end
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/first_blood.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/first_blood.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -747,8 +747,8 @@
 	Theme = "Nature"
 
 
-	AddTeam(loc("Natives"), -2, "Bone", "Island", "HillBilly", "cm_birdy")
-	youngh = AddHog(loc("Leaks A Lot"), 0, 100, "Rambo")
+  AddMissionTeam(-2)
+  youngh = AddHog(loc("Leaks A Lot"), 0, 100, "Rambo")
   elderh = AddHog(loc("Righteous Beard"), 0, 99, "IndianChief")
   princess = AddHog(loc("Fell From Heaven"), 0, 300, "tiara")
   AnimSetGearPosition(princess, 1911, 1361)
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/journey.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/journey.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -135,6 +135,11 @@
 TurnsLeft = 0
 stage = 0
 
+nativesTeamName = nil
+princessTeamName = nil
+cannibalsTeamName = nil
+cyborgTeamName = nil
+
 startAnimStarted = false
 blowTaken = false
 fireTaken = false
@@ -179,8 +184,8 @@
 
 --/////////////////////////Animation Functions///////////////////////
 function AfterMidFailAnim()
-  DismissTeam(loc("Natives"))
-  DismissTeam(loc("Princess"))
+  DismissTeam(nativesTeamName)
+  DismissTeam(princessTeamName)
   EndTurn(true)
 end
 
@@ -910,8 +915,8 @@
   if not princessDead then
     EndTurn(true)
     AddCaption(loc("The village, unprepared, was destroyed by the cyborgs..."))
-    DismissTeam(loc("Natives"))
-    DismissTeam(loc("Princess"))
+    DismissTeam(nativesTeamName)
+    DismissTeam(princessTeamName)
   end
 end
 
@@ -923,8 +928,8 @@
   if not princessDead then
     EndTurn(true)
     AddCaption(loc("The village, unprepared, was destroyed by the cyborgs..."))
-    DismissTeam(loc("Natives"))
-    DismissTeam(loc("Princess"))
+    DismissTeam(nativesTeamName)
+    DismissTeam(princessTeamName)
   end
 end
 
@@ -1012,8 +1017,8 @@
   if not (leaksDead or denseDead) then
     AddAnim(endFailAnim)
   end
-  AddFunction({func = DismissTeam, args = {loc("Natives")}})
-  AddFunction({func = DismissTeam, args = {loc("Princess")}})
+  AddFunction({func = DismissTeam, args = {nativesTeamName}})
+  AddFunction({func = DismissTeam, args = {princessTeamName}})
   AddFunction({func = EndTurn, args = {true}})
 end
 
@@ -1032,8 +1037,8 @@
 
 function FinishWon()
   SwitchHog(leaks)
-  DismissTeam(loc("Cannibal Sentry"))
-  DismissTeam(loc("011101001"))
+  DismissTeam(cannibalsTeamName)
+  DismissTeam(cyborgTeamName)
   EndTurn(true)
 end
 
@@ -1086,14 +1091,14 @@
 
   AnimInit(true)
 
-  AddTeam(loc("Natives"), -2, "Bone", "Island", "HillBilly", "cm_birdy")
+  nativesTeamName = AddMissionTeam(-2)
   leaks = AddHog(loc("Leaks A Lot"), 0, 100, "Rambo")
   dense = AddHog(loc("Dense Cloud"), 0, 100, "RobinHood")
 
-  AddTeam(loc("Princess"), -2, "Bone", "Island", "HillBilly", "cm_birdy")
+  princessTeamName = AddTeam(loc("Princess"), -2, "Bone", "Island", "HillBilly", "cm_female")
   princess = AddHog(loc("Fell From Heaven"), 0, 200, "tiara")
 
-  AddTeam(loc("Cannibal Sentry"), -1, "skull", "Island", "Pirate","cm_vampire")
+  cannibalsTeamName = AddTeam(loc("Cannibal Sentry"), -1, "skull", "Island", "Pirate","cm_vampire")
   cannibals = {}
   for i = 1, 4 do
     cannibals[i] = AddHog(cannibalNames[i], 3, 40, "Zombi")
@@ -1107,7 +1112,7 @@
     SetEffect(cannibals[i], heArtillery, 1)
   end
 
-  AddTeam(loc("011101001"), -1, "ring", "UFO", "Robot", "cm_binary")
+  cyborgTeamName = AddTeam(loc("011101001"), -1, "ring", "UFO", "Robot", "cm_binary")
   cyborg = AddHog(loc("Y3K1337"), 0, 200, "cyborg1")
 
   AnimSetGearPosition(dense, 0, 0)
@@ -1196,7 +1201,7 @@
     AnimSwitchHog(leaks)
     SetGearMessage(leaks, 0)
     SetTurnTimeLeft(MAX_TURN_TIME)
-  elseif GetHogTeamName(CurrentHedgehog) ~= loc("Natives") then
+  elseif GetHogTeamName(CurrentHedgehog) ~= nativesTeamName then
     SetTurnTimeLeft(20000)
   else
     TurnsLeft = TurnsLeft - 1
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/queen.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/queen.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -499,7 +499,7 @@
   if anim == startAnim then
     SetGearPosition(enemy, unpack(enemyPos))
   end
-  if GetHogTeamName(CurrentHedgehog) ~= loc("Natives") then
+  if GetHogTeamName(CurrentHedgehog) ~= nativesTeamName then
     EndTurn(true)
   end
   AnimWait(enemy, 1)
@@ -555,9 +555,9 @@
 
 function KillEnemy()
   if enemyFled == "1" then
-    DismissTeam(loc("Leaderbot"))
+    DismissTeam(leaderbotTeamName)
   end
-  DismissTeam(loc("011101001"))
+  DismissTeam(cyborgTeamName)
   EndTurn(true)
 end
 
@@ -722,8 +722,14 @@
   AddAmmo(natives[1], amMolotov, 0)
 end
 
+nativesTeamName = nil
+beepTeamName = nil
+corpTeamName = nil
+leaderbotTeamName = nil
+cyborgTeamName = nil
+
 function AddHogs()
-	AddTeam(loc("Natives"), -2, "Bone", "Island", "HillBilly", "cm_birdy")
+  nativesTeamName = AddMissionTeam(-2)
   for i = 7, 9 do
     natives[i-6] = AddHog(nativeNames[i], 0, 100, nativeHats[i])
     origNatives[i-6] = natives[i-6]
@@ -732,21 +738,21 @@
   origNatives[4] = natives[4]
   nativesLeft = nativesNum
 
-  AddTeam(loc("Beep Loopers"), -1, "ring", "UFO", "Robot", "cm_cyborg")
+  beepTeamName = AddTeam(loc("Beep Loopers"), -1, "ring", "UFO", "Robot", "cm_cyborg")
   for i = 1, cyborgsTeamNum[1] do
     cyborgs[i] = AddHog(cyborgNames[i], cyborgsDif[i], cyborgsHealth[i], "cyborg2")
   end
 
-  AddTeam(loc("Corporationals"), -1, "ring", "UFO", "Robot", "cm_cyborg")
+  corpTeamName = AddTeam(loc("Corporationals"), -1, "ring", "UFO", "Robot", "cm_cyborg")
   for i = cyborgsTeamNum[1] + 1, cyborgsNum do
     cyborgs[i] = AddHog(cyborgNames[i], cyborgsDif[i], cyborgsHealth[i], "cyborg2")
   end
   cyborgsLeft = cyborgsTeamNum[1] + cyborgsTeamNum[2]
 
-  AddTeam(loc("Leaderbot"), -1, "ring", "UFO", "Robot", "cm_cyborg")
+  leaderbotTeamName = AddTeam(loc("Leaderbot"), -1, "ring", "UFO", "Robot", "cm_cyborg")
   enemy = AddHog(loc("Name"), 2, 200, "cyborg1")
 
-  AddTeam(loc("011101001"), -1, "ring", "UFO", "Robot", "cm_binary")
+  cyborgTeamName = AddTeam(loc("011101001"), -1, "ring", "UFO", "Robot", "cm_binary")
   cyborg = AddHog(loc("Unit 334a$7%;.*"), 0, 200, "cyborg1")
   SetGearPosition(cyborg, unpack(cyborgHidePos))
 
@@ -823,7 +829,7 @@
   local toRemove = nil
   gearDead[gear] = true
   if GetGearType(gear) == gtHedgehog then
-    if GetHogTeamName(gear) == loc("Beep Loopers") or GetHogTeamName(gear) == loc("Corporationals") then
+    if GetHogTeamName(gear) == beepTeamName or GetHogTeamName(gear) == corpTeamName then
       cyborgsLeft = cyborgsLeft - 1
     elseif GetHogTeamName(gear) == loc("Natives") then
       for i = 1, nativesLeft do
@@ -859,7 +865,7 @@
     SetTurnTimeLeft(MAX_TURN_TIME)
     return
   end
-  if GetHogTeamName(CurrentHedgehog) == loc("011101001") then
+  if GetHogTeamName(CurrentHedgehog) == cyborgTeamName then
     EndTurn(true)
   end
 end
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/shadow.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/shadow.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -94,6 +94,9 @@
 
 HogNames = {loc("Brainiac"), loc("Corpsemonger"), loc("Femur Lover"), loc("Glark"), loc("Bonely"), loc("Rot Molester"), loc("Bloodrocutor"), loc("Muscle Dissolver"), loc("Bloodsucker")}
 
+nativesTeamName = nil
+weaklingsTeamName = nil
+
 ---POSITIONS---
 
 cannibalPos = {{3108, 1127}, 
@@ -614,13 +617,13 @@
 end
 
 function AddHogs()
-	AddTeam(loc("Natives"), -2, "Bone", "Island", "HillBilly", "cm_birdy")
+  nativesTeamName = AddMissionTeam(-2)
   ramon = AddHog(loc("Ramon"), 0, 100, "rasta")
 	leaks = AddHog(loc("Leaks A Lot"), 0, 100, "Rambo")
   dense = AddHog(loc("Dense Cloud"), 0, 100, "RobinHood")
   spiky = AddHog(loc("Spiky Cheese"), 0, 100, "hair_yellow")
 
-  AddTeam(loc("Weaklings"), -1, "skull", "Island", "Pirate","cm_vampire")
+  weaklingsTeamName = AddTeam(loc("Weaklings"), -1, "skull", "Island", "Pirate","cm_vampire")
   cannibals = {}
   cannibals[1] = AddHog(loc("Brainiac"), 5, 20, "Zombi")
 
@@ -794,7 +797,7 @@
   AddAnim(stronglingsAnim)
   AddFunction({func = AfterStronglingsAnim, args = {}})
   stage = interWeakStage
-  DismissTeam(loc("Weaklings"))
+  DismissTeam(weaklingsTeamName)
 end
 
 function CheckRefuse()
@@ -1003,7 +1006,7 @@
   end
   AddCaption(loc("...and so the cyborgs took over the world..."))
   stage = loseStage
-  DismissTeam(loc("Natives"))
+  DismissTeam(nativesTeamName)
 end
 
 function CheckDenseDead()
@@ -1088,9 +1091,9 @@
 end
 
 function onGearAdd(gear)
-  if GetGearType(gear) == gtGrenade and GetHogTeamName(CurrentHedgehog) == loc("Natives") then
+  if GetGearType(gear) == gtGrenade and GetHogTeamName(CurrentHedgehog) == nativesTeamName then
     grenadeUsed = true
-  elseif GetGearType(gear) == gtShotgunShot and GetHogTeamName(CurrentHedgehog) == loc("Natives") then
+  elseif GetGearType(gear) == gtShotgunShot and GetHogTeamName(CurrentHedgehog) == nativesTeamName then
     shotgunUsed = true
   end
 end
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/united.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/united.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -63,6 +63,10 @@
 startAnim = {}
 wave2Anim = {}
 finalAnim = {}
+
+nativesTeamName = nil
+cyborgTeamName = nil
+
 --------------------------Anim skip functions--------------------------
 function AfterHogDeadAnim()
   freshDead = nil
@@ -136,7 +140,7 @@
   if progress and progress<4 then
     SaveCampaignVar("Progress", "4")
   end
-  DismissTeam(loc("011101001"))
+  DismissTeam(cyborgTeamName)
   EndTurn(true)
 end
 -----------------------------Animations--------------------------------
@@ -323,8 +327,8 @@
 end
 
 function AddHogs()
-	AddTeam(loc("Natives"), -2, "Bone", "Island", "HillBilly", "cm_birdy")
-	leaks = AddHog(loc("Leaks A Lot"), 0, 100, "Rambo")
+  nativesTeamName = AddMissionTeam(-2)
+  leaks = AddHog(loc("Leaks A Lot"), 0, 100, "Rambo")
   dense = AddHog(loc("Dense Cloud"), 0, 100, "RobinHood")
   water = AddHog(loc("Fiery Water"), 0, 100, "pirate_jack")
   buffalo = AddHog(loc("Raging Buffalo"), 0, 100, "zoo_Bunny")
@@ -342,7 +346,7 @@
     cannibals[i] = AddHog(HogNames[i], 2, 55, "vampirichog")
   end
 
-  AddTeam(loc("011101001"), -1, "ring", "UFO", "Robot", "cm_binary")
+  cyborgTeamName = AddTeam(loc("011101001"), -1, "ring", "UFO", "Robot", "cm_binary")
   cyborg = AddHog(loc("Unit 334a$7%;.*"), 0, 200, "cyborg1")
 
   AnimSetGearPosition(leaks,   unpack(leaksPos))
@@ -534,7 +538,7 @@
     SetTurnTimeLeft(MAX_TURN_TIME)
     return
   end
-  if freshDead ~= nil and GetHogTeamName(CurrentHedgehog) == loc("Natives") then
+  if freshDead ~= nil and GetHogTeamName(CurrentHedgehog) == nativesTeamName then
     SetupHogDeadAnim(freshDead)
     AddAnim(hogDeadAnim)
     AddFunction({func = AfterHogDeadAnim, args = {}})
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -32,7 +32,7 @@
 local dialog09 = {}
 -- mission objectives
 local goals = {
-	["init"] = {missionName, loc("Getting ready"), loc("Help Hog Solo to find all the parts of the anti-gravity device.")..
+	["init"] = {missionName, loc("Getting ready"), loc("Find all the parts of the anti-gravity device.")..
 	"|"..loc("Travel to all the neighbor planets and collect all the pieces"), 1, 0},
 	[dialog01] = {missionName, loc("Getting ready"), loc("Go and collect the crate").."|"..loc("Try not to get spotted by the guards!"), 1, 4500},
 	[dialog02] = {missionName, loc("The adventure begins!"), loc("Use the saucer and fly to the moon").."|"..loc("Travel carefully as your fuel is limited"), 1, 4500},
@@ -118,19 +118,20 @@
 		Map = "cosmos_map" -- custom map included in file
 	end
 	Theme = "Nature"
-	-- I had originally hero in PAotH team and changed it, may reconsider though
-	-- PAotH
-	AddTeam(teamC.name, teamC.color, "Simple", "Island", "Default", "hedgewars")
-	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
+	-- Hero
+	teamC.name = AddMissionTeam(teamC.color)
+	hero.gear = AddMissionHog(100)
+	hero.name = GetHogName(hero.gear)
 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
 	HogTurnLeft(hero.gear, true)
-	AddTeam(teamA.name, teamA.color, "Earth", "Island", "Default", "cm_galaxy")
+	-- PAotH
+	teamA.name = AddTeam(teamA.name, teamA.color, "Earth", "Island", "Default", "cm_galaxy")
 	director.gear = AddHog(director.name, 0, 100, "hair_yellow")
 	AnimSetGearPosition(director.gear, director.x, director.y)
 	doctor.gear = AddHog(doctor.name, 0, 100, "Glasses")
 	AnimSetGearPosition(doctor.gear, doctor.x, doctor.y)
 	-- Guards
-	AddTeam(teamB.name, teamB.color, "Statue", "Island", "Default", "cm_swordshield2")
+	teamB.name = AddTeam(teamB.name, teamB.color, "Statue", "Island", "Default", "cm_swordshield2")
 	guard1.gear = AddHog(guard1.name, 1, 100, "policecap")
 	AnimSetGearPosition(guard1.gear, guard1.x, guard1.y)
 	guard2.gear = AddHog(guard2.name, 1, 100, "policecap")
@@ -474,7 +475,7 @@
 		SaveCampaignVar("Mission1", "2")
 		SaveCampaignVar("Mission2", "13")
 		SaveCampaignVar("Mission3", "1")
-		sendStats(loc("Hog Solo arrived at the moon!"))
+		sendStats(string.format(loc("%s arrived at the moon!"), hero.name))
 	end
 end
 
@@ -507,7 +508,7 @@
 			SaveCampaignVar("Mission2", "10")
 			SaveCampaignVar("Mission3", "1")
 		end
-		sendStats(loc("Hog Solo arrived at the Fruit Planet!"))
+		sendStats(string.format(loc("%s arrived at the Fruit Planet!"), hero.name))
 	end
 end
 
@@ -522,7 +523,7 @@
 		SaveCampaignVar("Mission2", "7")
 		SaveCampaignVar("Mission3", "12")
 		SaveCampaignVar("Mission4", "1")
-		sendStats(loc("Hog Solo arrived at the Desert Planet!"))
+		sendStats(string.format(loc("%s arrived at the Desert Planet!"), hero.name))
 	end
 end
 
@@ -536,7 +537,7 @@
 		SaveCampaignVar("Mission1", "5")
 		SaveCampaignVar("Mission2", "6")
 		SaveCampaignVar("Mission3", "1")
-		sendStats(loc("Hog Solo arrived at the Ice Planet!"))
+		sendStats(string.format(loc("%s arrived at the Ice Planet!"), hero.name))
 	end
 end
 
@@ -552,7 +553,7 @@
 		SaveCampaignVar("Mission1", "9")
 		SaveCampaignVar("Mission2", "11")
 		SaveCampaignVar("Mission3", "1")
-		sendStats(loc("Hog Solo arrived at the Planet of Death!"))
+		sendStats(string.format(loc("%s arrived at the Planet of Death!"), hero.name))
 	end
 end
 
@@ -568,7 +569,7 @@
 		SaveCampaignVar("UnlockedMissions", "2")
 		SaveCampaignVar("Mission1", "14")
 		SaveCampaignVar("Mission2", "1")
-		sendStats(loc("Hog Solo arrived at the meteorite!"))
+		sendStats(string.format(loc("%s arrived at the meteorite!"), hero.name))
 	end
 end
 
@@ -649,7 +650,7 @@
 	AddSkipFunction(dialog01, Skipanim, {dialog01})
 	table.insert(dialog01, {func = AnimWait, args = {doctor.gear, 3000}})
 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Near Secret Base 17 of PAotH in the rural Hogland ..."),  4000}})
-	table.insert(dialog01, {func = AnimSay, args = {director.gear, loc("So Hog Solo, here we are ..."), SAY_SAY, 2000}})
+	table.insert(dialog01, {func = AnimSay, args = {director.gear, string.format(loc("So, %s, here we are ..."), hero.name), SAY_SAY, 2000}})
 	table.insert(dialog01, {func = AnimSay, args = {director.gear, loc("Behind these trees on the east side there is Secret Base 17."), SAY_SAY, 4000}})
 	table.insert(dialog01, {func = AnimSay, args = {director.gear, loc("You have to continue alone from now on."), SAY_SAY, 3000}})
 	table.insert(dialog01, {func = AnimSay, args = {director.gear, loc("Be careful, the future of Hogera is in your hands!"), SAY_SAY, 7200}})
@@ -705,7 +706,7 @@
 	-- DIALOG 08 - Hero wins death01
 	AddSkipFunction(dialog08, Skipanim, {dialog08})
 	table.insert(dialog08, {func = AnimCaption, args = {hero.gear, loc("Under the meteorite’s shadow ..."),  4000}})
-	table.insert(dialog08, {func = AnimSay, args = {doctor.gear, loc("You did great, Hog Solo! However, we aren't out of danger yet!"), SAY_SHOUT, 4500}})
+	table.insert(dialog08, {func = AnimSay, args = {doctor.gear, string.format(loc("You did great, %s! However, we aren't out of danger yet!"), hero.name), SAY_SHOUT, 4500}})
 	table.insert(dialog08, {func = AnimSay, args = {doctor.gear, loc("The meteorite has come too close and the anti-gravity device isn't powerful enough to stop it now."), SAY_SHOUT, 5000}})
 	table.insert(dialog08, {func = AnimSay, args = {doctor.gear, loc("We need it to get split into at least two parts."), SAY_SHOUT, 3000}})
 	table.insert(dialog08, {func = AnimSay, args = {doctor.gear, loc("PAotH has sent explosives but unfortunately the trigger mechanism seems to be faulty!"), SAY_SHOUT, 5000}})
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death01.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death01.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -3,7 +3,7 @@
 -- This is the mission to acquire the last part.
 -- This mission is the cameo of Professor Hogevil
 -- who has took hostages H and Dr. Cornelius.
--- Hog Solo has to defeat him and his thugs.
+-- The hero has to defeat him and his thugs.
 
 HedgewarsScriptLoad("/Scripts/Locale.lua")
 HedgewarsScriptLoad("/Scripts/Animate.lua")
@@ -43,6 +43,7 @@
 local teamA = {}
 local teamB = {}
 local teamC = {}
+local teamD = {}
 -- hedgehogs values
 hero.name = loc("Hog Solo")
 hero.x = 520
@@ -82,8 +83,10 @@
 teamA.color = -6
 teamB.name = loc("PAotH")
 teamB.color = teamA.color
-teamC.name = loc("Professor")
+teamC.name = loc("Professor's Team")
 teamC.color = -2
+teamD.name = loc("Professor")
+teamD.color = -2
 
 -------------- LuaAPI EVENT HANDLERS ------------------
 
@@ -103,13 +106,14 @@
 	Map = "death01_map"
 	Theme = "Hell"
 
-	-- Hog Solo
-	AddTeam(teamA.name, teamA.color, "Simple", "Island", "Default", "hedgewars")
-	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
+	-- Hero
+	teamA.name = AddMissionTeam(teamA.color)
+	hero.gear = AddMissionHog(100)
+	hero.name = GetHogName(hero.gear)
 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
 
-	-- PAotH
-	AddTeam(teamB.name, teamB.color, "Earth", "Island", "Default", "cm_galaxy")
+	-- PAotH (passive team)
+	teamB.name = AddTeam(teamB.name, teamB.color, "Earth", "Island", "Default", "cm_galaxy")
 	paoth1.gear = AddHog(paoth1.name, 0, 100, "hair_yellow")
 	AnimSetGearPosition(paoth1.gear, paoth1.x, paoth1.y)
 	HogTurnLeft(paoth1.gear, true)
@@ -119,8 +123,8 @@
 	HogTurnLeft(paoth2.gear, true)
 	SetGearAIHints(paoth2.gear, aihDoesntMatter)
 
-	-- Professor and Thugs
-	AddTeam(teamC.name, teamC.color, "eyecross", "Island", "Default", "cm_sine")
+	-- Professor's Team (computer enemy)
+	teamC.name = AddTeam(teamC.name, teamC.color, "eyecross", "Island", "Default", "cm_sine")
 	professor.bot = AddHog(professor.name, 1, 300, "tophats")
 	AnimSetGearPosition(professor.bot, paoth1.x - 100, paoth1.y)
 	HogTurnLeft(professor.bot, true)
@@ -131,8 +135,10 @@
 		HogTurnLeft(thugs[i].gear, not thugs[i].turnLeft)
 	end
 
-	AddTeam(teamC.name, teamC.color, "star", "Island", "Default", "cm_sine")
+	-- Professor (special team for cut sequence only)
+	teamD.name = AddTeam(teamD.name, teamD.color, "star", "Island", "Default", "cm_sine")
 	professor.human = AddHog(professor.name, 0, 300, "tophats")
+	-- hog will be removed and replaced by professor.bot after cut sequence
 	AnimSetGearPosition(professor.human, hero.x + 70, hero.y)
 	HogTurnLeft(professor.human, true)
 
@@ -274,7 +280,7 @@
 -------------- ACTIONS ------------------
 
 function heroDeath(gear)
-	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
+	SendStat(siGameResult, string.format(loc("%s lost, try again!"), hero.name))
 	SendStat(siCustomAchievement, loc("To win the game you have to eliminate Professor Hogevil."))
 	sendSimpleTeamRankings({teamC.name, teamA.name, teamB.name})
 	EndGame()
@@ -303,7 +309,7 @@
 	AddSkipFunction(dialog01, Skipanim, {dialog01})
 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Somewhere on the uninhabitable Death Planet ..."), 5000}})
-	table.insert(dialog01, {func = AnimSay, args = {professor.human, loc("Welcome Hog Solo, surprised to see me?"), SAY_SAY, 4000}})
+	table.insert(dialog01, {func = AnimSay, args = {professor.human, string.format(loc("Welcome, %s, surprised to see me?"), hero.name), SAY_SAY, 4000}})
 	if profDiedOnMoon then
 		table.insert(dialog01, {func = AnimSay, args = {professor.human, loc("After you left the moon, my other loyal minions came and resurrected me so I could complete my master plan."), SAY_SAY, 6000}})
 	else
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death02.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death02.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -70,13 +70,14 @@
 	WaterRise = 0
 	HealthDecrease = 0
 
-	-- Hog Solo
-	AddTeam(teamA.name, teamA.color, "Simple", "Island", "Default", "hedgewars")
-	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
+	-- Hero
+	teamA.name = AddMissionTeam(teamA.color)
+	hero.gear = AddMissionHog(100)
+	hero.name = GetHogName(hero.gear)
 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
 	-- enemies
 	shuffleHogs(enemies)
-	AddTeam(teamB.name, teamB.color, "skull", "Island", "Default", "cm_skull")
+	teamB.name = AddTeam(teamB.name, teamB.color, "skull", "Island", "Default", "cm_skull")
 	for i=1,table.getn(enemies) do
 		enemies[i].gear = AddHog(enemies[i].name, 1, 100, "war_desertgrenadier1")
 		AnimSetGearPosition(enemies[i].gear, enemies[i].x, enemies[i].y)
@@ -208,7 +209,7 @@
 -------------- ACTIONS ------------------
 
 function heroDeath(gear)
-	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
+	SendStat(siGameResult, string.format(loc("%s lost, try again!"), hero.name))
 	SendStat(siCustomAchievement, loc("You have to eliminate all the enemies."))
 	SendStat(siCustomAchievement, loc("Read the challenge objectives from within the mission for more details."))
 	sendSimpleTeamRankings({teamB.name, teamA.name})
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert01.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert01.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -1,6 +1,6 @@
 ------------------- ABOUT ----------------------
 --
--- In the desert planet Hero will have to explore
+-- In the desert planet, the hero will have to explore
 -- the dunes below the surface and find the hidden
 -- crates. It is told that one crate contains the
 -- lost part.
@@ -97,21 +97,24 @@
 	WaterRise = 0
 	Map = "desert01_map"
 	Theme = "Desert"
+	-- To prevent victory when smugglers have been defeated
+	GameFlags = gfOneClanMode
 
 	-- get hero health
 	local heroHealth = 100
 
-	-- Hog Solo
-	AddTeam(teamC.name, teamC.color, "Simple", "Island", "Default", "hedgewars")
-	hero.gear = AddHog(hero.name, 0, heroHealth, "war_desertgrenadier1")
+	-- Hero
+	teamC.name = AddMissionTeam(teamC.color)
+	hero.gear = AddMissionHog(heroHealth)
+	hero.name = GetHogName(hero.gear)
 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
 	HogTurnLeft(hero.gear, true)
 	-- PAotH undercover scientist and chief Sandologist
-	AddTeam(teamA.name, teamA.color, "Earth", "Island", "Default", "cm_galaxy")
+	teamA.name = AddTeam(teamA.name, teamA.color, "Earth", "Island", "Default", "cm_galaxy")
 	ally.gear = AddHog(ally.name, 0, 100, "Cowboy")
 	AnimSetGearPosition(ally.gear, ally.x, ally.y)
 	-- Smugglers
-	AddTeam(teamB.name, teamB.color, "chest", "Island", "Default", "cm_bloodyblade")
+	teamB.name = AddTeam(teamB.name, teamB.color, "chest", "Island", "Default", "cm_bloodyblade")
 	smuggler1.gear = AddHog(smuggler1.name, 1, 100, "hair_orange")
 	AnimSetGearPosition(smuggler1.gear, smuggler1.x, smuggler1.y)
 	smuggler2.gear = AddHog(smuggler2.name, 1, 100, "lambda")
@@ -540,7 +543,7 @@
 end
 
 function lose()
-	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
+	SendStat(siGameResult, string.format(loc("%s lost, try again!"), hero.name))
 	SendStat(siCustomAchievement, loc("To win the game you have to find the right crate."))
 	SendStat(siCustomAchievement, loc("You can avoid some battles."))
 	SendStat(siCustomAchievement, loc("Use your ammo wisely."))
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert02.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert02.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -75,9 +75,10 @@
 	Map = "desert02_map"
 	Theme = "Desert"
 
-	-- Hog Solo
-	AddTeam(teamA.name, teamA.color, "Simple", "Island", "Default", "hedgewars")
-	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
+	-- Hero
+	teamA.name = AddMissionTeam(teamA.color)
+	hero.gear = AddMissionHog(100)
+	hero.name = GetHogName(hero.gear)
 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
 	HogTurnLeft(hero.gear, true)
 
@@ -172,7 +173,7 @@
 -------------- ACTIONS ------------------
 
 function heroDeath(gear)
-	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
+	SendStat(siGameResult, string.format(loc("%s lost, try again!"), hero.name))
 	SendStat(siCustomAchievement, loc("To win the game you have to go to the surface."))
 	SendStat(siCustomAchievement, loc("Most mines are not active."))
 	SendStat(siCustomAchievement, loc("From the second turn and beyond the water rises."))
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert03.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert03.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -73,9 +73,10 @@
 	WaterRise = 0
 	HealthDecrease = 0
 
-	-- Hog Solo
-	AddTeam(teamA.name, teamA.color, "Simple", "Island", "Default", "hedgewars")
-	hero.gear = AddHog(hero.name, 0, 1, "war_desertgrenadier1")
+	-- Hero
+	teamA.name = AddMissionTeam(teamA.color)
+	hero.gear = AddMissionHog(1)
+	hero.name = GetHogName(hero.gear)
 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
 
 	initCheckpoint("desert03")
@@ -235,7 +236,7 @@
 end
 
 function gameOver()
-	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
+	SendStat(siGameResult, string.format(loc("%s lost, try again!"), hero.name))
 	SendStat(siCustomAchievement, loc("You have to destroy all the targets."))
 	SendStat(siCustomAchievement, loc("You will fail if you run out of ammo and there are still targets available."))
 	SendStat(siCustomAchievement, loc("Read the challenge objectives from within the mission for more details."))
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/final.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/final.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -50,9 +50,10 @@
 	WaterRise = 0
 	HealthDecrease = 0
 
-	-- Hog Solo
-	AddTeam(teamA.name, teamA.color, "Simple", "Island", "Default", "hedgewars")
-	hero.gear = AddHog(hero.name, 0, 1, "war_desertgrenadier1")
+	-- Hero
+	teamA.name = AddMissionTeam(teamA.color)
+	hero.gear = AddMissionHog(1)
+	hero.name = GetHogName(hero.gear)
 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
 
 	initCheckpoint("final")
@@ -151,7 +152,7 @@
 -------------- ACTIONS ------------------
 
 function heroDeath(gear)
-	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
+	SendStat(siGameResult, string.format(loc("%s lost, try again!"), hero.name))
 	SendStat(siCustomAchievement, loc("You have to destroy all the explosives without dying!"))
 	SendStat(siCustomAchievement, loc("Areas surrounded by a security border are indestructible."))
 	SendStat(siCustomAchievement, loc("Areas surrounded by a green dashed outline are portal-proof and repel portals."))
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit01.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit01.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -39,7 +39,7 @@
 		loc("What do you want to do?").."| |"..
 		loc("Fight: Press [Attack]").."|"..
 		loc("Flee: Press [Jump]"), 1, 9999000, true},
-	[dialog02] = {missionName, loc("Battle Starts Now!"), loc("You have chosen to fight!").."|"..loc("Lead the Green Bananas to battle and eliminate all the enemies!"), 1, 5000},
+	[dialog02] = {missionName, loc("Battle Starts Now!"), loc("You have chosen to fight!").."|"..loc("Lead your allies to battle and eliminate all the enemies!"), 1, 5000},
 	[dialog03] = {missionName, loc("Time to run!"), loc("You have chosen to flee.").."|"..loc("You have to reach the left-most place on the map."), 1, 5000},
 	["fight"] = {missionName, loc("Ready for Battle?"), loc("You have chosen to fight!"), 1, 2000},
 	["flee"] = {missionName, loc("Ready for Battle?"), loc("You have chosen to flee."), 1, 2000},
@@ -119,17 +119,18 @@
 	Map = "fruit01_map"
 	Theme = "Fruit"
 
-	-- Hog Solo
-	AddTeam(teamA.name, teamA.color, "Simple", "Island", "Default", "hedgewars")
-	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
+	-- Hero
+	teamA.name = AddMissionTeam(teamA.color)
+	hero.gear = AddMissionHog(100)
+	hero.name = GetHogName(hero.gear)
 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
 	HogTurnLeft(hero.gear, true)
 	-- Captain Lime
-	AddTeam(teamD.name, teamD.color, "Cherry", "Island", "Default", "congo-brazzaville")
+	teamD.name = AddTeam(teamD.name, teamD.color, "Cherry", "Island", "Default", "congo-brazzaville")
 	green1.gear = AddHog(green1.name, 0, 200, "war_desertofficer")
 	AnimSetGearPosition(green1.gear, green1.x, green1.y)
 	-- Green Bananas
-	AddTeam(teamB.name, teamB.color, "Cherry", "Island", "Default", "congo-brazzaville")
+	teamB.name = AddTeam(teamB.name, teamB.color, "Cherry", "Island", "Default", "congo-brazzaville")
 	green2.gear = AddHog(green2.name, 0, 100, "war_britmedic")
 	AnimSetGearPosition(green2.gear, green2.x, green2.y)
 	HogTurnLeft(green2.gear, true)
@@ -143,7 +144,7 @@
 	AnimSetGearPosition(green5.gear, green5.x, green5.y)
 	HogTurnLeft(green5.gear, true)
 	-- Yellow Watermelons
-	AddTeam(teamC.name, teamC.color, "Flower", "Island", "Default", "cm_mog")
+	teamC.name = AddTeam(teamC.name, teamC.color, "Flower", "Island", "Default", "cm_mog")
 	yellow1.gear = AddHog(yellow1.name, 1, 100, "war_desertgrenadier2")
 	AnimSetGearPosition(yellow1.gear, yellow1.x, yellow1.y)
 	-- the rest of the Yellow Watermelons
@@ -360,7 +361,7 @@
 function battleWin(gear)
 	-- add stats
 	saveVariables()
-	SendStat(siGameResult, loc("Green Bananas won!"))
+	SendStat(siGameResult, string.format(loc("%s won!"), teamB.name))
 	SendStat(siCustomAchievement, loc("You have eliminated all visible enemy hedgehogs!"))
 	sendSimpleTeamRankings({teamA.name, teamD.name, teamB.name, teamC.name})
 	EndGame()
@@ -370,7 +371,7 @@
 	RemoveEventFunc(heroOnLaunchPadWithEnemies)
 	-- add stats
 	saveVariables()
-	SendStat(siGameResult, loc("Hog Solo escaped successfully!"))
+	SendStat(siGameResult, string.format(loc("%s escaped successfully!"), hero.name))
 	SendStat(siCustomAchievement, loc("You have reached the take-off area successfully!"))
 	sendSimpleTeamRankings({teamA.name, teamD.name, teamB.name, teamC.name})
 	EndGame()
@@ -417,17 +418,17 @@
 end
 
 function AnimationSetup()
-	-- DIALOG 01 - Start, Captain Lime talks explains to Hog Solo
+	-- DIALOG 01 - Start, Captain Lime talks and explains stuff to hero
 	AddSkipFunction(dialog01, Skipanim, {dialog01})
 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 1000}})
 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Somewhere on the Planet of Fruits a terrible war is about to begin ..."), 5000}})
 	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("I was told that as the leader of the king's guard, no one knows this world better than you!"), SAY_SAY, 5000}})
 	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("So, I kindly ask for your help."), SAY_SAY, 3000}})
 	table.insert(dialog01, {func = AnimWait, args = {green1.gear, 2000}})
-	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("You couldn't have come to a worse time, Hog Solo!"), SAY_SAY, 3000}})
+	table.insert(dialog01, {func = AnimSay, args = {green1.gear, string.format(loc("You couldn't have come to a worse time, %s!"), hero.name), SAY_SAY, 3000}})
 	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("The clan of the Red Strawberry wants to take over the dominion and overthrow King Pineapple."), SAY_SAY, 5000}})
 	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("Under normal circumstances we could easily defeat them but we have kindly sent most of our men to the Kingdom of Sand to help with the annual dusting of the king's palace."), SAY_SAY, 8000}})
-	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("However, the army of Yellow Watermelons is about to attack any moment now."), SAY_SAY, 4000}})
+	table.insert(dialog01, {func = AnimSay, args = {green1.gear, string.format(loc("However, the army of %s is about to attack any moment now."), teamC.name), SAY_SAY, 4000}})
 	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("I would gladly help you if we won this battle but under these circumstances I'll only help you if you fight for our side."), SAY_SAY, 6000}})
 	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("What do you say? Will you fight for us?"), SAY_SAY, 3000}})
 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
@@ -435,7 +436,7 @@
 	table.insert(dialog01, {func = AfterDialog01, args = {}})
 	-- DIALOG 02 - Hero selects to fight
 	AddSkipFunction(dialog02, Skipanim, {dialog02})
-	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("You choose well, Hog Solo!"), SAY_SAY, 3000}})
+	table.insert(dialog02, {func = AnimSay, args = {green1.gear, string.format(loc("You choose well, %s!"), hero.name), SAY_SAY, 3000}})
 	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("I have only 3 hogs available and they are all cadets."), SAY_SAY, 4000}})
 	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("As you are more experienced, I want you to lead them to battle."), SAY_SAY, 4000}})
 	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("Of course, I will observe the battle and intervene if necessary."), SAY_SAY, 5000}})
@@ -464,7 +465,7 @@
 
 function startBattle()
 	AnimSetInputMask(0xFFFFFFFF)
-	-- Hog Solo weapons
+	-- Hero weapons
 	AddAmmo(hero.gear, amRope, 2)
 	AddAmmo(hero.gear, amBazooka, 3)
 	AddAmmo(hero.gear, amParachute, 1)
@@ -478,14 +479,14 @@
 
 function gameLost()
 	if chooseToBattle then
-		SendStat(siGameResult, loc("The Green Bananas lost, try again!"))
+		SendStat(siGameResult, string.format(loc("%s lost, try again!"), teamB.name))
 		SendStat(siCustomAchievement, loc("You have to eliminate all the visible enemies."))
 		SendStat(siCustomAchievement, loc("5 additional enemies will be spawned during the game."))
 		SendStat(siCustomAchievement, loc("You are in control of all the active ally units."))
 		SendStat(siCustomAchievement, loc("The ally units share their ammo."))
 		SendStat(siCustomAchievement, loc("Try to keep as many allies alive as possible."))
 	else
-		SendStat(siGameResult, loc("Hog Solo couldn't escape, try again!"))
+		SendStat(siGameResult, string.format(loc("%s couldn't escape, try again!"), hero.name))
 		SendStat(siCustomAchievement, loc("You have to get to the left-most land and remove any enemy hog from there."))
 		SendStat(siCustomAchievement, loc("You will play every 3 turns."))
 	end
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit02.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit02.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -22,12 +22,7 @@
 local dialog05 = {}
 -- mission objectives
 local minesTimeText = loc("Mines time: 0 seconds")
-local goals = {
-	[dialog01] = {missionName, loc("Exploring the tunnel"), loc("Search for the device with the help of the other hedgehogs ").."|"..loc("Hog Solo has to reach the last crates") .. "|" .. minesTimeText, 1, 4000},
-	[dialog02] = {missionName, loc("Exploring the tunnel"), loc("Explore the tunnel with the other hedgehogs and search for the device").."|"..loc("Hog Solo has to reach the last crates") .. "|" .. minesTimeText, 1, 4000},
-	[dialog03] = {missionName, loc("Return to the Surface"), loc("Go to the surface!").."|"..loc("Attack Captain Lime before he attacks back").."|"..minesTimeText, 1, 4000},
-	[dialog04] = {missionName, loc("Return to the Surface"), loc("Go to the surface!").."|"..loc("Attack the assassins before they attack back").."|"..minesTimeText, 1, 4000},
-}
+local goals
 -- crates
 local girderCrate = {name = amGirder, x = 1680, y = 1160}
 
@@ -51,13 +46,16 @@
 hero.y = 820
 hero.dead = false
 green1.name = loc("Captain Lime")
+green1.hat = "war_desertofficer"
 green1.x = 1050
 green1.y = 820
 green1.dead = false
 green2.name = loc("Mister Pear")
+green2.hat = "war_britmedic"
 green2.x = 1350
 green2.y = 820
 green3.name = loc("Lady Mango")
+green3.hat = "hair_red"
 green3.x = 1450
 green3.y = 820
 local redHedgehogs = {
@@ -101,22 +99,37 @@
 	AddTeam(teamC.name, teamC.color, "bp2", "Island", "Default", "cm_scout")
 	for i=1,table.getn(redHedgehogs) do
 		redHedgehogs[i].gear =  AddHog(redHedgehogs[i].name, 1, 100, assasinsHats[GetRandom(3)+1])
-		AnimSetGearPosition(redHedgehogs[i].gear, 2010 + 50*i, 630)
+		SetGearPosition(redHedgehogs[i].gear, 2010 + 50*i, 630)
 	end
 	local assassinsColor = div(GetClanColor(GetHogClan(redHedgehogs[1].gear)), 0x100)
 
-	-- Hog Solo and Green Bananas
-	AddTeam(teamA.name, teamA.color, "Simple", "Island", "Default", "hedgehog")
-	hero.gear = AddHog(hero.name, 0, health, "war_desertgrenadier1")
-	AnimSetGearPosition(hero.gear, hero.x, hero.y)
+	-- Hero and Green Bananas
+	teamA.name = AddMissionTeam(teamA.color)
+	hero.gear = AddMissionHog(health)
+	hero.name = GetHogName(hero.gear)
+	SetHogTeamName(hero.gear, string.format(loc("%s and GB"), teamA.name))
+	teamA.name = GetHogTeamName(hero.gear)
+	SetGearPosition(hero.gear, hero.x, hero.y)
 	HogTurnLeft(hero.gear, true)
-	green2.gear = AddHog(green2.name, 0, 100, "war_britmedic")
-	AnimSetGearPosition(green2.gear, green2.x, green2.y)
+	local heroColor = div(GetClanColor(GetHogClan(hero.gear)), 0x100)
+
+	-- companions
+	-- Change companion identity if they have same name as hero
+	-- to avoid confusion.
+	if green2.name == hero.name then
+		green2.name = loc("Green Hog Grape")
+		green2.hat = "war_desertsapper1"
+	elseif green3.name == hero.name then
+		green3.name = loc("Green Hog Grape")
+		green3.hat = "war_desertsapper1"
+	end
+	green2.gear = AddHog(green2.name, 0, 100, green2.hat)
+	SetGearPosition(green2.gear, green2.x, green2.y)
 	HogTurnLeft(green2.gear, true)
-	green3.gear = AddHog(green3.name, 0, 100, "hair_red")
-	AnimSetGearPosition(green3.gear, green3.x, green3.y)
+
+	green3.gear = AddHog(green3.name, 0, 100, green3.hat)
+	SetGearPosition(green3.gear, green3.x, green3.y)
 	HogTurnLeft(green3.gear, true)
-	local heroColor = div(GetClanColor(GetHogClan(hero.gear)), 0x100)
 
 	-- Captain Lime
 	-- Returns a color that is as close as possible to the color argument
@@ -140,8 +153,16 @@
 	-- This is a hack, but it works. See explanation at top of file
 	local cptnColor = getSimilarColor(heroColor, assassinsColor)
 	AddTeam(teamB.name, cptnColor, "Cherry", "Island", "Default", "congo-brazzaville")
-	green1.gear= AddHog(green1.name, 0, 100, "war_desertofficer")
-	AnimSetGearPosition(green1.gear, green1.x, green1.y)
+	green1.gear= AddHog(green1.name, 0, 100, green1.hat)
+	SetGearPosition(green1.gear, green1.x, green1.y)
+
+	-- Populate goals table
+	goals = {
+		[dialog01] = {missionName, loc("Exploring the tunnel"), loc("Search for the device with the help of the other hedgehogs.").."|"..string.format(loc("%s must collect the final crates."), hero.name) .. "|" .. minesTimeText, 1, 4000},
+		[dialog02] = {missionName, loc("Exploring the tunnel"), loc("Explore the tunnel with the other hedgehogs and search for the device.").."|"..string.format(loc("%s must collect the final crates."), hero.name) .. "|" .. minesTimeText, 1, 4000},
+		[dialog03] = {missionName, loc("Return to the Surface"), loc("Go to the surface!").."|"..loc("Attack Captain Lime before he attacks back.").."|"..minesTimeText, 1, 4000},
+		[dialog04] = {missionName, loc("Return to the Surface"), loc("Go to the surface!").."|"..loc("Attack the assassins before they attack back.").."|"..minesTimeText, 1, 4000},
+	}
 
 	AnimInit(true)
 	AnimationSetup()
@@ -158,7 +179,7 @@
 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
 	AddEvent(onDeviceCrates, {hero.gear}, deviceCrateEvent, {hero.gear}, 0)
 
-	-- Hog Solo and GB weapons
+	-- Hero and Green Bananas weapons
 	AddAmmo(hero.gear, amSwitch, 100)
 	-- Assassins weapons
 	AddAmmo(redHedgehogs[1].gear, amBazooka, 6)
@@ -363,13 +384,13 @@
 
 function heroDeath(gear)
 	if not ended then
-		SendStat(siGameResult, loc("Hog Solo lost, try again!"))
-		SendStat(siCustomAchievement, loc("To win the game, Hog Solo has to get the bottom crates and come back to the surface."))
+		SendStat(siGameResult, string.format(loc("%s lost, try again!"), hero.name))
+		SendStat(siCustomAchievement, string.format(loc("To win the game, %s has to get the bottom crates and come back to the surface."), hero.name))
 		SendStat(siCustomAchievement, loc("You can use the other 2 hogs to assist you."))
 		SendStat(siCustomAchievement, loc("Do not destroy the crates!"))
 		if tookPartInBattle then
 			if permitCaptainLimeDeath then
-				SendStat(siCustomAchievement, loc("You'll have to eliminate the Fruit Assassins at the end."))
+				SendStat(siCustomAchievement, string.format(loc("You'll have to eliminate %s at the end."), teamC.name))
 				sendSimpleTeamRankings({teamC.name, teamA.name})
 			else
 				sendSimpleTeamRankings({teamA.name})
@@ -393,7 +414,7 @@
 	-- Stop hedgehog
 	SetGearMessage(deviceCrate.collector, 0)
 	if deviceCrate.collector == hero.gear then
-		-- Hog Solo collected the device crate
+		-- Hero collected the device crate
 
 		if not tookPartInBattle then
 			-- Captain Lime turns evil
@@ -473,10 +494,10 @@
 end
 
 function AnimationSetup()
-	-- DIALOG 01 - Start, Captain Lime helps Hog Solo because he took part in the battle
+	-- DIALOG 01 - Start, Captain Lime helps the hero because he took part in the battle
 	AddSkipFunction(dialog01, Skipanim, {dialog01})
 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
-	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Somewhere else on the planet of fruits, Captain Lime helps Hog Solo"), 5000}})
+	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, string.format(loc("Somewhere else on the planet of fruits, Captain Lime helps %s"), hero.name), 5000}})
 	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("You fought bravely and you helped us win this battle!"), SAY_SAY, 5000}})
 	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("So, as promised I have brought you where I think that the device you are looking for is hidden."), SAY_SAY, 7000}})
 	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("I know that your resources are low due to the battle but I'll send two of my best hogs to assist you."), SAY_SAY, 7000}})
@@ -484,10 +505,10 @@
 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
 	table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
 	table.insert(dialog01, {func = ShowMission, args = goals[dialog01]})
-	-- DIALOG02 - Start, Hog Solo escaped from the previous battle
+	-- DIALOG02 - Start, hero escaped from the previous battle
 	AddSkipFunction(dialog02, Skipanim, {dialog02})
 	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 3000}})
-	table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("Somewhere else on the planet of fruits Hog Solo gets closer to the device"), 5000}})
+	table.insert(dialog02, {func = AnimCaption, args = {hero.gear, string.format(loc("Somewhere else on the planet of fruits, %s gets closer to the device"), hero.name), 5000}})
 	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("You are the one who fled! So, you are alive."), SAY_SAY, 4000}})
 	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("I'm still low on hogs. If you are not afraid I could use a set of extra hands."), SAY_SAY, 4000}})
 	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 8000}})
@@ -506,7 +527,7 @@
 	table.insert(dialog03, {func = FollowGear, args = {hero.gear}})
 	table.insert(dialog03, {func = AnimSay, args = {hero.gear, loc("Hooray! I've found it, now I have to get back to Captain Lime!"), SAY_SAY, 4000}})
 	table.insert(dialog03, {func = AnimWait, args = {green1.gear, 4000}})
-	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("This Hog Solo is so naive! When he returns I'll shoot him and keep that device for myself!"), SAY_THINK, 4000}})
+	table.insert(dialog03, {func = AnimSay, args = {green1.gear, string.format(loc("This %s is so naive! I'm going to shoot this fool so I can keep that device for myself!"), hero.name), SAY_THINK, 4000}})
 	table.insert(dialog03, {func = ShowMission, args = goals[dialog03]})
 	table.insert(dialog03, {func = makeCptLimeEvil, args = {hero.gear}})
 	-- DIALOG04 - At crates, hero learns about the Assassins ambush
@@ -564,9 +585,9 @@
 		escapeHog(deviceCrate.collector)
 		AddCaption(loc("The device part has been stolen!"))
 		sendSimpleTeamRankings({teamA.name})
-		SendStat(siGameResult, loc("Hog Solo lost, try again!"))
-		SendStat(siCustomAchievement, loc("Oh no, the Green Bananas have betrayed Hog Solo and stole the anti-gravity device part!"))
-		SendStat(siCustomAchievement, loc("Only Hog Solo can be trusted with the crate."))
+		SendStat(siGameResult, string.format(loc("%s lost, try again!"), hero.name))
+		SendStat(siCustomAchievement, string.format(loc("Oh no, the companions have betrayed %s and stole the anti-gravity device part!"), hero.name))
+		SendStat(siCustomAchievement, string.format(loc("Only %s can be trusted with the crate."), hero.name))
 		EndGame()
 		ended = true
 	end
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit03.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit03.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -88,19 +88,20 @@
 	WaterRise = 0
 	HealthDecrease = 0
 
-	-- Hog Solo
-	AddTeam(teamA.name, teamA.color, "Simple", "Island", "Default", "hedgewars")
-	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
+	-- Hero
+	teamA.name = AddMissionTeam(teamA.color)
+	hero.gear = AddMissionHog(100)
+	hero.name = GetHogName(hero.gear)
 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
 	-- enemies
 	local hats = { "Bandit", "fr_apple", "fr_banana", "fr_lemon", "fr_orange",
 					"fr_pumpkin", "Gasmask", "NinjaFull", "NinjaStraight", "NinjaTriangle" }
-	AddTeam(teamC.name, teamC.color, "bp2", "Island", "Default", "cm_bars")
+	teamC.name = AddTeam(teamC.name, teamC.color, "bp2", "Island", "Default", "cm_bars")
 	for i=1,table.getn(enemiesEven) do
 		enemiesEven[i].gear = AddHog(enemiesEven[i].name, 1, 100, hats[GetRandom(table.getn(hats))+1])
 		AnimSetGearPosition(enemiesEven[i].gear, enemiesEven[i].x, enemiesEven[i].y)
 	end
-	AddTeam(teamB.name, teamB.color, "bp2", "Island", "Default", "cm_bars")
+	teamB.name = AddTeam(teamB.name, teamB.color, "bp2", "Island", "Default", "cm_bars")
 	for i=1,table.getn(enemiesOdd) do
 		enemiesOdd[i].gear = AddHog(enemiesOdd[i].name, 1, 100, hats[GetRandom(table.getn(hats))+1])
 		AnimSetGearPosition(enemiesOdd[i].gear, enemiesOdd[i].x, enemiesOdd[i].y)
@@ -260,7 +261,7 @@
 -------------- ACTIONS ------------------
 
 function heroDeath(gear)
-	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
+	SendStat(siGameResult, string.format(loc("%s lost, try again!"), hero.name))
 	SendStat(siCustomAchievement, loc("You have to eliminate all the enemies."))
 	SendStat(siCustomAchievement, loc("Read the challenge objectives from within the mission for more details."))
 	sendSimpleTeamRankings({teamB.name, teamC.name, teamA.name})
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -110,17 +110,18 @@
 		SaveCampaignVar("HeroHealth", heroHealth)
 	end
 
-	-- Hog Solo
-	AddTeam(teamC.name, teamC.color, "Simple", "Island", "Default", "hedgewars")
-	hero.gear = AddHog(hero.name, 0, heroHealth, "war_desertgrenadier1")
+	-- Hero
+	teamC.name = AddMissionTeam(teamC.color)
+	hero.gear = AddMissionHog(heroHealth)
+	hero.name = GetHogName(hero.gear)
 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
 	HogTurnLeft(hero.gear, true)
 	-- Ally
-	AddTeam(teamA.name, teamA.color, "heart", "Island", "Default", "cm_face")
+	teamA.name = AddTeam(teamA.name, teamA.color, "heart", "Island", "Default", "cm_face")
 	ally.gear = AddHog(ally.name, 0, 100, "war_airwarden02")
 	AnimSetGearPosition(ally.gear, ally.x, ally.y)
 	-- Frozen Bandits
-	AddTeam(teamB.name, teamB.color, "plant2", "Island", "Default", "cm_pirate")
+	teamB.name = AddTeam(teamB.name, teamB.color, "plant2", "Island", "Default", "cm_pirate")
 	bandit1.gear = AddHog(bandit1.name, 1, 120, "Santa")
 	AnimSetGearPosition(bandit1.gear, bandit1.x, bandit1.y)
 	HogTurnLeft(bandit1.gear, true)
@@ -439,7 +440,7 @@
 end
 
 function heroDeath(gear)
-	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
+	SendStat(siGameResult, string.format(loc("%s lost, try again!"), hero.name))
 	SendStat(siCustomAchievement, loc("To win the game you have to stand next to Thanta."))
 	SendStat(siCustomAchievement, loc("Most of the time you'll be able to use the freezer only."))
 	SendStat(siCustomAchievement, loc("Use the bazooka and the flying saucer to get the freezer."))
@@ -469,7 +470,7 @@
 end
 
 function thantaDeath(gear)
-	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
+	SendStat(siGameResult, string.format(loc("%s lost, try again!"), hero.name))
 	SendStat(siCustomAchievement, loc("Noo, Thanta has to stay alive!"))
 	SendStat(siCustomAchievement, loc("To win the game you have to go next to Thanta."))
 	SendStat(siCustomAchievement, loc("Most of the time you'll be able to use the freezer only."))
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice02.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice02.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -81,12 +81,13 @@
 	WaterRise = 0
 	HealthDecrease = 0
 
-	-- Hog Solo
-	AddTeam(teamA.name, teamA.color, "Simple", "Island", "Default", "hedgewars")
-	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
+	-- Hero
+	teamA.name = AddMissionTeam(teamA.color)
+	hero.gear = AddMissionHog(100)
+	hero.name = GetHogName(hero.gear)
 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
 	-- Ally
-	AddTeam(teamB.name, teamB.color, "heart", "Island", "Default", "cm_face")
+	teamB.name = AddTeam(teamB.name, teamB.color, "heart", "Island", "Default", "cm_face")
 	ally.gear = AddHog(ally.name, 0, 100, "war_airwarden02")
 	AnimSetGearPosition(ally.gear, ally.x, ally.y)
 	HogTurnLeft(ally.gear, true)
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon01.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon01.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -111,16 +111,17 @@
 	WaterRise = 0
 	Map = "moon01_map"
 	Theme = "Cheese" -- Because ofc moon is made of cheese :)
-	-- Hog Solo
-	AddTeam(teamD.name, teamD.color, "Simple", "Island", "Default", "hedgewars")
+	-- Hero
+	teamD.name = AddMissionTeam(teamD.color)
 	if tonumber(GetCampaignVar("HeroHealth")) then
-		hero.gear = AddHog(hero.name, 0, tonumber(GetCampaignVar("HeroHealth")), "war_desertgrenadier1")
+		hero.gear = AddMissionHog(tonumber(GetCampaignVar("HeroHealth")))
 	else
-		hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
+		hero.gear = AddMissionHog(100)
 	end
+	hero.name = GetHogName(hero.gear)
 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
 	-- PAotH
-	AddTeam(teamA.name, teamA.color, "Earth", "Island", "Default", "cm_galaxy")
+	teamA.name = AddTeam(teamA.name, teamA.color, "Earth", "Island", "Default", "cm_galaxy")
 	paoth1.gear = AddHog(paoth1.name, 0, 100, "scif_2001O")
 	AnimSetGearPosition(paoth1.gear, paoth1.x, paoth1.y)
 	HogTurnLeft(paoth1.gear, true)
@@ -134,12 +135,12 @@
 	AnimSetGearPosition(paoth4.gear, paoth4.x, paoth4.y)
 	HogTurnLeft(paoth4.gear, true)
 	-- Professor
-	AddTeam(teamC.name, teamC.color, "star", "Island", "Default", "cm_sine")
+	teamC.name = AddTeam(teamC.name, teamC.color, "star", "Island", "Default", "cm_sine")
 	professor.gear = AddHog(professor.name, 0, professor.health, "tophats")
 	AnimSetGearPosition(professor.gear, professor.x, professor.y)
 	HogTurnLeft(professor.gear, true)
 	-- Minions
-	AddTeam(teamB.name, teamB.color, "eyecross", "Island", "Default", "cm_sine")
+	teamB.name = AddTeam(teamB.name, teamB.color, "eyecross", "Island", "Default", "cm_sine")
 	minion1.gear = AddHog(minion1.name, 1, 50, "Gasmask")
 	AnimSetGearPosition(minion1.gear, minion1.x, minion1.y)
 	HogTurnLeft(minion1.gear, true)
@@ -172,7 +173,7 @@
 	AnimWait(hero.gear, 3000)
 	FollowGear(hero.gear)
 
-	ShowMission(campaignName, missionName, loc("Hog Solo has to refuel his saucer.")..
+	ShowMission(campaignName, missionName, string.format(loc("%s has to refuel the saucer."), hero.name)..
 	"|"..loc("Rescue the imprisoned PAotH team and get the fuel!"), -amSkip, 0)
 
 	AddAmmo(minion1.gear, amDEagle, 10)
@@ -361,7 +362,7 @@
 end
 
 function heroDeath(gear)
-	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
+	SendStat(siGameResult, string.format(loc("%s lost, try again!"), hero.name))
 	SendStat(siCustomAchievement, loc("You have to get the weapons and rescue the PAotH researchers."))
 	sendSimpleTeamRankings({teamC.name, teamB.name, teamD.name, teamA.name})
 	EndGame()
@@ -387,7 +388,7 @@
 function victory()
 	AnimCaption(hero.gear, loc("Congrats! You won!"), 6000)
 	saveCompletedStatus(1)
-	SendStat(siGameResult, loc("Hog Solo wins, congratulations!"))
+	SendStat(siGameResult, string.format(loc("%s wins, congratulations!"), hero.name))
 	sendSimpleTeamRankings({teamD.name, teamA.name, teamC.name, teamB.name})
 	SaveCampaignVar("CosmosCheckPoint", "5") -- hero got fuels
 	resetCheckpoint() -- reset this mission
@@ -473,7 +474,7 @@
 	AddSkipFunction(dialog01, Skipanim, {dialog01})
 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Near a PAotH base on the moon ..."),  4000}})
-	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("Hey, Hog Solo! Finally you have come!"), SAY_SAY, 2000}})
+	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, string.format(loc("Hey, %s! Finally you have come!"), hero.name), SAY_SAY, 2000}})
 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("It seems that Professor Hogevil has prepared for your arrival!"), SAY_SAY, 4000}})
 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("He has captured the rest of the PAotH team and awaits to capture you!"), SAY_SAY, 5000}})
 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("We have to hurry! Are you armed?"), SAY_SAY, 4300}})
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon02.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon02.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -1,6 +1,6 @@
 ------------------- ABOUT ----------------------
 --
--- Hog Solo has to catch the other hog in order
+-- The hero has to catch the other hog in order
 -- to get informations about the origin of Pr. Hogevil
 
 HedgewarsScriptLoad("/Scripts/Locale.lua")
@@ -63,12 +63,13 @@
 	WaterRise = 0
 	HealthDecrease = 0
 
-	-- Hog Solo
-	AddTeam(teamA.name, teamA.color, "Simple", "Island", "Default", "hedgewars")
-	hero.gear = AddHog(hero.name, 0, 1, "war_desertgrenadier1")
+	-- Hero
+	teamA.name = AddMissionTeam(teamA.color)
+	hero.gear = AddMissionHog(1)
+	hero.name = GetHogName(hero.gear)
 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
 	-- Crazy Runner
-	AddTeam(teamB.name, teamB.color, "ring", "Island", "Default", "cm_sonic")
+	teamB.name = AddTeam(teamB.name, teamB.color, "ring", "Island", "Default", "cm_sonic")
 	runner.gear = AddHog(runner.name, 0, 100, "sth_Sonic")
 	AnimSetGearPosition(runner.gear, runner.places[1].x, runner.places[1].y)
 	HogTurnLeft(runner.gear, true)
@@ -181,7 +182,7 @@
 	table.insert(dialog01, {func = AnimSay, args = {runner.gear, loc("Let's go!"), SAY_SAY, 2000}})
 	table.insert(dialog01, {func = ShowMission, args = goals[dialog01]})
 	table.insert(dialog01, {func = moveRunner, args = {}})
-	-- DIALOG 02 - Hog Solo story
+	-- DIALOG 02 - Professor Hogevil story
 	AddSkipFunction(dialog02, Skipanim, {dialog02})
 	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 3200}})
 	table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("The truth about Professor Hogevil"), 5000}})
--- a/share/hedgewars/Data/Missions/Challenge/Basic_Training_-_Sniper_Rifle.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Challenge/Basic_Training_-_Sniper_Rifle.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -53,7 +53,7 @@
 local delayedTargetTargetX, delayedTargetY
 
 -- Team name of the player's team
-local playerTeamName = loc("Sniperz")
+local playerTeamName
 
 -- This is a custom function to make it easier to
 -- spawn more targets with just one line of code
@@ -133,9 +133,10 @@
 	HealthDecrease = 0
 
 	-- Create the player team
-	AddTeam(playerTeamName, -1, "Simple", "Island", "Default", "cm_crosshair")
+	AddMissionTeam(-1)
+	playerTeamName = GetTeamName(0)
 	-- And add a hog to it
-	player = AddHog(loc("Hunter"), 0, 1, "Sniper")
+	player = AddMissionHog(1)
 	SetGearPosition(player, 602, 1465)
 end
 
--- a/share/hedgewars/Data/Missions/Challenge/ClimbHome.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Challenge/ClimbHome.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -23,8 +23,8 @@
     Explosives = 0
     MineDudPercent = 0
     Map = "ClimbHome"
-    AddTeam(loc("Lonely Hog"), -1, "bubble", "Island", "Default")
-    player = AddHog(loc("Climber"), 0, 1, "NoHat")
+    AddMissionTeam(-1)
+    player = AddMissionHog(1)
     if showWaterStats then
         dummyHog = AddHog(" ", 0, 1, "NoHat")
         HH[dummyHog] = nil
--- a/share/hedgewars/Data/Missions/Challenge/User_Mission_-_RCPlane_Challenge.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Challenge/User_Mission_-_RCPlane_Challenge.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -35,8 +35,8 @@
 	MinesNum = 0
 	Explosives = 0
 
-	AddTeam(loc("Wannabe Flyboys"), -1, "Simple", "Island", "Default", "cm_scout")
-	player = AddHog(loc("Ace"), 0, 80, "Gasmask")
+	AddMissionTeam(-1)
+	player = AddMissionHog(80)
 	SetGearPosition(player, 1380, 1500)
 
 end
--- a/share/hedgewars/Data/Missions/Challenge/User_Mission_-_Rope_Knock_Challenge.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Challenge/User_Mission_-_Rope_Knock_Challenge.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -73,7 +73,7 @@
 
 				}
 
-local playerTeamName = loc("Wannabe Shoppsta")
+local playerTeamName
 
 function GetKillScore()
 	return math.ceil((hogsKilled / 16)*6000)
@@ -174,8 +174,8 @@
 	MinesNum = 0
 	Explosives = 0
 
-	AddTeam(playerTeamName, -1, "money", "Island", "Default", "cm_shoppa")
-	hhs[0] = AddHog(loc("Ace"), 0, 1, "Gasmask")
+	playerTeamName = AddMissionTeam(-1)
+	hhs[0] = AddMissionHog(1)
 	SetGearPosition(player, 1380, 1500)
 
 	AddTeam(loc("Unsuspecting Louts"), -2, "Simple", "Island", "Default", "cm_face")
--- a/share/hedgewars/Data/Missions/Challenge/User_Mission_-_That_Sinking_Feeling.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Challenge/User_Mission_-_That_Sinking_Feeling.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -5,6 +5,7 @@
 HedgewarsScriptLoad("/Scripts/Achievements.lua")
 
 local player
+local playerTeamName, haplessTeamName
 local hh = {}
 local hhCount = 8
 local GameOver = false
@@ -23,7 +24,7 @@
 	if show then
 		recordInfo = getReadableChallengeRecord("Highscore")
 	end
-	ShowMission(loc("That Sinking Feeling"), loc("Challenge"), loc("Save as many hapless hogs as possible!")
+	ShowMission(loc("That Sinking Feeling"), loc("Challenge"), loc("Save as many hogs as possible!")
 	.. "|" .. recordInfo, 4, 0)
 end
 
@@ -53,7 +54,7 @@
 	HealthDecrease = 0
 	WaterRise = 0
 
-	AddTeam(loc("Hapless Hogs"), -1, "Simple", "Island", "Default")
+	haplessTeamName = AddTeam(loc("Hapless Hogs"), -1, "Simple", "Island", "Default")
 	hh[0] = AddHog(loc("Sinky"), 1, 100, "fr_lemon")
 	hh[1] = AddHog(loc("Drowner"), 1, 100, "fr_orange")
 	hh[2] = AddHog(loc("Heavy"), 1, 100, "dish_Teapot")
@@ -63,8 +64,8 @@
 	hh[6] = AddHog(loc("Sponge"), 1, 100, "sf_chunli")
 	hh[7] = AddHog(loc("Deadweight"), 1, 100, "dish_Teacup")
 
-	AddTeam(loc("Nameless Heroes"), -1, "Simple", "Island", "Default", "cm_crossedswords")
-	player = AddHog(loc("The Nameless One"), 0, 1, "NoHat")
+	playerTeamName = AddMissionTeam(-1)
+	player = AddMissionHog(1)
 
 	SetGearPosition(player, 3992, 733)
 	SetGearPosition(hh[0], 938, 1369)
@@ -213,7 +214,7 @@
 			if genCounter == 2000 then
 				introStage = 110
 				FollowGear(CurrentHedgehog)
-				ShowMission(loc("That Sinking Feeling"), loc("User Challenge"), loc("Save as many hapless hogs as possible!"), 4, 0)
+				ShowMission(loc("That Sinking Feeling"), loc("User Challenge"), loc("Save as many hogs as possible!"), 4, 0)
 				SetInputMask(0xFFFFFFFF)
 			end
 
@@ -241,7 +242,7 @@
 				AddCaption(loc("The flood has stopped! Challenge over."))
 				SendStat(siGameResult, loc("Challenge completed!"))
 				SendStat(siPointType, loc("rescues"))
-				SendStat(siPlayerKills, tostring(hhCount), loc("Nameless Heroes"))
+				SendStat(siPlayerKills, tostring(hhCount), playerTeamName)
 
 				-- Do not count drowning hedgehogs
 				local hhLeft = hhCount
@@ -252,7 +253,7 @@
 					end
 				end
 
-				SendStat(siCustomAchievement, string.format(loc("You saved %d of 8 Hapless Hogs."), hhLeft))
+				SendStat(siCustomAchievement, string.format(loc("You saved %d of 8 hegehogs."), hhLeft))
 
 				-- Update highscore
 				updateChallengeRecord("Highscore", hhLeft)
@@ -292,9 +293,9 @@
 function onGearDelete(gear)
 
 	if GetGearType(gear) == gtHedgehog then
-		if GetHogTeamName(gear) == loc("Hapless Hogs") then
+		if GetHogTeamName(gear) == haplessTeamName then
 			hhCount = hhCount - 1
-			AddCaption(string.format(loc("%d Hapless Hogs left"), hhCount))
+			AddCaption(string.format(loc("Hedgehogs left: %d"), hhCount))
 		end
 	end
 
@@ -308,7 +309,7 @@
 			SendStat(siCustomAchievement, loc("You haven't rescued anyone."))
 		end
 		SendStat(siPointType, loc("points"))
-		SendStat(siPlayerKills, "0", loc("Nameless Heroes"))
+		SendStat(siPlayerKills, "0", playerTeamName)
 		local highscore = tonumber(GetMissionVar("Highscore"))
 		show = (type(highscore) == "number") and (highscore > 0)
 		updateChallengeRecord("Highscore", 0, show)
--- a/share/hedgewars/Data/Missions/Scenario/Bazooka_Battlefield.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Scenario/Bazooka_Battlefield.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -14,24 +14,16 @@
 		[amBazooka] = { count = 9 },
 	},
 	teams = {
-		{ name = loc("Pincer Knights"),
-		flag = "cm_swordshield",
-		grave = "Grave",
+		{ isMissionTeam = true,
 		hogs = {
 			{
-			name = loc("Left Tong"),
 			health = 100,
 			x = 276, y = 825,
-			botLevel = 0,
-			hat = "knight",
 			ammo = { [amSwitch] = 100 },
 			},
 			{
-			name = loc("Right Tong"),
 			health = 100,
 			x = 1794, y = 716,
-			botLevel = 0,
-			hat = "knight",
 			faceLeft = true,
 			},
 		}, },
--- a/share/hedgewars/Data/Missions/Scenario/Big_Armory.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Scenario/Big_Armory.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -28,16 +28,12 @@
 		* relevant GameFlag: gfDisableLandObjects ]]
 	},
 	teams = {
-		{ name = loc("Pro Killers"),
+		{ isMissionTeam = true,
 		clanID = 0,
-		flag = "cm_scout",
-		grave = "Bone",
 		hogs = {
 			{
-			name = loc("Ultrasoldier"),
 			health = 100,
 			x = 543, y = 1167,
-			hat = "Terminator_Glasses",
 			ammo = heroAmmo,
 			}
 		}, },
--- a/share/hedgewars/Data/Missions/Scenario/Tentacle_Terror.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Scenario/Tentacle_Terror.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -16,16 +16,12 @@
 	},
 	wind = -50,
 	teams = {
-		{ name = loc("Hell Army"),
-		flag = "cm_hellish",
-		grave = "Simple_reversed",
+		{ isMissionTeam = true,
 		hogs = { {
-			name = loc("Lord Evil"),
 			faceLeft = true,
 			health = 30,
 			x = 1210, y = 1446,
-			hat = "Evil",
-			botLevel = 0 } }
+			} }
 		},
 		{ name = loc("Heavenly Defense"),
 		flag = "cm_fcw",
--- a/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Bamboo_Thicket.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Bamboo_Thicket.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -24,8 +24,8 @@
 	WaterRise = 0
 	GameFlags = gfDisableWind
 
-	AddTeam(loc("Pathetic Resistance"), -1, "Plinko", "Island", "Default", "cm_yinyang")
-	player = AddHog(loc("Ikeda"), 0, 10, "StrawHat")
+	AddMissionTeam(-1)
+	player = AddMissionHog(10)
 			
 	AddTeam(loc("Cybernetic Empire"), -6, "ring", "Island", "Robot", "cm_cyborg")
 	enemy = AddHog(loc("Unit 835"), 1, 10, "cyborg1")
--- a/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Dangerous_Ducklings.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Dangerous_Ducklings.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -30,8 +30,8 @@
 	HealthDecrease = 0
 	WaterRise = 0
 
-	AddTeam(loc("Bloody Rookies"), -1, "Rubberduck", "Island", "Default", "cm_duckhead")
-	player = AddHog(loc("Hunter"), 0, 1, "NoHat")
+	AddMissionTeam(-1)
+	player = AddMissionHog(1)
 	instructor = AddHog(loc("Instructor"), 0, 100, "sf_vega")
 
 	AddTeam(loc("Blue Team"), -2, "bubble", "Island", "Default", "somalia")
@@ -54,7 +54,7 @@
 
 	FollowGear(player)
 
-	ShowMission(loc("Dangerous Ducklings"), loc("Scenario"), loc("Eliminate the Blue Team before the time runs out."), -amRope, 5000);
+	ShowMission(loc("Dangerous Ducklings"), loc("Scenario"), loc("Eliminate the enemy before the time runs out."), -amRope, 5000);
 
 end
 
@@ -114,7 +114,7 @@
 			if endTimer >= 3000 then
 				--SetHealth(instructor,0)
 				SetTurnTimeLeft(1)
-				DismissTeam(loc("Bloody Rookies"))
+				DismissTeam(GetHogTeamName(player))
 			end
 			ShowMission(loc("Dangerous Ducklings"), loc("MISSION FAILED"), loc("You've failed. Try again."), -amRope, 5000);
 		end
@@ -137,7 +137,7 @@
 			HogSay(player, loc("See ya!"), SAY_THINK)
 			Retreat(3000)
 			awardAchievement(loc("Naughty Ninja"))
-			DismissTeam(loc("Blue Team"))
+			DismissTeam(GetHogTeamName(enemy))
 			gameWon = true
 			SaveMissionVar("Won", "true")
 		elseif gear == enemy then
--- a/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Diver.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Diver.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -26,8 +26,8 @@
 	HealthDecrease = 0
 	WaterRise = 0
 
-	AddTeam(loc("Bloody Rookies"), -1, "deadhog", "Island", "Default", "cm_eyes")
-	player = AddHog(loc("Hunter"), 0, 1, "NoHat")
+	AddMissionTeam(-1)
+	player = AddMissionHog(1)
 			
 	AddTeam(loc("Toxic Team"), -6, "skull", "Island", "Default", "cm_magicskull")
 	enemy = AddHog(loc("Poison"), 1, 100, "Skull")
--- a/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Newton_and_the_Hammock.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Newton_and_the_Hammock.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -13,12 +13,10 @@
 		MapFeatureSize = 12,
 	},
 	teams = {
-		{ name = loc("Pathetic Resistance"),
+		{ isMissionTeam = true,
 		clanID = 0,
-		flag = "cm_yinyang",
-		grave = "Plinko",
 		hogs = {
-			{name = loc("Ikeda"), health = 48, x = 397, y = 865, hat = "StrawHat"}
+			{health = 48, x = 397, y = 865}
 		}, },
 
 		{ name = loc("Cybernetic Empire"),
--- a/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Nobody_Laugh.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Nobody_Laugh.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -24,26 +24,17 @@
 		[amSwitch] = { count = 9 },
 	},
 	teams = {
-		{ name = loc("Nameless Heroes"),
-		flag = "cm_crossedswords",
-		grave = "eyecross",
-		voice = "HillBilly",
+		{ isMissionTeam = true,
 		clanID = 0,
 		hogs = {
 			{
-			name = loc("Hunter"),
 			health = 1,
 			x = 1267, y = 451,
-			hat = "Skull",
-			botLevel = 0,
 			ammo = { [amParachute] = 1, [amHammer] = 1 },
 			},
 			{
-			name = loc("Drowner"),
 			health = 31,
 			x = 1332, y = 451,
-			hat = "mp3",
-			botLevel = 0,
 			ammo = { [amWhip] = 1 },
 			},
 		}},
--- a/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Spooky_Tree.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Spooky_Tree.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -29,8 +29,8 @@
 	HealthDecrease = 0
 	WaterRise = 0
 
-	AddTeam(loc("Bloody Rookies"), -1, "deadhog", "Island", "Default", "cm_eyes")
-	player = AddHog(loc("Hunter"), 0, 1, "NoHat")
+	AddMissionTeam(-1)
+	player = AddMissionHog(1)
 	AddTeam(loc("Toxic Team"), -6, "skull", "Island", "Default", "cm_magicskull")
 	enemy = AddHog(loc("Poison"), 1, 10, "Skull")
 
--- a/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Teamwork.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Teamwork.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -24,9 +24,10 @@
 	HealthDecrease = 0
 	WaterRise = 0
 
-	AddTeam(playerTeamName, -1, "Statue", "Island", "Default", "cm_kiwi")
-	player = AddHog(loc("Greg"), 0, 50, "NoHat")
-	p2 = AddHog(loc("Mark"), 0, 20, "NoHat")
+	local idx = AddMissionTeam(-1)
+	playerTeamName = GetTeamName(idx)
+	player = AddMissionHog(50)
+	p2 = AddMissionHog(20)
 
 	AddTeam(loc("Cybernetic Empire"), -6, "ring", "Island", "Robot", "cm_cyborg")
 	enemy = AddHog(loc("Unit 3378"), 5, 30, "cyborg1")
--- a/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Teamwork_2.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Teamwork_2.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -9,7 +9,7 @@
 local Pack = nil
 local help = false
 local GameOver = false
-local playerTeamName = loc("Feeble Resistance")
+local playerTeamName
 
 function onGameInit()
 	Seed = 0
@@ -26,9 +26,10 @@
 	Map = "CrazyMission"
 	Theme = "CrazyMission"
 
-	AddTeam(playerTeamName, -1, "Statue", "Island", "Default", "cm_kiwi")
-	player = AddHog(loc("Greg"), 0, 30, "NoHat")
-	hlayer = AddHog(loc("Mark"), 0, 40, "NoHat")
+	local idx = AddMissionTeam(-1)
+	playerTeamName = GetTeamName(idx)
+	player = AddMissionHog(30)
+	hlayer = AddMissionHog(40)
 
 	AddTeam(loc("Cybernetic Empire"), -6, "ring", "Island", "Robot", "cm_binary")
 	enemy = AddHog(loc("WatchBot 4000"), 5, 50, "cyborg1")
--- a/share/hedgewars/Data/Missions/Scenario/User_Mission_-_The_Great_Escape.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Scenario/User_Mission_-_The_Great_Escape.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -19,10 +19,8 @@
 		[amFirePunch] = { ammoInCrate = 3 },
 	},
 	teams = {
-		{ name = loc("Hero Team"),
-		flag = "cm_swordshield",
-		grave = "star",
-		hogs = {{ name = loc("Good Dude"), health = 1, x = 1050, y = 534 }},
+		{ isMissionTeam = true,
+		hogs = {{ health = 1, x = 1050, y = 534 }},
 		},
 		{ name = loc("Bad Team"),
 		flag = "cm_dragonrb",
--- a/share/hedgewars/Data/Missions/Scenario/portal.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Scenario/portal.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -19,10 +19,10 @@
 	HealthDecrease = 0
 	WaterRise = 0
 
-	AddTeam(loc("Subjects"), -9, "Simple", "Island", "Default", "cm_test")
-	player = AddHog(loc("Subject 1"), 0, 10, "Terminator_Glasses")
+	AddMissionTeam(-1)
+	player = AddMissionHog(10)
 
-	AddTeam(loc("Hell Army"), -1, "skull", "Island", "Default", "cm_hellish")
+	AddTeam(loc("Hell Army"), -9, "skull", "Island", "Default", "cm_hellish")
 	enemy1 = AddHog(loc("Lucifer"), 1, 200, "InfernalHorns")
 	enemy2 = AddHog(loc("Voldemort"), 1, 150, "WizardHat")
 	enemy3 = AddHog(loc("Zombi"), 1, 100, "Zombi")
@@ -32,7 +32,7 @@
 	enemy7 = AddHog(loc("C-2"), 1, 50, "cyborg1")
 	enemy8 = AddHog(loc("Rider"), 1, 50, "scif_SparkssHelmet")
 
-	AddTeam(loc("Badmad"), -1, "skull", "Island", "Default", "cm_pentagram")
+	AddTeam(loc("Badmad"), -9, "skull", "Island", "Default", "cm_pentagram")
 	enemy9 = AddHog(loc("C-1"), 1, 50, "cyborg2")
 	enemy10 = AddHog(loc("Hidden"), 1, 40, "bushhider")
 	enemy11 = AddHog(loc("Ronald"), 1, 70, "clown")
--- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Bazooka.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Bazooka.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -47,8 +47,8 @@
 
 	------ TEAM LIST ------
 
-	AddTeam(loc("Bazooka Team"), -1, "Flower", "Earth", "Default", "hedgewars")
-	hog = AddHog(loc("Greenhorn"), 0, 100, "NoHat")
+	AddMissionTeam(-1)
+	hog = AddMissionHog(100)
 	SetGearPosition(hog, 1485, 2001)
 	SetEffect(hog, heResurrectable, 1)
 
@@ -228,7 +228,7 @@
 		end
 		SendStat(siCustomAchievement, loc("Good job!"))
 		SendStat(siGameResult, loc("You have completed the Basic Bazooka Training!"))
-		SendStat(siPlayerKills, "0", loc("Bazooka Team"))
+		SendStat(siPlayerKills, "0", GetHogTeamName(hog))
 		EndGame()
 		gameOver = true
 	end
--- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Flying_Saucer.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Flying_Saucer.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -209,7 +209,7 @@
 
 	SendStat(siGameResult, loc("You have finished the Flying Saucer Training!"))
 	SendStat(siCustomAchievement, loc("Good job!"))
-	SendStat(siPlayerKills, "0", loc("Hogonauts"))
+	SendStat(siPlayerKills, "0", GetHogTeamName(Player))
 
 	EndTurn(true)
 	EndGame()
@@ -397,11 +397,9 @@
 	WaterRise = 0
 	HealthDecrease = 0
 
-	-- Team name is a pun on “hedgehog” and “astronauts”
-	AddTeam( loc( "Hogonauts" ), -9, "earth", "Earth", "Default", "cm_galaxy" )
+	AddMissionTeam(-9)
 
-	-- Hedgehog name is a pun on “Neil Armstrong”
-	Player = AddHog( loc( "Neil Hogstrong" ), 0, 1, "NoHat" )
+	Player = AddMissionHog(1)
 	SetGearPosition( Player, StartPos.X, StartPos.Y)
 	SetEffect( Player, heResurrectable, 1 )
 end
--- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Grenade.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Grenade.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -39,8 +39,8 @@
 
 	------ TEAM LIST ------
 
-	AddTeam(loc("Grenade Team"), -1, "Flower", "Earth", "Default", "cm_grenade")
-	hog = AddHog(loc("Greenhorn"), 0, 1, "NoHat")
+	AddMissionTeam(-1)
+	hog = AddMissionHog(1)
 	SetGearPosition(hog, 570, 157)
 	SetEffect(hog, heResurrectable, 1)
 
@@ -203,7 +203,7 @@
 		end
 		SendStat(siCustomAchievement, loc("Good job!"))
 		SendStat(siGameResult, loc("You have completed the Basic Grenade Training!"))
-		SendStat(siPlayerKills, "0", loc("Grenade Team"))
+		SendStat(siPlayerKills, "0", GetHogTeamName(hog))
 		EndGame()
 		gameOver = true
 	end
--- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Movement.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Movement.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -115,18 +115,18 @@
 	drawMap()
 
 	------ HOG LIST ------
-	AddTeam(loc("Training Team"), -1, "deadhog", "SteelTower", "Default", "hedgewars")
+	AddMissionTeam(-1)
 	
-	hhs[1] = AddHog(loc("Greenhorn"), 0, 100, "NoHat")
+	hhs[1] = AddMissionHog(100)
 	SetGearPosition(hhs[1], 404, 1714)
 	SetEffect(hhs[1], heResurrectable, 1)
 
-	hhs[2] = AddHog(loc("Rhombus"), 0, 100, "NoHat")
+	hhs[2] = AddMissionHog(100)
 	SetGearPosition(hhs[2], 620, 1538)
 	SetEffect(hhs[2], heResurrectable, 1)
 	HogTurnLeft(hhs[2], true)
 
-	hhs[3] = AddHog(loc("Trapped"), 0, 100, "NoHat")
+	hhs[3] = AddMissionHog(100)
 	SetGearPosition(hhs[3], 1573, 1824)
 	SetEffect(hhs[3], heResurrectable, 1)
 	
@@ -135,12 +135,23 @@
 	SetEffect(hhs[4], heResurrectable, 1)
 	HogTurnLeft(hhs[4], true)
 	
-	hhs[5] = AddHog(loc("Ice"), 0, 100, "NoHat")
+	hhs[5] = AddMissionHog(100)
 	SetGearPosition(hhs[5], 1813, 1285)
 	SetEffect(hhs[5], heResurrectable, 1)
 
 	hog_greenhorn = hhs[1]
 	hog_cappy = hhs[4]
+
+	for i=1,#hhs do
+		if hhs[i] ~= hog_cappy then
+			if GetHogName(hhs[i]) == loc("Cappy") then
+				SetHogName(hhs[i], loc("Greenhorn"))
+			end
+			if GetHogHat(hhs[i]) == "cap_red" then
+				SetHogHat(hhs[i], "NoHat")
+			end
+		end
+	end
 	
 	SendHealthStatsOff()
 end
@@ -254,7 +265,7 @@
 	SendStat(siGameResult, loc("You have completed the Basic Movement Training!"))
 	SendStat(siCustomAchievement, loc("Congratulations!"))
 	SendStat(siCustomAchievement, loc("Return to the training menu by pressing the “Go back” button."))
-	SendStat(siPlayerKills, "0", loc("Training Team"))
+	SendStat(siPlayerKills, "0", GetHogTeamName(hog_greenhorn))
 	PlaySound(sndVictory, CurrentHedgehog)
 	-- Disable controls, end game
 	SetInputMask(0)
--- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Rope.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Rope.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -47,7 +47,7 @@
 -- "Constants"
 local initHogHealth = 50
 local initHogHealthFinal = 1
-local teamName = loc("Wannabe Ropers")
+local teamName
 
 local girderData = {
 	{2012, 1366, 6}, -- water gate
@@ -96,8 +96,8 @@
 	WaterRise = 0
 	HealthDecrease = 0
 
-	AddTeam(teamName, -1, "Plinko", "Snail", "Default", "cm_yinyang")
-	hog = AddHog(loc("Roper"), 0, initHogHealth, "StrawHat")
+	teamName = AddMissionTeam(-1)
+	hog = AddMissionHog(initHogHealth)
 	SetGearPosition(hog, cpX, cpY)
 	SetEffect(hog, heResurrectable, 1)
 
--- a/share/hedgewars/Data/Scripts/SimpleMission.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Scripts/SimpleMission.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -53,27 +53,30 @@
 	- probability		probability in crates (default: 0)
 
 	TEAM DATA
+	- isMissionTeam		if true, this is the player's chosen team for this mission (default: false)
 	- hogs			table of hedgehogs in this team (must contain at least 1 hog)
-	- name			team name
 	- clanID		ID of the clan to which this team belongs to. Counting starts at 0.
 				By default, each team goes into its own clan.
 				Important: The clan of the player and allies MUST be 0.
 				Important: You MUST either set the clan ID explicitly for all teams or none of them.
+	These arguments will be ignored if this is a mission team:
+	- name			team name
 	- flag			flag name (default: hedgewars)
 	- grave			grave name (has default grave for each team)
 	- fort			fort name (default: Castle)
 
 	HEDGEHOG DATA:
 	- id			optional identifier for goals
-	- name			hog name
+	- health		hog health (default: 100)
+	- ammo			table of ammo types
 	- x, y			hog position (default: spawns randomly on land)
-	- botLevel		1-5: Bot level (lower=stronger). 0=human player (default: 0)
-	- hat			hat name (default: NoHat)
-	- health		hog health (default: 100)
 	- poisoned		if true, hedgehog starts poisoned with 5 poison damage. Set to a number for other poison damage (default: false)
 	- frozen		if true, hedgehogs starts frozen (default: false)
 	- faceLeft		initial facing direction. true=left, false=false (default: false)
-	- ammo			table of ammo types
+	These arguments will be ignored if the hog is in a mission team:
+	- name			hog name
+	- botLevel		1-5: Bot level (lower=stronger). 0=human player (default: 0)
+	- hat			hat name (default: NoHat)
 
 	GEAR TYPES:
 	- type			gear type
@@ -656,12 +659,35 @@
 			else
 				clanID = teamData.clanID
 			end
-			grave = def(teamData.grave, defaultGraves[math.min(teamID, 8)])
-			fort = def(teamData.fort, "Castle")
-			voice = def(teamData.voice, "Default")
-			flag = def(teamData.flag, defaultFlags[math.min(teamID, 8)])
+
+			local realName
+			if teamData.isMissionTeam then
+				realName = AddMissionTeam(-(clanID+1))
+				_G.sm.playerClan = clanID
+			else
+				grave = def(teamData.grave, defaultGraves[math.min(teamID, 8)])
+				fort = def(teamData.fort, "Castle")
+				voice = def(teamData.voice, "Default")
+				flag = def(teamData.flag, defaultFlags[math.min(teamID, 8)])
+
+				realName = AddTeam(name, -(clanID+1), grave, fort, voice, flag)
+			end
 
-			AddTeam(name, -(clanID+1), grave, fort, voice, flag)
+			-- Update all teamDefeat goals if the real team name differs from the
+			-- team configuration.
+			-- (AddTeam might change the name due to naming collisions)
+			if name ~= realName then
+				local checks = { params.customGoals, params.customNonGoals }
+				for c=1, 2 do
+					if checks[c] then
+						for k,goal in pairs(checks[c]) do
+							if goal.type == "teamDefeat" and goal.teamName == name then
+								goal.teamName = realName
+							end
+						end
+					end
+				end
+			end
 
 			for hogID, hogData in pairs(teamData.hogs) do
 				local name, botLevel, health, hat
@@ -669,7 +695,12 @@
 				botLevel = def(hogData.botLevel, 0)
 				health = def(hogData.health, 100)
 				hat = def(hogData.hat, "NoHat")
-				local hog = AddHog(name, botLevel, health, hat)
+				local hog
+				if teamData.isMissionTeam then
+					hog = AddMissionHog(health)
+				else
+					hog = AddHog(name, botLevel, health, hat)
+				end
 				if hogData.x ~= nil and hogData.y ~= nil then
 					SetGearPosition(hog, hogData.x, hogData.y)
 				end
--- a/share/hedgewars/Data/Scripts/SpeedShoppa.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Scripts/SpeedShoppa.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -45,11 +45,6 @@
 
 	optional fields:
 	- missionTitle:		the name of the mission (optional but highly recommended) (default: "Speed Shoppa")
-	- hogHat:		hat of the hedgehog (default: "NoHat")
-	- hogName:		name of the hedgehog (default: "Roper")
-	- teamName:		name of the hedgehog’s team (default: "Shoppers")
-	- teamGrave:		name of the hedgehog’s grave (default: "Statue")
-	- teamFlag:		name of the team’s flag (default: "cm_shoppa")
 	- clanColor:		color of the (only) clan (default: -1, default first clan color)
 	- goalText:		A short string explaining the goal of the mission
 				(default: "Use your rope to collect all crates as fast as possible.")
@@ -74,14 +69,9 @@
 local crates
 
 function SpeedShoppaMission(params)
-	if params.hogHat == nil then params.hogHat = "NoHat" end
-	if params.hogName == nil then params.hogName = loc("Roper") end
-	if params.teamName == nil then params.teamName = loc("Shoppers") end
 	if params.goalText == nil then params.goalText = loc("Use your rope to collect all crates as fast as possible.") end
 	if params.missionTitle == nil then params.missionTitle = loc("Speed Shoppa") end
 	if params.clanColor == nil then params.clanColor = -1 end
-	if params.teamGrave == nil then params.teamGrave = "Statue" end
-	if params.teamFlag == nil then params.teamFlag = "cm_shoppa" end
 	if params.extra_onGameInit == nil then params.extra_onGameInit = function() end end
 	if params.extra_onGameStart == nil then params.extra_onGameStart = function() end end
 	if params.faceLeft == nil then params.faceLeft = false end
@@ -101,8 +91,8 @@
 		WaterRise = 0
 		HealthDecrease = 0
 	
-		AddTeam(params.teamName, params.clanColor, params.teamGrave, "Castle", "Default", params.teamFlag)
-		playerHog = AddHog(params.hogName, 0, 1, params.hogHat)
+		AddMissionTeam(params.clanColor)
+		playerHog = AddMissionHog(1)
 		HogTurnLeft(playerHog, params.faceLeft)
 		
 		SetGearPosition(playerHog, params.hog_x, params.hog_y)
@@ -119,7 +109,7 @@
 		local append = getReadableChallengeRecord("TimeRecord")
 		ShowMission(params.missionTitle, loc("Challenge"), params.goalText .. "|" .. append, -amRope, 5000)
 		-- <crates collected>/<total number of crates>
-		SetTeamLabel(params.teamName, string.format(loc("%d/%d"), cratesCollected, #crates))
+		SetTeamLabel(GetHogTeamName(playerHog), string.format(loc("%d/%d"), cratesCollected, #crates))
 		for i=1,#crates do
 			spawnCrate(crates[i].x, crates[i].y)
 		end
@@ -134,7 +124,7 @@
 		if GetGearType(gear) == gtCase and not hogHurt and not timeOut then
 			cratesCollected = cratesCollected + 1
 			-- <crates collected>/<total number of crates>
-			SetTeamLabel(params.teamName, string.format(loc("%d/%d"), cratesCollected, #crates))
+			SetTeamLabel(GetHogTeamName(playerHog), string.format(loc("%d/%d"), cratesCollected, #crates))
 			PlaySound(sndShotgunReload)
 			if cratesCollected == #crates then
 				endTime = TurnTimeLeft
@@ -175,14 +165,14 @@
 				SendStat(siGameResult, loc("Challenge completed!"))
 				SendStat(siPointType, loc("milliseconds"))
 				local time = startTime - endTime
-				SendStat(siPlayerKills, tostring(time), params.teamName)
+				SendStat(siPlayerKills, tostring(time), GetHogTeamName(playerHog))
 				SendStat(siCustomAchievement, string.format(loc("You have finished the challenge in %.3f s."), (time/1000)))
 				SetTurnTimeLeft(0)
 				updateChallengeRecord("TimeRecord", time)
 			else
 				SendStat(siGameResult, loc("Challenge failed!"))
 				SendStat(siPointType, loc("crate(s)"))
-				SendStat(siPlayerKills, tostring(cratesCollected), params.teamName)
+				SendStat(siPlayerKills, tostring(cratesCollected), GetHogTeamName(playerHog))
 				SendStat(siCustomAchievement, string.format(loc("You have collected %d out of %d crate(s)."), cratesCollected, #crates))
 			end
 			gameEnded = true
--- a/share/hedgewars/Data/Scripts/TargetPractice.lua	Wed Dec 19 19:00:29 2018 -0500
+++ b/share/hedgewars/Data/Scripts/TargetPractice.lua	Fri Dec 21 16:55:34 2018 +0100
@@ -43,10 +43,6 @@
 	wind = ,
 	solidLand = ,
 	artillery = ,
-	hogHat = ,
-	hogName = ,
-	teamName = ,
-	teamGrave = ,
 	clanColor = ,
 	goalText = ,
 	shootText =
@@ -96,11 +92,6 @@
 	- wind:		the initial wind (-100 to 100) (default: 0 (no wind))
 	- solidLand:	weather the terrain is indestructible (default: false)
 	- artillery:	if true, the hog can’t move (default: false)
-	- hogHat:	hat of the hedgehog (default: "NoHat")
-	- hogName:	name of the hedgehog (default: "Trainee")
-	- teamName:	name of the hedgehog’s team (default: "Training Team")
-	- teamGrave:	name of the hedgehog’s grave
-	- teamFlag:	name of the team’s flag (default: "cm_crosshair")
 	- secGearType:	cluster of projectile gear (if present) (used to re-center camera)
 	- clanColor:	color of the (only) clan (default: -1, default first clan color)
 	- goalText:	A short string explaining the goal of the mission
@@ -115,14 +106,9 @@
 end
 
 function TargetPracticeMission(params)
-	if params.hogHat == nil then params.hogHat = "NoHat" end
-	if params.hogName == nil then params.hogName = loc("Trainee") end
-	if params.teamName == nil then params.teamName = loc("Training Team") end
 	if params.goalText == nil then params.goalText = loc("Eliminate all targets before your time runs out.|You have unlimited ammo for this mission.") end
 	if params.shootText == nil then params.shootText = loc("You have shot %d times.") end
 	if params.clanColor == nil then params.clanColor = -1 end
-	if params.teamGrave == nil then params.teamGrave= "Statue" end
-	if params.teamFlag == nil then params.teamFlag = "cm_crosshair" end
 	if params.wind == nil then params.wind = 0 end
 
 	local solid, artillery
@@ -160,9 +146,9 @@
 
 		SetWind(params.wind)
 
-		AddTeam(loc(params.teamName), params.clanColor, params.teamGrave, "Flowerhog", "Default", params.teamFlag)
+		AddMissionTeam(params.clanColor)
 
-		player = AddHog(loc(params.hogName), 0, 1, params.hogHat)
+		player = AddMissionHog(1)
 		SetGearPosition(player, params.hog_x, params.hog_y)
 	end
 
@@ -170,7 +156,7 @@
 		SendHealthStatsOff()
 		local recordInfo = getReadableChallengeRecord("Highscore")
 		ShowMission(params.missionTitle, loc("Aiming practice"), params.goalText .. "|" .. recordInfo, -params.ammoType, 5000)
-		SetTeamLabel(params.teamName, "0")
+		SetTeamLabel(GetHogTeamName(player), "0")
 		spawnTarget()
 	end
 
@@ -240,7 +226,7 @@
 	_G.onGearDamage = function(gear, damage)
 		if GetGearType(gear) == gtTarget then
 			scored = scored + 1
-			SetTeamLabel(params.teamName, tostring(getTargetsScore()))
+			SetTeamLabel(GetHogTeamName(player), tostring(getTargetsScore()))
 			if scored < total_targets then
 				AddCaption(string.format(loc("Targets left: %d"), (total_targets-scored)), capcolDefault, capgrpMessage)
 				spawnTarget()
@@ -299,7 +285,7 @@
 			local end_score_time = math.ceil(time_goal/(params.time/6000))
 			local end_score_accuracy = math.ceil(accuracy * 60)
 			end_score_overall = end_score_time + end_score_targets + end_score_accuracy
-			SetTeamLabel(params.teamName, tostring(end_score_overall))
+			SetTeamLabel(GetHogTeamName(player), tostring(end_score_overall))
 
 			SendStat(siGameResult, loc("You have finished the target practice!"))
 
@@ -318,7 +304,7 @@
 			end_score_overall = end_score_targets
 		end
 		SendStat(siPointType, loc("point(s)"))
-		SendStat(siPlayerKills, tostring(end_score_overall), loc(params.teamName))
+		SendStat(siPlayerKills, tostring(end_score_overall), GetHogTeamName(player))
 		-- Update highscore
 		updateChallengeRecord("Highscore", end_score_overall)
 	end