Modding Guides

Tutorial for Making a Single Player Level

Written by: cloudsoffire

Index

Where & How to start

Creating Ideas 

At the very first do not ever forget that making levels will take long time.

Now where should i start?

This is a question that you are going to answer. According to your skills of computer usage and populous playing, this changes. But it is obvious that starting with the “main idea of your map” is the best way. Make a cup coffee yourself (don’t blame me if you don’t like coffee) and sit down on your computer chair. Now here it goes:

What is a main idea of a map?

Well the main idea of a map is what you want the player to think when playing the level. Will it be a legendary fight between 4 tribes?or a solo shaman play with uberquests? may it be a deathmatch between two tribes? I think you got the idea…

The important part in here is to decide in the borders of “what can be done with these tools i have“. For example you cannot make a”shaman eats trees and gets bigger and bigger and then creates a new world herself and becomes a god”…No this is nothing.

As you can guess you’re limited to create a map which contains only Pop the beginning script languages and world restrictions.However this does not prevent you to create a wonderful campaign set because bullfrog has many script and world features that never been used

Another part of creating a map idea is calculating your time…

Think about a map and think about approx. how much time will it take…(you’ll be available to do this when you finish the tutorial) Note this time down and split it up to hours in a daytime…maybe even to days in a week.

At first you will be confused even if you obviously know your idea. Because the more you get into the editor, the more possibilities come to your mind. This is normal. Getting a little out of your beginning idea is not a big bad thing. In fact it is good. Just try not to leave the borders too much behind

As final words, create an idea, implement it to populous in your mind, see the visions of the level and calculate your time

Now you have a work program and lots of things to create.

ALACN’s World Editor Introduction

AT THE VERY FIRST: USE GRID!!

ALACN (god bless him) has created a great 3d world editor for populous: the beginning. In this tutorial we’re going to use that program to create levels.

-The Menu Bar
Contains submenus: File, Edit, Options,

-The File Menu
-New,
-Open,
-Save,
-Save as,
-Export Height Map: Exports the minimap as a BMP.
-Exit

-The Edit Menu
-Landscape: Brings the landscape edit brush
-Objects: Brings a window to deal with object editing
-Markers: Brings a little windows to move markers

-Header,
-Available Spells/Buildings: Brings a windows to edit spells and buildings that can be used in the level
-Spells Not Charging: Brings a windows to edit spells that do not start to charge at the beginning of the level
-Allies: Brings a windows to edit who is allied with who
-General: Brings a windows to edit level name, which cpscr00** file will be used for the computer,fog of war, god mode and guest spells
-Object Bank: Brings a windows to decide which object bank will be used in the level
-Map Texture: Brings a windows to decide which landscape texture and sky will be used in the level

-AI Script,
-Attributes: As we’ll use scripting this part is useless to us. You’d better don’t mess this up.
-Script: Shows a window to allow you compile your written scripts and decompile scripts from their dat files to plain text.

-Language File: As it says in the menu it converts between text and lang** file.

-Swap Tribe: this swaps the selected tribes objects with the other one.

-The Options Menu
-Object List: Brings the Objects put in the map.
-Brush: Brings a window to customise your landscape brush
-Info: Brings a detailed info of your map
-Hide Objects: As it says…
-Bounding Box: Shows a wire-frame box around objects
-Show Markers: if you ask me what is this i kill a cat
The other remaining: Decide how would you like to view your map.

Now we know how to use the editor in basic way…here are some info you should know too:

-Hold shift to repeat object adding
-Use shortcuts given (this nearly saves half of the time you’ll spend in other way)
-DO smooth your lands
-Use 1 for brush size and 5 for speed and just mess (dip) around to create shores and escape “square mountains”
-Do not put objects too near the shaman
-Put a marker near or on every trigger you put. Even if you don’t use, it will help you to define locations for flybys
-Put markers in every base where you think you might need…(e.g. shaman’s tower, guarding place, base marker* )
-Put two markers; first one indicates where the ai player stops and regroups before attacking, second one indicates attack marker*
-Note down the markers you put.(which marker to where and which position)

