How to enter triggers in map editor?

I started playing AoE after a long time, and now I'm creating a custom map.I want to specify the conditions for victory in my own way.

I don't know how exactly to create custom objectives,but I noticed this feature called "AI scripts".I've heard that games are created using AI,but no idea how to write one here. I want to learn how to use this feature, I may use it in many custom maps.

EDIT: The original question was on AI scripts to achieve making custom objectives, but Lyrical in the comments below clarified that its not AI scripting, but adding "triggers" which would help me here. I think that comment should be considered as correct answer unless someone wants to put a better answer.


Solution 1:

It sounds like you want to make a trigger that declares victory for a certain player. To do this, you need to go to the "Triggers" section in the map editor. Here you can set lots of triggers which are mainly used for scenarios. Each trigger has one or more conditions and one or more effects. For the effects to actually happen, all of the conditions must be met. If you want to make custom victory conditions, you need to make what you want to happen in individual "conditions". You then need to make an effect labelled "Declare Victory". You then set the player to who you want to win, when the conditions are met.

Example: You want player 1 to win the game when they kill a certain unit. You need to do the following steps:

  1. Open the Scenario Editor from the Main Menu.
  2. Go to the triggers menu. Click "New" under the triggers box. (Note: you can change properties of the trigger here, such as the name of the trigger and whether it loops or not.)
  3. Click "New Cond" to make a new condition. Set the condition to "Destroy Object". Click "Select Object" and then select the object you want to need to be killed. (Note: by clicking "View Object", you can check if you have selected the right guy.
  4. Click "New Effect" to make a new effect. Set it to "Declare Victory". Set the player to "Player 1".

You're done! Of course, if you want the victory conditions to be different, just change what the condition/s are set to. Most of them are pretty self explanatory, and easy to use. Almost everything I know about the editor I found out myself. It's not too hard to use, but browsing some wikis may help.

Solution 2:

There is a file on the installation CD, at \DOCS\CPSB.DOC. It is the official guide and the best documentation I know of. If you want a better guide, you should look at The World of AI Scripting: Chapter 1 and Scripting AI for: Age of Empires II.