1
0
forked from 0ad/0ad

Internationalized the messages of the tutorial AI

This was SVN commit r14991.
This commit is contained in:
Adrián Chaves 2014-04-25 03:41:01 +00:00
parent abed1b1734
commit 7afe0afbca
5 changed files with 98 additions and 90 deletions

View File

@ -38,8 +38,11 @@ function handleNotifications()
notification.type = "text";
// Handle chat notifications specially
if (notification.type == "chat")
if (notification.type == "chat" ||
notification.type == "aichat")
{
if (notification.type == "aichat")
notification.message = translate(notification.message);
var guid = findGuidForPlayerID(g_PlayerAssignments, notification.player);
if (guid == undefined)
{
@ -270,6 +273,10 @@ function handleNetMessage(message)
addChatMessage({ "type": "message", "guid": message.guid, "text": message.text });
break;
case "aichat":
addChatMessage({ "type": "message", "guid": message.guid, "text": translate(message.text) });
break;
// To prevent errors, ignore these message types that occur during autostart
case "gamesetup":
case "start":

View File

@ -89,15 +89,15 @@ m.BaseAI.prototype.OnUpdate = function()
m.BaseAI.prototype.chat = function(message)
{
Engine.PostCommand(PlayerID,{"type": "chat", "message": message});
Engine.PostCommand(PlayerID,{"type": "aichat", "message": message});
};
m.BaseAI.prototype.chatTeam = function(message)
{
Engine.PostCommand(PlayerID,{"type": "chat", "message": "/team " +message});
Engine.PostCommand(PlayerID,{"type": "aichat", "message": "/team " +message});
};
m.BaseAI.prototype.chatEnemies = function(message)
{
Engine.PostCommand(PlayerID,{"type": "chat", "message": "/enemy " +message});
Engine.PostCommand(PlayerID,{"type": "aichat", "message": "/enemy " +message});
};
return m;

View File

@ -1,280 +1,280 @@
var economic_walkthrough = [
{
"instructions": "Warning: This is an advanced tutorial and goes quite fast. If you don't keep up just restart and try again. Practise makes perfect!",
"instructions": markForTranslation("Warning: This is an advanced tutorial and goes quite fast. If you don't keep up just restart and try again. Practise makes perfect!"),
},
{
"trigger": "time",
"time": 0,
"instructions": "Lets get started, first train a batch (shift click) of 5 female citizens from the CC (Civil Center)."
"instructions": markForTranslation("Lets get started, first train a batch (shift click) of 5 female citizens from the CC (Civil Center).")
},
{
"trigger": "time",
"time": 5,
"instructions": "Now, assign your female citizens to gather berries, your cavalryman to hunt the chickens and the citizen soldiers to gather wood."
"instructions": markForTranslation("Now, assign your female citizens to gather berries, your cavalryman to hunt the chickens and the citizen soldiers to gather wood.")
},
{
"trigger": "time",
"time": 15,
"instructions": "Now set the rally point of your civil center on the berries"
"instructions": markForTranslation("Now set the rally point of your civil center on the berries.")
},
{
"trigger": "time",
"time": 23,
"instructions": "Queue some slingers to train after the female citizens, you won't have enough resources for a batch."
"instructions": markForTranslation("Queue some slingers to train after the female citizens, you won't have enough resources for a batch.")
},
{
"trigger": "time",
"time": 30,
"instructions": "When your female citizens have finished training, use 4 to build a house nearby."
"instructions": markForTranslation("When your female citizens have finished training, use 4 to build a house nearby.")
},
{
"trigger": "time",
"time": 38,
"instructions": "Set the CC's rally point on the nearby trees, queue more slingers, you want to train 6 right now."
"instructions": markForTranslation("Set the CC's rally point on the nearby trees, queue more slingers, you want to train 6 right now.")
},
{
"trigger": "time",
"time": 70,
"instructions": "Queue a batch of 5 female citizens."
"instructions": markForTranslation("Queue a batch of 5 female citizens.")
},
{
"trigger": "time",
"time": 75,
"instructions": "Use shift-click to queue another house for the 4 builders."
"instructions": markForTranslation("Use shift-click to queue another house for the 4 builders.")
},
{
"trigger": "time",
"time": 85,
"instructions": "Set the rally point back to the berries once all of the citizen soldiers have finished training."
"instructions": markForTranslation("Set the rally point back to the berries once all of the citizen soldiers have finished training.")
},
{
"trigger": "time",
"time": 95,
"instructions": "Send one citizen soldier to gather stone, send 2 others to build a storehouse near the southern trees."
"instructions": markForTranslation("Send one citizen soldier to gather stone, send 2 others to build a storehouse near the southern trees.")
},
{
"trigger": "time",
"time": 100,
"instructions": "Queue another 5 female citizens."
"instructions": markForTranslation("Queue another 5 female citizens.")
},
{
"trigger": "time",
"time": 107,
"instructions": "Use a female citizen to construct a field next to your CC."
"instructions": markForTranslation("Use a female citizen to construct a field next to your CC.")
},
{
"trigger": "time",
"time": 110,
"instructions": "Your cavalryman has probably run out of chickens by now, there are some goats to the left of your base."
"instructions": markForTranslation("Your cavalryman has probably run out of chickens by now, there are some goats to the left of your base.")
},
{
"trigger": "time",
"time": 115,
"instructions": "Use 2-3 more female citizens to contruct the field"
"instructions": markForTranslation("Use 2-3 more female citizens to contruct the field.")
},
{
"trigger": "time",
"time": 130,
"instructions": "Queue another 5 female citizens"
"instructions": markForTranslation("Queue another 5 female citizens.")
},
{
"trigger": "time",
"time": 135,
"instructions": "Queue another house."
"instructions": markForTranslation("Queue another house.")
},
{
"trigger": "time",
"time": 145,
"instructions": "The berry bushes are getting crowded, send some female citizens to work the field, set the rally point there."
"instructions": markForTranslation("The berry bushes are getting crowded, send some female citizens to work the field, set the rally point there.")
},
{
"trigger": "time",
"time": 160,
"instructions": "Queue another 5 female citizens, these should gather stone"
"instructions": markForTranslation("Queue another 5 female citizens, these should gather stone.")
},
{
"trigger": "time",
"time": 170,
"instructions": "Move your woodcutters to the trees near the storehouse so they dont have to walk as far."
"instructions": markForTranslation("Move your woodcutters to the trees near the storehouse so they dont have to walk as far.")
},
{
"trigger": "time",
"time": 175,
"instructions": "Make sure the workers from the berry bushes are used to gather from the field rather than standing idle when they run out."
"instructions": markForTranslation("Make sure the workers from the berry bushes are used to gather from the field rather than standing idle when they run out.")
},
{
"trigger": "time",
"time": 190,
"instructions": "Queue another house to be built."
"instructions": markForTranslation("Queue another house to be built.")
},
{
"trigger": "time",
"time": 195,
"instructions": "Queue 5 more female citizens. These will gather wood"
"instructions": markForTranslation("Queue 5 more female citizens. These will gather wood.")
},
{
"trigger": "time",
"time": 220,
"instructions": "Build another field, this decreases the amount of walking for your female citizens."
"instructions": markForTranslation("Build another field, this decreases the amount of walking for your female citizens.")
},
{
"trigger": "time",
"time": 220,
"instructions": "Train some more slingers, send them to gather stone. train about 5, you may not have enough resources for a batch right now."
"instructions": markForTranslation("Train some more slingers, send them to gather stone. Train about 5, you may not have enough resources for a batch right now.")
},
{
"trigger": "time",
"time": 231,
"instructions": "Queue another house"
"instructions": markForTranslation("Queue another house.")
},
{
"trigger": "time",
"time": 260,
"instructions": "Queue another batch of 5 female citizens these are for wood. "
"instructions": markForTranslation("Queue another batch of 5 female citizens these are for wood.")
},
{
"trigger": "time",
"time": 285,
"instructions": "Queue another house"
"instructions": markForTranslation("Queue another house.")
},
{
"trigger": "time",
"time": 290,
"instructions": "Queue a batch of spearmen"
"instructions": markForTranslation("Queue a batch of spearmen.")
},
{
"trigger": "time",
"time": 295,
"instructions": "Research the stone mining technology from the storehouse."
"instructions": markForTranslation("Research the stone mining technology from the storehouse.")
},
{
"trigger": "time",
"time": 300,
"instructions": "Queue a batch of slingers"
"instructions": markForTranslation("Queue a batch of slingers.")
},
{
"trigger": "time",
"time": 310,
"instructions": "Move 3 women from wood and 3 from stone to farming. Women are cheap to train initially but later in the game it is best to maxinmize efficiency as you are able to train more citizen soldiers."
"instructions": markForTranslation("Move 3 women from wood and 3 from stone to farming. Women are cheap to train initially but later in the game it is best to maxinmize efficiency as you are able to train more citizen soldiers.")
},
{
"trigger": "time",
"time": 325,
"instructions": "Queue another house"
"instructions": markForTranslation("Queue another house.")
},
{
"trigger": "time",
"time": 330,
"instructions": "The slingers that you queue earlier should gather stone once they are trained."
"instructions": markForTranslation("The slingers that you queue earlier should gather stone once they are trained.")
},
{
"trigger": "time",
"time": 340,
"instructions": "Queue a batch of spearmen, they should gather wood."
"instructions": markForTranslation("Queue a batch of spearmen, they should gather wood.")
},
{
"trigger": "time",
"time": 360,
"instructions": "Next queue a batch of slingers"
"instructions": markForTranslation("Next queue a batch of slingers.")
},
{
"trigger": "time",
"time": 390,
"instructions": "Send some of the stone miners to mine metal, getting ready for the next age."
"instructions": markForTranslation("Send some of the stone miners to mine metal, getting ready for the next age.")
},
{
"trigger": "time",
"time": 400,
"instructions": "Queue another house"
"instructions": markForTranslation("Queue another house.")
},
{
"trigger": "time",
"time": 410,
"instructions": "Start researching Phase 2"
"instructions": markForTranslation("Start researching Phase 2.")
},
{
"trigger": "time",
"time": 430,
"instructions": "Queue some slingers"
"instructions": markForTranslation("Queue some slingers.")
},
{
"trigger": "time",
"time": 435,
"instructions": "Your fields may start getting exhausted, remember to rebuild them."
"instructions": markForTranslation("Your fields may start getting exhausted, remember to rebuild them.")
},
{
"trigger": "time",
"time": 440,
"instructions": "When you have advanced, use a single citizen soldier to place a barracks foundation. Then use the rest of the non food or house building female citizens to construct it."
"instructions": markForTranslation("When you have advanced, use a single citizen soldier to place a barracks foundation. Then use the rest of the non food or house building female citizens to construct it.")
},
{
"trigger": "time",
"time": 458,
"instructions": "Queue 5 more females for construction work."
"instructions": markForTranslation("Queue 5 more females for construction work.")
},
{
"trigger": "time",
"time": 480,
"instructions": "Queue a batch of slingers to gather the trees on the north side of your base."
"instructions": markForTranslation("Queue a batch of slingers to gather the trees on the north side of your base.")
},
{
"trigger": "time",
"time": 490,
"instructions": "This is the end of the walkthrough. This should give you a good idea of how to build up a nice economy rapidly."
"instructions": markForTranslation("This is the end of the walkthrough. This should give you a good idea of how to build up a nice economy rapidly.")
},
{
"trigger": "time",
"time": 500,
"instructions": "At this point you should be able to fully use both training facilities, keep putting units into economic work, to keep growing faster and faster."
"instructions": markForTranslation("At this point you should be able to fully use both training facilities, keep putting units into economic work, to keep growing faster and faster.")
},
{
"trigger": "time",
"time": 505,
"instructions": "From this point you have a good base to build an army and wipe out the opposition."
"instructions": markForTranslation("From this point you have a good base to build an army and wipe out the opposition.")
},
{
"trigger": "time",
"time": 510,
"instructions": "The key points to remember are: "
"instructions": markForTranslation("The key points to remember are:")
},
{
"trigger": "time",
"time": 513,
"instructions": " - Don't have any idle units. Shift click queueing and rally points are very useful."
"instructions": markForTranslation(" - Don't have any idle units. Shift click queueing and rally points are very useful.")
},
{
"trigger": "time",
"time": 516,
"instructions": " - Use all of your resources, stockpiled resources are waste, having too much of a resource is waste."
"instructions": markForTranslation(" - Use all of your resources, stockpiled resources are waste, having too much of a resource is waste.")
},
{
"trigger": "time",
"time": 519,
"instructions": " - Use the right units for the right task, female citizens gather food, cavalry hunt, citizen soldiers do the rest."
"instructions": markForTranslation(" - Use the right units for the right task, female citizens gather food, cavalry hunt, citizen soldiers do the rest.")
},
{
"trigger": "time",
"time": 522,
"instructions": " - Don't be afraid to swap units from one resource to another, see point 2. Make sure they deposit what they are carrying first though."
"instructions": markForTranslation(" - Don't be afraid to swap units from one resource to another, see point 2. Make sure they deposit what they are carrying first though.")
},
{
"trigger": "time",
"time": 525,
"instructions": " - Build enough houses, your CC should be kept busy as much as possible, it is the only training building until town phase."
"instructions": markForTranslation(" - Build enough houses, your CC should be kept busy as much as possible, it is the only training building until town phase.")
},
{
"trigger": "time",
"time": 528,
"instructions": " - Female citizens are cheap, so you can build more of them and gather more resources."
"instructions": markForTranslation(" - Female citizens are cheap, so you can build more of them and gather more resources.")
},
{
"trigger": "time",
"time": 531,
"instructions": " - Don't get carried away on the last point or you will get raided and have no defence."
"instructions": markForTranslation(" - Don't get carried away on the last point or you will get raided and have no defence.")
},
{
"trigger": "time",
"time": 538,
"instructions": "Each map is different, so you will need to play slightly differently on each. This should give an outline for a high resource map."
"instructions": markForTranslation("Each map is different, so you will need to play slightly differently on each. This should give an outline for a high resource map.")
},
]

View File

@ -1,123 +1,123 @@
var introductoryTutorial = [
//Tutorial starts with a Civil Centre, 3 female citizens, and 1 skirmisher. The civ is Sparta. 2 AI players - One for attacking, one for base defending(?).
{
"instructions": "Welcome to the 0 A.D. tutorial. First left-click on a female citizen, then Right-click on a berry bush nearby to make the unit collect food. Female citizens gather food faster than other units."
"instructions": markForTranslation("Welcome to the 0 A.D. tutorial. First left-click on a female citizen, then Right-click on a berry bush nearby to make the unit collect food. Female citizens gather food faster than other units.")
},
{
"instructions": "Select the citizen-soldier, Right-click on a tree near the Civil Center to begin collecting wood. Citizen-soldiers gather wood faster than female citizens.",
"instructions": markForTranslation("Select the citizen-soldier, Right-click on a tree near the Civil Center to begin collecting wood. Citizen-soldiers gather wood faster than female citizens."),
"trigger": "food_gathered"
},
{
"instructions": "Select the Civil Center building, and shift-click on the Hoplite icon (2nd in the row) once to begin training 5 Hoplites.",
"instructions": markForTranslation("Select the Civil Center building, and shift-click on the Hoplite icon (2nd in the row) once to begin training 5 Hoplites."),
"trigger": "wood_gathered"
},
{
"instructions": "Select the two idle female citizens and build a house nearby by selecting the house icon. Place the house by left-clicking on a piece of land.",
"instructions": markForTranslation("Select the two idle female citizens and build a house nearby by selecting the house icon. Place the house by left-clicking on a piece of land."),
"trigger": "training_start",
"template": "units/spart_infantry_spearman_b",
"count": 5
},
{
"instructions": "Select the newly trained Hoplites and assign them to build a storehouse beside some nearby trees. They will begin to gather wood when it's constructed.",
"instructions": markForTranslation("Select the newly trained Hoplites and assign them to build a storehouse beside some nearby trees. They will begin to gather wood when it's constructed."),
"trigger": "entity_count",
"template": "structures/spart_house",
"count": 1
},
{
"instructions": "Build a set of 5 skirmishers by shift-clicking on the skirmisher icon (3rd in the row) in the Civil Center.",
"instructions": markForTranslation("Build a set of 5 skirmishers by shift-clicking on the skirmisher icon (3rd in the row) in the Civil Center."),
"trigger": "entity_count",
"template": "structures/spart_storehouse",
"count": 1
},
{
"instructions": "Build a farmstead in an open space beside the Civil Center using any idle builders.",
"instructions": markForTranslation("Build a farmstead in an open space beside the Civil Center using any idle builders."),
"trigger": "training_start",
"template": "units/spart_infantry_javelinist_b",
"count": 5
},
{
"instructions": "Once the farmstead is constructed, its builders will automatically begin gathering food if there is any nearby. Select the builders and instead make them construct a field beside the farmstead.",
"instructions": markForTranslation("Once the farmstead is constructed, its builders will automatically begin gathering food if there is any nearby. Select the builders and instead make them construct a field beside the farmstead."),
"trigger": "entity_count",
"template": "structures/spart_farmstead",
"count": 1
},
{
"instructions": "The field's builders will now automatically begin collecting food from the field. Using the newly created group of skirmishers, get them to build another house nearby.",
"instructions": markForTranslation("The field's builders will now automatically begin collecting food from the field. Using the newly created group of skirmishers, get them to build another house nearby."),
"trigger": "entity_count",
"template": "structures/spart_field",
"count": 1
},
{
"instructions": "Train 5 Hoplites from the Civil Center. Select the Civil Center and with it selected right click on a tree nearby. Units from the Civil Center will now automatically gather wood.",
"instructions": markForTranslation("Train 5 Hoplites from the Civil Center. Select the Civil Center and with it selected right click on a tree nearby. Units from the Civil Center will now automatically gather wood."),
"trigger": "entity_count",
"template": "structures/spart_house",
"count": 2
},
{
"instructions": "Order the idle Skirmishers to build an outpost to the north east at the edge of your territory. This will be the fifth Village Phase structure that you have built, allowing you to advance to the Town Phase.",
"instructions": markForTranslation("Order the idle Skirmishers to build an outpost to the north east at the edge of your territory. This will be the fifth Village Phase structure that you have built, allowing you to advance to the Town Phase."),
"trigger": "entity_count",
"template": "units/spart_infantry_spearman_b",
"count": 10
},
{
"instructions": "Select the Civil Center again and advance to Town Phase by clicking on the 'II' icon. This will allow Town Phase buildings to be constructed.",
"instructions": markForTranslation("Select the Civil Center again and advance to Town Phase by clicking on the 'II' icon. This will allow Town Phase buildings to be constructed."),
"trigger": "entity_count",
"template": "structures/spart_outpost",
"count": 1
},
{
"instructions": "Start building 5 female citizens in the Civil Center and set its rally point to the farm (right click on it)",
"instructions": markForTranslation("Start building 5 female citizens in the Civil Center and set its rally point to the farm (right click on it)."),
"trigger": "relative_time",
"time": 34 //TODO: This is a hack, should be when town phase is researched
},
{
"instructions": "Build a barracks nearby. Whenever your population limit is reached, build an extra house using any available builder units.",
"instructions": markForTranslation("Build a barracks nearby. Whenever your population limit is reached, build an extra house using any available builder units."),
"trigger": "entity_count",
"template": "units/spart_support_female_citizen",
"count": 8
},
{
"instructions": "Prepare for an attack by an enemy player. Build more soldiers using the Barracks, and get idle soldiers to build a Defense Tower near your Outpost.",
"instructions": markForTranslation("Prepare for an attack by an enemy player. Build more soldiers using the Barracks, and get idle soldiers to build a Defense Tower near your Outpost."),
"trigger": "entity_count",
"template": "structures/spart_barracks",
"count": 1
},
{
"instructions": "Select the Barracks and research the Infantry Training technology (sword icon) to improve infantry hack attack",
"instructions": markForTranslation("Select the Barracks and research the Infantry Training technology (sword icon) to improve infantry hack attack."),
"action": introductory_tutorial_attack,
"trigger": "entity_count",
"template": "structures/spart_defense_tower",
"count": 1
},
{
"instructions": "The enemy's attack has been defeated. Now build a market and temple while assigning new units to gather any required resources.",
"instructions": markForTranslation("The enemy's attack has been defeated. Now build a market and temple while assigning new units to gather any required resources."),
"trigger": "dead_enemy_units",
"collectionId": "intro_tutorial_attackers"
},
{
"instructions": "Now that City Phase requirements have been reached, select your Civil Center and advance to City Phase.",
"instructions": markForTranslation("Now that City Phase requirements have been reached, select your Civil Center and advance to City Phase."),
"trigger": "entity_counts",
"templates": ["structures/spart_market", "structures/spart_temple"],
"counts": [1,1]
},
{
"instructions": "Now that you are in City Phase, build a fortress nearby and use it to build 2 Battering Rams",
"instructions": markForTranslation("Now that you are in City Phase, build a fortress nearby and use it to build 2 Battering Rams."),
"trigger": "relative_time",
"time": 65 //TODO: This is a hack, should be when city phase is researched
},
{
"instructions": "Stop all your soldiers gathering resources and instead task small groups to find the enemy Civil Center on the map. Female citizens should continue to gather resources.",
"instructions": markForTranslation("Stop all your soldiers gathering resources and instead task small groups to find the enemy Civil Center on the map. Female citizens should continue to gather resources."),
"action": introductory_tutorial_remove_champions,
"trigger": "entity_count",
"template": "units/spart_mechanical_siege_ram",
"count": 2
},
{
"instructions": "The enemy's base has been spotted, send your siege weapons and all remaining soldiers to destroy it.",
"instructions": markForTranslation("The enemy's base has been spotted, send your siege weapons and all remaining soldiers to destroy it."),
"trigger": "near_cc"
},
{
"instructions": "The enemy has been defeated. All tutorial tasks are now completed...",
"instructions": markForTranslation("The enemy has been defeated. All tutorial tasks are now completed…"),
"trigger": "dead_enemy_units",
"collectionId": "intro_tutorial_cc"
}
@ -125,15 +125,15 @@ var introductoryTutorial = [
var introductory_tutorial_attack = function(gameState) {
var units = gameState.updatingCollection(
"intro_tutorial_attackers",
"intro_tutorial_attackers",
API3.Filters.or(
API3.Filters.byType("units/athen_infantry_spearman_b"),
API3.Filters.byType("units/athen_infantry_spearman_b"),
API3.Filters.byType("units/athen_infantry_javelinist_b")
),
gameState.getOwnEntities()
);
var towers = gameState.updatingCollection(
"players_towers",
"players_towers",
API3.Filters.byType("structures/spart_defense_tower"),
gameState.getEnemyEntities()
);
@ -143,18 +143,18 @@ var introductory_tutorial_attack = function(gameState) {
var introductory_tutorial_remove_champions = function(gameState) {
var units = gameState.updatingCollection(
"intro_tutorial_champions",
"intro_tutorial_champions",
API3.Filters.or(
API3.Filters.byType("units/athen_champion_infantry"),
API3.Filters.byType("units/athen_champion_infantry"),
API3.Filters.or(
API3.Filters.byType("units/athen_champion_marine"),
API3.Filters.byType("units/athen_champion_marine"),
API3.Filters.byType("units/athen_champion_ranged")
)
),
gameState.getOwnEntities()
);
var cc = gameState.updatingCollection(
"intro_tutorial_cc",
"intro_tutorial_cc",
API3.Filters.byType("structures/athen_civil_centre"),
gameState.getOwnEntities()
);

View File

@ -38,8 +38,9 @@ function ProcessCommand(player, cmd)
break;
case "chat":
case "aichat":
var cmpGuiInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
cmpGuiInterface.PushNotification({"type": "chat", "player": player, "message": cmd.message});
cmpGuiInterface.PushNotification({"type": cmd.type, "player": player, "message": cmd.message});
break;
case "cheat":