Now you know information to create a landscape, put the tribes & objects and put some markers on it that you don’t know what to do with them.Marker part belongs to scripting.

and in the hell what is a trigger? calm down…this tutorial has other parts too 😀

* = will be explained later in the tutorial

Script Files Introduction

Yes you’re here…the nightmare part of populous world making. SCRIPTING

Don’t worry it is not as hard as it seems.When you get the idea it gets pretty much easier. Before making an introduction to script files, please remember this:

**********************************************************************

This kind of script writing is bad:

EVERY 8192 400
{
IF ( INT_MY_NUM_PEOPLE > 10 && INT_M_BUILDING_WARRIOR_TRAIN > 1 )
{
IF ( INT_MY_NUM_KILLED_BY_BLUE > 5 )
{
SET INT_ATTR_AWAY_SHAMAN 1
DO ATTACK BLUE 6 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 900 INT_SWARM INT_LIGHTNING INT_NO_SPECIFIC_SPELL ATTACK_NORMAL 0 -1 -1 -1
}
ENDIF
}
ENDIF
}

**********************************************************************

This kind of script writing is good:

//----------------------ATTACK CONDITION DEPENDING ON NUMBER OF PEOPLE KILLED BY BLUE AND TIME----------------------//
EVERY 8192 400
{
IF ( INT_MY_NUM_PEOPLE > 10 && INT_M_BUILDING_WARRIOR_TRAIN > 1 )
{
IF ( INT_MY_NUM_KILLED_BY_BLUE > 5 )
{
SET INT_ATTR_AWAY_SHAMAN 1
DO ATTACK BLUE 6 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 900 INT_SWARM INT_LIGHTNING INT_NO_SPECIFIC_SPELL ATTACK_NORMAL 0 -1 -1 -1
}
ENDIF
}
ENDIF
}
//----------------------END OF ATTACK CONDITION ----------------------//

And we are going to use the second one; script writing with comments and taking everything in borders.

Script Files are the brains of computer players. You give commands to the computer when you write something in script file. Shortly; You say, computer does. Computer uses these files to set blue restrictions as well. Something like giving one shot spells at the beginning of game or no blue reincarnation etc…

Now you ask “how in the hell i’m going to understand and write in my mind all these syntax…” No you don’t need to understand every piece of syntax codes.

The easiest way to get on with this is to have a correct syntax structure guide and a little brain… When writing scripts only look for a syntax code when the codes you remind aren’t enough and you really “NEED a New Code” Don’t forget that populous has script files written and you can have look at each of them to understand what did bullfrog do to make something work on a specific level.

All the marker stuff goes to scripts too. In scripts when you’re going to set an attack for ai you need markers,
when telling the shaman to stop somewhere and use spells for defense you need markers
when using time based or condition based triggers you need markers
when saying to the computer that “this is your base idiot, do not leave it or expand it” you need markers…
umm…well you NEED markers.

As final words; Scripts are the brains of the game.

Taking Notes

Do take notes of many things you did within scripts or within the map,
take notes of errors you stumbled
take notes of glitches you encounter
take notes of what was the idea of map and things related to that

Using the World Editor

In a More Advanced Way

Now i’m gonna refer creating objects that are connected to triggers or connected together and advanced objects.

First…Triggers

What is a Trigger?

Trigger means: activate the objects or effects or anything linked to this thing considering conditions i gave (e.g. worship time, shaman only, library, or even no stone head just trigger* )
So with this thing you understood that you can connect some effect or discovery(spell, building or mana) to a trigger and put it in a stone head in some way and when worshipped, shaman gains this discovery or effect…There are two big parts i give to this issue.

The easy part (stone heads, vaults of knowledge, obelisks that give a discovery)
The hard part (effects, object links, spell links, timed triggers, conditional triggers)

Now here’s how you give a single shot blast spell to blue shaman…i mean the easy part:

-First Open objects menu and then create a new stone head which is listed under scenery.
-Make sure it belongs to blue otherwise the discovery will go to an other tribe.
-After creating your head, Create a discovery which is listed under general and make it neutral.
-Click options.
-As you can see you’re able to select what you want this discovery to give the player
-Now select once (permanent and level will be explained) the first row and then spell in the second row and last select blast from the spell list
-The fourth row is to write the amount of mana and is activated when you select mana from the second row.

Now we have our discovery part done

//
-Permanent gives the discovery to the player for the rest of the level…Populous does not use a chace for scripts so you cannot count something on a level and bring the result to the next level…I know I would really want that too but nothing you can do with this 🙁
-Level does the exact same thing permanent does but it does not turn your stone head to a vault of knowledge. USELESS for SP
//

Here we go to the trigger part

-Again open objects and create a trigger which belongs to neutral and listed under general
-Click options

This menu is the biggest part of the job…i’ll first tell how to make a standard stone head and then explain it in an advanced way.

-Select proximity(as default) from the first bar. this means everybody can worship this and this is a stone head.
-Cell radius will be set 1 for now.
-Pray time is how much game turns(approx. 12 turns for 1 second or vice versa i’m not sure :S ) should player worship this totem.e.g.make it 25
-Occurrences defines how many times can the head be worshipped
-Inactive time is the number that defines the losing time…you know when you leave worshipping it slowly ends….this is that time.
-Trigger count means how many people are required to worship this head. (can only go upper than 1 in proximity)
-Start inactive COMPLETELY USELESS FOR SP just uncheck it
-Create player owned, if checked the discovery goes only to the player that the stone head belongs to, if not blue can trigger a discovery or effect for green 😀
so we check this one for now.
-Click links and select the discovery you have created then click link. by doing this you have told the trigger to create a stone head from this scenery item, and give this discovery when they worship.

Now we have the trigger part done too.

//
-Since we use scripts, Timed is useless for us
-The same goes to Player Death as well
-For shaman AoD it creates a stauette of an angel of death…only worshipped by shaman
-Library makes a vault of knowledge.
-If you select Shaman Proximity, it makes an obelisk and can only be worshipped by shaman so trigger count MUST be 1
-Cell radius indicates the number of discoveries a trigger can contain.
//

And put all these three together on the same square.
Congrats! you have a stone head that gives the worshipper a single shot blast.

Applying What Is On Your Mind to World Editor (Without Scripting)

-Please Don’t take this guide as rules…and don’t forget that you’re free to do anything with/to anything, I will just give ideas to create a more clear shape on your mind.

As we come so far, you know how to make some land with raising and lowering tools and you can put objects and stone heads on it. You might think this will be enough to make a working cool map. Actually yes you’re right.

However what should you do when you want something special? like, shaman worships a stone head and surprisingly no discovery comes, instead a big earthquake spell crushes her settlement or a big volcano erupts in greens reinc site maybe a new settlement appears immediately or rises from water etc etc…

Please remember this: Everything depends on your mind and main idea on this level…do new blue huts and warrior huts fit your mission? Will the player need to worship a totem to open her way to red’s base? or putting a volcano discovery totem must create an earthquake when worshipping is done? Or is the green too powerful and player needs to worship a totem which erodes all the land green has?…you got the idea.

Let’s say you think “i should kill blue when green worships this stone head”

Now the first thing you must do is to decide how to do that.

How this must be?

-Eroding land to the sea? does this fit the main idea of the mission you chose? does these kind of land disrupting things usually happen on these lands?
-Creating an ancient army of firewarriors belongs to green’s very old ancestors? Do green have some story like this?
-Calling angels of death to bring destruction?
The things is to decide the way to do this and after that you must think about the way you’re gonna use triggers.
Will this destruction be activated by green worshipping on a totem? or a newly raised totem after the one blue had worshipped.

When you decide these two things you’ll need to mess a little bit with the editor. Try to create the land and stone heads as in your mind and get ready to finish the triggering process.

Now here goes some info to implement what’s on your mind to the map:

-If you want a stone head raise after worshipping one, create the trigger (with options of course) of the first one and link it to the trigger of the second one.
I suppose this one is clear enough
-If you want to cast an effect or multiple effects at the same time somewhere on the land, put your effects to the places you want and then link them to the trigger
if a trigger is only connected to effects it becomes a totem pole
-If you want to rise a land with buildings on it from the sea, you’ll need to put the effect called atlantis set and atlantis invoke on the same square on the map and on the land you want to rise
-If you want to give player some men and/some settlement on a land that already is there you’ll need to put the objects you want to give and link all of them to a trigger.
*Triggers can be connected together too.

———————————————————-

AS WE COME SO FAR YOU HAVE LEARNED TO IMPLEMENT 60% OF WHAT IS ON YOUR MIND.

———————————————————-

Texture Changing/Editing

This is easy…we’re gonna use TedTycoon’s Raw Editor for texture purposes.

Download and Install the program and open it.

After that the program will guide you to the rest. It contains a well written help file too. I’m not so experienced in the texture editing related issues so when i tell you how to export and import the rest is up to you.

Open the landscape raw bigf0-X (X is the number or letter) and open the palette file pal0-X

Then just export, make changes in any kind of editor (don’t change the palette or save it and use it as a default after every change u made on the palette) and import.

Triggers and Effects

I will not include this part as “this does this” because the help file of the world editor perfectly does this.

Scripting

How and where to start scripting…

Well we’re going to start the hardest part of the game but not the tutorial.

As told before scripts are brains of the computer players…

The best way to start to examine these brains is to extract their whole codes and try to understand what refers to what ingame in that level…

I mean decompile cpscr010.dat to see the first level’s dakini computer brain. You might get a little bit confused so first have a look at syntax descriptions at each of you come across. Remember there’s nothing you can learn step by step and clearly perfectly…you’ll always have confusions…and this makes you intelligent. You come across a problem and just work to solve it. A classical Computer Man.

The first thing you could try is to change scripts that are active in original game. you might change the number of red people that attacks blue in level 5 depending on time or you might change timed triggers in level 19 or you might even try to deal with flyby things in any level.

When you understand some little codes some techniques syntax codes, or even what’s going on with what code, proceed to the second part. Try to make exact copies of script codes by writing on a notepad by your own hand. With your own comments too. And try a little implementing the numbers & positions to your own map setting.

As final words, try to get on with and understand something when dealing with original script files.

Advanced Scripting

Ok…Let’s start.

First of all, Decompile one of the scripts(e.g. cpscr015.dat) that are contained in my BETA release of Populous: The Afterward Single Player Project. open it up.

This part below contains the codes to set the attributes and restrictions of the computer player at the beginning of the level.

{
IF ( INT_GAME_TURN == 0 )
{
SET $0 0
DO SET_ATTACK_VARIABLE $0
SET INT_ATTR_ATTACK_PERCENTAGE 64
SET INT_ATTR_AWAY_BRAVE 10
SET INT_ATTR_AWAY_FIREWARRIOR 0
SET INT_ATTR_AWAY_RELIGIOUS 20
SET INT_ATTR_AWAY_SHAMAN 1
SET INT_ATTR_AWAY_SPY 0
SET INT_ATTR_AWAY_WARRIOR 80
SET INT_ATTR_BASE_UNDER_ATTACK_RETREAT 1
SET INT_ATTR_BOAT_HOUSE_BROKEN 0
SET INT_ATTR_COUNT_PREACH_DAMAGE 0
SET INT_ATTR_DEFENSE_RAD_INCR 3
SET INT_ATTR_DONT_AUTO_TRAIN_PREACHERS 0
SET INT_ATTR_DONT_DELETE_USELESS_BOAT_HOUSE 0
SET INT_ATTR_DONT_GROUP_AT_DT 1
SET INT_ATTR_DONT_USE_BOATS 1
SET INT_ATTR_EMPTY_AT_WAYPOINT 0
SET INT_ATTR_ENEMY_SPY_MAX_STAND 255
SET INT_ATTR_EXPANSION 30
SET INT_ATTR_FIGHT_STOP_DISTANCE 10
SET INT_ATTR_GROUP_OPTION 0
SET INT_ATTR_HOUSE_PERCENTAGE 35
SET INT_ATTR_MAX_ATTACKS 15
SET INT_ATTR_MAX_BUILDINGS_ON_GO 20
SET INT_ATTR_MAX_DEFENSIVE_ACTIONS 0
SET INT_ATTR_MAX_SPY_ATTACKS 0
SET INT_ATTR_MAX_TRAIN_AT_ONCE 7
SET INT_ATTR_PEOPLE_PER_BALLOON 0
SET INT_ATTR_PEOPLE_PER_BOAT 0
SET INT_ATTR_PREF_BALLOON_DRIVERS 0
SET INT_ATTR_PREF_BALLOON_HUTS 0
SET INT_ATTR_PREF_BOAT_DRIVERS 0
SET INT_ATTR_PREF_BOAT_HUTS 0
SET INT_ATTR_PREF_FIREWARRIOR_PEOPLE 0
SET INT_ATTR_PREF_FIREWARRIOR_TRAINS 0
SET INT_ATTR_PREF_RELIGIOUS_PEOPLE 0
SET INT_ATTR_PREF_RELIGIOUS_TRAINS 0
SET INT_ATTR_PREF_SPY_PEOPLE 0
SET INT_ATTR_PREF_SPY_TRAINS 0
SET INT_ATTR_PREF_WARRIOR_PEOPLE 0
SET INT_ATTR_PREF_WARRIOR_TRAINS 0
SET INT_ATTR_RANDOM_BUILD_SIDE 1
SET INT_ATTR_RETREAT_VALUE 1
SET INT_ATTR_SHAMEN_BLAST 256
SET INT_ATTR_SPELL_DELAY 0
SET INT_ATTR_SPY_CHECK_FREQUENCY 256
SET INT_ATTR_SPY_DISCOVER_CHANCE 100
SET INT_ATTR_USE_PREACHER_FOR_DEFENCE 1
DO STATE_CONSTRUCT_BUILDING OFF
DO STATE_DEFEND ON
DO FLYBY_ALLOW_INTERRUPT ON
DO STATE_STATE_BRING_NEW_PEOPLE_BACK ON
DO STATE_FETCH_WOOD ON
DO STATE_HOUSE_A_PERSON ON
DO STATE_TRAIN_PEOPLE ON
DO STATE_FETCH_LOST_PEOPLE ON
DO STATE_SHAMAN_GET_WILDS ON
DO SET_REINCARNATION ON
DO SET_AUTO_BUILD ON
DO STATE_AUTO_ATTACK ON
DO STATE_BUILD_VEHICLE OFF
DO STATE_PREACH OFF
DO SET_BASE_RADIUS 15
DO SET_BASE_MARKER 0
DO SET_DEFENCE_RADIUS 7
SET $1 0
SET $2 0
SET $3 0
SET $4 0
SET $5 0
SET $6 0
SET $7 0
SET $8 0
SET $9 0
SET $10 0
SET $11 0
SET $12 0
SET $13 0
SET $14 0
SET $15 0
SET $16 0

IF means if…that’s obvious…IF you ask me what this means this time i murder an army of cats XD. Every code that starts with INT is an internal variable which means it changes within the game engine itself.

This part below contains the code that says computer player to give up and commands all people to attack blue.

I don’t know why we have this code here but i couldn’t make the script clearly run without this code…so i recommend you to leave it as it is.

}
ELSE
{
EVERY 64
{
IF ( INT_MY_NUM_PEOPLE <8> 10 )
{
IF ( INT_M_BUILDING_MEDIUM_HUT < 1 && INT_M_BUILDING_LARGE_HUT < 1 )
{
IF ( INT_M_BUILDING_SMALL_HUT < 1 )
{
DO GIVE_UP_AND_SULK ON
}
ENDIF
}
ENDIF
}
ENDIF

I don’t know what these codes mean…i guess it should be the mana costs of the spells computer has. This should be left as it is too.

IF ( INT_MY_NUM_PEOPLE < 80 )
{
DO SET_BUCKET_USAGE ON
DO SET_BUCKET_COUNT_FOR_SPELL INT_CONVERT 8
DO SET_BUCKET_COUNT_FOR_SPELL INT_SWARM 32
DO SET_BUCKET_COUNT_FOR_SPELL INT_INVISIBILITY 40
DO SET_BUCKET_COUNT_FOR_SPELL INT_SHIELD 48
DO SET_BUCKET_COUNT_FOR_SPELL INT_LAND_BRIDGE 66
DO SET_BUCKET_COUNT_FOR_SPELL INT_LIGHTNING 64
DO SET_BUCKET_COUNT_FOR_SPELL INT_HYPNOTISM 70
DO SET_BUCKET_COUNT_FOR_SPELL INT_TORNADO 72
DO SET_BUCKET_COUNT_FOR_SPELL INT_SWAMP 80
DO SET_BUCKET_COUNT_FOR_SPELL INT_FLATTEN 100
DO SET_BUCKET_COUNT_FOR_SPELL INT_EARTHQUAKE 140
DO SET_BUCKET_COUNT_FOR_SPELL INT_EROSION 168
DO SET_BUCKET_COUNT_FOR_SPELL INT_FIRESTORM 320
DO SET_BUCKET_COUNT_FOR_SPELL INT_ANGEL_OF_DEATH 408
DO SET_BUCKET_COUNT_FOR_SPELL INT_VOLCANO 640
}
ELSE
{
DO SET_BUCKET_USAGE ON
DO SET_BUCKET_COUNT_FOR_SPELL INT_CONVERT 4
DO SET_BUCKET_COUNT_FOR_SPELL INT_SWARM 16
DO SET_BUCKET_COUNT_FOR_SPELL INT_INVISIBILITY 20
DO SET_BUCKET_COUNT_FOR_SPELL INT_SHIELD 24
DO SET_BUCKET_COUNT_FOR_SPELL INT_LAND_BRIDGE 33
DO SET_BUCKET_COUNT_FOR_SPELL INT_LIGHTNING 32
DO SET_BUCKET_COUNT_FOR_SPELL INT_HYPNOTISM 35
DO SET_BUCKET_COUNT_FOR_SPELL INT_TORNADO 36
DO SET_BUCKET_COUNT_FOR_SPELL INT_SWAMP 40
DO SET_BUCKET_COUNT_FOR_SPELL INT_FLATTEN 50
DO SET_BUCKET_COUNT_FOR_SPELL INT_EARTHQUAKE 70
DO SET_BUCKET_COUNT_FOR_SPELL INT_EROSION 84
DO SET_BUCKET_COUNT_FOR_SPELL INT_FIRESTORM 180
DO SET_BUCKET_COUNT_FOR_SPELL INT_ANGEL_OF_DEATH 204
DO SET_BUCKET_COUNT_FOR_SPELL INT_VOLCANO 320
}
ENDIF
}

//
Any code we're gonna write will go here
\\

}
ENDIF
}
SCRIPT_END

As you can see clearly this is a structure of a script file… any code we’ll write will go under ELSE in the main IF at the beginning of the file. You have to understand that this kind of file editing is not so acceptable thus some codes may not work even if written correctly…for example i had too much problem with flyby scripting things…that part was a nightmare.

Now what can you do with scripts? Simply everything the game engine lets…

But at the very first you should understand the variable using techniques.

$15
$4
$mymothermakesreallybadcakes
$thisisavariable

These are considered as variables because they contain an $ in front of them. You’ll see things in script files like these

SET $4 1
SET $22 6

this means set $thisvariable to a constant number i give which is 6

Why would we want to do this? Well we’ll use some conditions that should be cheeked every 64 game turns but only must be done once…here we’ll need variables that we set.

Example:

We want red to attack blue once with 4 men of attributes percentages(see INT_ATTR_AWAY_XXX things)to a random building trying to deal 900 damage using the spells lightning and 2 blasts passing from no specific marker and never do an attack like this when blue prays the stone head positioned in 192 80

//ATTACK CONDITION OF BLUE PRAY HEAD//
EVERY 64
{
IF ( $5 == 0 )
{
DO GET_HEAD_TRIGGER_COUNT 192 80 $4
IF ( $4 == 0 )
{
DO ATTACK BLUE 4 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 900 INT_LIGHTNING INT_BLAST INT_BLAST ATTACK_NORMAL 0 -1 -1 -1
SET $5 1
}
ENDIF
}
ENDIF
}
//END OF ATTACK CONDITION OF BLUE PRAY HEAD//

Now here have a look at these codes on a more detailed way:

//ATTACK CONDITION OF BLUE PRAY HEAD//
EVERY 64 -This code says that "every 64 game turns do the things listed below"
{ -This opens the "...things listed below" list
IF ( $5 == 0 ) -if variable $5 is equal to 0 then do the things listed below until you see ENDIF code. this have to be set at the start of the script in the attributes section i referred before.
{
DO GET_HEAD_TRIGGER_COUNT 192 80 $4 -This code means: "count the triggers(occurrences) left in a stone head at indicated position and write the result in variable $4)
IF ( $4 == 0 ) -if variable $4 is equal to 0 then do the things listed below until you see ENDIF code
{
DO ATTACK(attack) BLUE(player) 4(number of men) ATTACK_BUILDING(as it is) INT_NO_SPECIFIC_BUILDING(random building) 900(damage) INT_LIGHTNING INT_BLAST
INT_BLAST ATTACK_NORMAL(don't know) 0(must be 0) -1(marker 1 which the men will regroup) -1 -1
SET $5 1 (and now set variable $5 to 1 so this code will not be activated again due to the IF)
} -finish the "...things listed below" list
ENDIF -close the second IF
}
ENDIF -close the first IF
} -Close the EVERY
//END OF ATTACK CONDITION OF BLUE PRAY HEAD//

Well as you can see when you examine the codes part by part and then understand it as a whole it is not so hard to put on other codes to the script…for example now you know how to write something like this:

Every xxx game turns try to do “something” depending on the variable i gave or a game variable gave and try to match all the conditions written. When the conditions matched and the “something” is done change one variable and prevent this code to be done again forever.

If you think you could understand this….you understood Scripting fully! 😀 Because everything can be done ingame using this kind of coding. Now after this you only need to know how to use this scripting code technique. Start with writing sample scripts.

Yea i know it is not as hard as it seems 😀

Applying What Is On Your Mind to World Editor (With Scripting)

I’ll directly jump to the situation this time.

When you want to create a situation that perfectly fits the level story and mission, you have to think about three main things:

-Which codes can i use to apply this situation
-Is there any examples of use of this kind of situation
-What will i need in the map related to the script.

DO NOT EVER THINK “CAN I DO THIS??” because the answer is always yes as you have the easiest ai script structure in the world…since it is languaged in fortrand yes you can easily do it.

First of all just have a little look to the syntax informations to find and note down some of which sounds useful to you and after this decide how frequently should the computer check the conditions of this situation…for example if you want an instant effect when blue worships a totem you might want to make EVERY 64 54(the second one is subtracted from the first one…pop engine only accepts powers of 2 in game turn codes so if you want a specific number you’ll need the second number) so the script file will nearly check every second if the conditions match and if it can perform the action you gave…

And after this you’ll gonna decide which variables you’ll use. For each code there must be variables you have set before.

This is something like preparing a meal; you have two main ways to do this. You can make everything ready at the beginning and by a little chance of failure you give it to the oven, or you can start making and finding the ingredients when needed then by a big chance of failure you give it to the oven, but what if you can’t find the black pepper for an hour? it is ruined.

If there’s any kind of this situation used in the original scripts first decompile it and examine the file to find the code refers to what’s on your mind, see how it is used, which codes it depend and on and on….

Then start writing… “”AGAIN REMEMBER: USE COMMENT LINES TO KEEP TRACK OF YOUR SCRIPTING.””

When doing this you might need some positions or markers for some codes like GET_HEAD_TRIGGER_COUNT or GUARD_AT_MARKER so the world editor must be running at the same time you’re scripting. Thus you can get any position needed from the map or put any marker index to anywhere.

Syntax Information

Sorry for this but it will be really big waste of time.

I will not include code by code due to “there are many sources that give these”. So just wiki it you’ll find a little text at the bottom of the ai scripting page which shows you exact meanings of syntaxes and how to use each syntax code.

Just don’t forget this: You don’t have to memorize all of them…just keep the page open or download it and look at it when needed.

Language File

How to Open and Edit Language Files

The best way is to do this is to export language file to plain text file and then open that file…If you google a little you’ll find a useful lang editor owned by “Blue Warrior Hut”. When editing lang. files you have only one rule. Do not change the character size of the file…i mean if there are 8345679812365398456 characters in the file (including space) what ever you change the file must contain 8345679812365398456 characters.

What Code Refers to Which Message?

No absolute answer to this i could find, but i can tell you the easiest way i know to implement messages in your map.

In the script file of red or green or yellow (only one of them) create a code that shows a message at the beginning of the game and make this message number xxx(72,89,122,150…i think it starts about from 89 and ends about at 222 i’m not sure) which will contain the numbered message in the lang file. and after this compile and run the game to the level you have changed…shortly launch your level. Then see what sentence, words, whole message comes up as you scripted…then go to lang file, find that string and change it…this looks to me the easiest way.

Compiling & Testing

Script compiling easy…when the world editor gives the message ” ! compiling successful”, open up the script menu from the menu bar and name a log file in wherever you wish, select the script plain text you’ve prepared and select the script file that it will be compiled (this will be the script file that you’ve mentioned in the header general options).

example:

errors.log
Dakini Script for level 1.txt
cpscr010.dat (as if you have written 10 for the red ai script in the header general options)

errors.log
Matak level 1
cpscr11.dat (as if you have written 11 for Matak)

you got the idea…

Now when doing this at first you’ll of course get “Compilation Failed Check the Log File for Details” messages lots of time. Now don’t panic, because the log file tells every code errors line by line to you…and writes down the expected code too. So you only need to find the line referred and try to find what makes it not run clearly.

First of all check if “{” and “}” matches their self…i mean one opens and one closes so the number must be equal between them. And after checking this have a look if you have mistaken any syntax…if log tells you what’s the problem it can be easily done but in some errors world editor stops searching for more errors when found one. Sometimes it stop when an error found and does not tell the remaining ones. So don’t be afraid of trying more and more and more…because this thing can only work after making it 100% Perfect.

How to Test Your Level

The easiest part. Just save your finished map to an original populous level….i recommend you the first level so the save your map (of course after making a backup) to level2001 file. Then go to the game and start from the beginning, your level will launch.

FINALLY….

We are done.. I hope it be useful to you. I tried to tell easiest ways to make a great SP map. Sorry if i’m mistaken in anything or please tell me if you find any information wrong. And if you have any questions or requests just post it in forum so i can easily answer.

source