AOE_Fan's RMS Command Tutorial
4 posters
Page 1 of 1
AOE_Fan's RMS Command Tutorial
I have wanted to do a tutorial about RMS commands, and finally I had time for it. Firstly, there are few things you should know:
1. This tutorial doesn't teach you how to make Random Maps, you still need time to learn it!
2. This tutorial only tells about different functions in Random Maps, you still need to look at different maps to see how they are actually made!
3. I really recommend you to read Monty_Python's RMS Tutorial before looking at this thread, it explains many basic things you need to know!
1. General Commands
This tutorial has been paused for some time.
1. This tutorial doesn't teach you how to make Random Maps, you still need time to learn it!
2. This tutorial only tells about different functions in Random Maps, you still need to look at different maps to see how they are actually made!
3. I really recommend you to read Monty_Python's RMS Tutorial before looking at this thread, it explains many basic things you need to know!
1. General Commands
- Spoiler:
- rmEchoInfo(string echoString, int level);
Random map echo, can be used to send information while debugging the script. Pretty useless command, as players can't see it.
rmRandFloat(float min, float max);
A float between min and max. As a float, it can use decimals, so it can be like "0.53" or "2.71". Not as useful as int (see below), some examples:
float seasonPicker = rmRandFloat(1,2);
float waterSide = rmRandFloat(0.5,1.5);
rmRandInt(int min, int max);
An int between min and max. As an int, it cannot use decimals, so it can be like "3" or "7". Very useful to create randomness, some examples:
int nativeInt1 = rmRandInt(1,2);
int teamSide = rmRandInt(1,4);
rmSetMapSize(int x, int z);
Sets the size of the map. If you want a circular map, use the same number. If you want rectangular map, other number needs to be bigger than other.
rmSetSeaLevel(int height);
Sets the sea level for the map. A negative number can be sometimes used for smoothly sloping rivers, but normally you want to use 0.0.
rmSetSeaType(string name);
Sets the sea type for the map, you only need to use this command if the terrain is initialized as water (see below). You need to put this command before initializing the water, otherwise it doesn't work. You can find the names of watertypes from editor.
rmAreaTilesToFraction(int tiles);
Converts area tile count to fraction of map. Useful with sizes of areas.
rmDegreesToRadians(float degrees);
Converts an angle in degrees to radians. Useful with circular player placement or with pie constraints.
rmXFractionToMeters(float meters);
rmZFractionToMeters(float meters);
Converts a fraction of the map in the x or z direction to meters. Very useful for keeping objects in some ciruclar area or avoiding edges, etc.
rmTerrainInitialize(string baseTerrain, float height);
Initializes the base map terrain and height. If you initialize the terrain as water, a sea type needs to be defined. This command NEEDS to be in every map. Some examples:
rmTerrainInitialize("borneo\shoreline1_borneo", 1.0);
rmTerrainInitialize("water");
rmTerrainInitialize("carolinas\ground_grass3_car", 4.0);
rmSetLightingSet(string name);
Put a lightingset to the map. You can find the names of lightingsets from editor. Some examples:
rmSetLightingSet("Carolina");
rmSetLightingSet("Malta");
rmSetStatusText(status, progress);
This command is used to make the loading bar move while loading the map. The text for "status" doesn't seem to work, so you just need to define the progress, like "0.10" or "0.65". If you don't put the amounts, the loading bar doesn't move, but the map still loads.
rmSetWindMagnitude(float windiness);
Sets the magnitude of the wind. Higher number makes the trees' leaves to move and smoke from buildings travel much further.
rmSetMapType(string mapType);
Sets a maptype for the map. This is used to define what type of nuggets to use in map and can be used to tell AI if it's water map or not. Some examples:
rmSetMapType("grass");
rmSetMapType("snow");
rmSetMapType("land");
rmSetMapType("water");
rmSetMapType("greatlakes");
int rmDefineClass(string className);
Define a class with the given name. You must define each class before using them. Some examples:
int classMines=rmDefineClass("mines");
int classSea=rmDefineClass("sea");
When you use class defined like this, you need to make an object belong to it like this:
rmAddObjectDefToClass(int ID, classMines);
rmDefineClass(string className);
Another way to define classes. Some examples:
rmDefineClass("classForest");
rmDefineClass("nuggets");
rmClassID(string name);
Used, when defining classes with the way above. Some examples:
rmAddObjectDefToClass(int ID, rmClassID("nuggets"));
int forestConstraint=rmCreateClassDistanceConstraint("forest avoid forest", rmClassID("classForest"), 20.0);
This tutorial has been paused for some time.
AOE_Fan- K&B Leader
- Posts : 3615
Join date : 2011-05-27
Re: AOE_Fan's RMS Command Tutorial
This is useful. Thanks! I currently am having problems with natives, sometimes they show up and sometimes they don't. Any ideas on why that happens?
checanos- Peasant
- Age : 26
Posts : 15
Join date : 2012-06-02
Re: AOE_Fan's RMS Command Tutorial
There can be several issues:
1. Obvious coding errors. However because the natives show up sometimes, this is not the case.
2. Randomization. Are you sure there is no designed randomness factor with the natives like showing up only 50% of times?
3. Too heavy constraints. You may have set the native settlements to avoid players or other settlements too much and they simply haven't got enough possible places.
4. Not enough space. I ALWAYS place the native settlements (and trading posts) before forests, mines or animals, so that there is enough space for them. You also have to make sure these other things then avoid the settlements!
5. Wrong place/position. Native settlements cannot be placed on water or on unbuildable terrains, make sure you have proper constraints (but again, not too much).
1. Obvious coding errors. However because the natives show up sometimes, this is not the case.
2. Randomization. Are you sure there is no designed randomness factor with the natives like showing up only 50% of times?
3. Too heavy constraints. You may have set the native settlements to avoid players or other settlements too much and they simply haven't got enough possible places.
4. Not enough space. I ALWAYS place the native settlements (and trading posts) before forests, mines or animals, so that there is enough space for them. You also have to make sure these other things then avoid the settlements!
5. Wrong place/position. Native settlements cannot be placed on water or on unbuildable terrains, make sure you have proper constraints (but again, not too much).
AOE_Fan- K&B Leader
- Posts : 3615
Join date : 2011-05-27
Re: AOE_Fan's RMS Command Tutorial
It probably does not help that I modified an existing map. I'm still a newbie when it comes to RMS. It Should not be a problem because I just changed the names of the Natives, not their positions. It could be because originally in Ozarks, there are three native choices, I only have two.
Ozarks
My Map
Ozarks
My Map
checanos- Peasant
- Age : 26
Posts : 15
Join date : 2012-06-02
Re: AOE_Fan's RMS Command Tutorial
I see the problem but instead of only posting a fixed script, I'll go through it so you can understand it better.
The script has a randomized integer whichNative with random value of 1-6.
In the original script
- If whichNative is below 3, both of the natives are Comanche.
- If whichNative is 3, both of the natives are Cheyenne.
- If whichNative is something else (4, 5 or 6), both of the natives are Cherokee.
In your script
- If whichNative is below 3, both of the natives are Woodsmen.
- If whichNative is 3, both of the natives are Beornings.
- If whichNative is something else (4, 5 or 6), no natives are defined = no natives appear.
Basically you should edit the allowed values of whichNative integer. If you just want 2 possibilities, values of 1 and 2 should be fine. And also, original Aoe3 RMs have crappy and messy coding...
The script has a randomized integer whichNative with random value of 1-6.
In the original script
- If whichNative is below 3, both of the natives are Comanche.
- If whichNative is 3, both of the natives are Cheyenne.
- If whichNative is something else (4, 5 or 6), both of the natives are Cherokee.
In your script
- If whichNative is below 3, both of the natives are Woodsmen.
- If whichNative is 3, both of the natives are Beornings.
- If whichNative is something else (4, 5 or 6), no natives are defined = no natives appear.
Basically you should edit the allowed values of whichNative integer. If you just want 2 possibilities, values of 1 and 2 should be fine. And also, original Aoe3 RMs have crappy and messy coding...
AOE_Fan- K&B Leader
- Posts : 3615
Join date : 2011-05-27
Re: AOE_Fan's RMS Command Tutorial
And pretty creepy...
Pepp- Moderator
- Age : 28
Posts : 5277
Join date : 2011-04-29
Re: AOE_Fan's RMS Command Tutorial
And for the Map to show up in skirmish, do I just have to keep the xml and xs files in the RM3 foldor?
checanos- Peasant
- Age : 26
Posts : 15
Join date : 2012-06-02
Re: AOE_Fan's RMS Command Tutorial
Remember you should have a back up for both ozark.xml and ozark.xs before modifying them.
Then yes you put the modified ozark.xml and ozark.xs in the RM3 folder...if you have TAD installed.
RM: vanilla
RM2: TWC
RM3: TAD
Quick pointers that you may be stuck on (I was in the past):
(1) Remember that you must put the ozark.xml and ozark.xs files in BOTH the C:/.../Documents/My Games/Age of Empires III/RM3/ AND the C:/.../Microsoft Games/Age of Empires III/RM3/, or else the map won't load.
(2) Remember that you must click "Custom Maps" in the skirmish screen for your map to be available to click on in the drop-down menu.
To help you with your editing, here is the minimum possible map script for a map to load:
I don't recommend custom map scripting from scratch for now, because I have made no progress on it so far and no one who has cares to share how they did it.
Maybe I will figure it out eventually and be teaching everyone how to do it.
I tried to make my own command tutorial, and I didn't get past an introduction before I gave up. Maybe I will get to part I eventually.
Summer comming soon and me buying a new hard drive so I have room to mod AoE3 is a good sign for my learning of the commands.
What particularly draws me to RMS is that I don't really need a teacher like with modeling because to get results you just try typing in different codes for hours until something works.
Hhm, I've never played Ozarks and now I never will after seeing the natives in that code AoE Fan posted. At least I won't play on Ozarks until I can make the natives more historically accurate. Souix on the Ozarks is just E.S. not even trying.
Then yes you put the modified ozark.xml and ozark.xs in the RM3 folder...if you have TAD installed.
RM: vanilla
RM2: TWC
RM3: TAD
Quick pointers that you may be stuck on (I was in the past):
(1) Remember that you must put the ozark.xml and ozark.xs files in BOTH the C:/.../Documents/My Games/Age of Empires III/RM3/ AND the C:/.../Microsoft Games/Age of Empires III/RM3/, or else the map won't load.
(2) Remember that you must click "Custom Maps" in the skirmish screen for your map to be available to click on in the drop-down menu.
To help you with your editing, here is the minimum possible map script for a map to load:
- Code:
void main() {
rmSetMapSize(100, 100);
rmTerrainInitialize();
for (i=1;<cNumberPlayers) {
rmPlacePlayer(i, .5, .5);
int id = rmCreateArea("p"+i);
rmSetPlayerArea(i, id);
int start = rmCreateObjectDef("s"+i);
rmAddObjectDefItem(start, "explorer", 1, 50.0);
rmPlaceObjectDefAtLoc(start, i, .5, .5);
}
}
I don't recommend custom map scripting from scratch for now, because I have made no progress on it so far and no one who has cares to share how they did it.
Maybe I will figure it out eventually and be teaching everyone how to do it.
I tried to make my own command tutorial, and I didn't get past an introduction before I gave up. Maybe I will get to part I eventually.
Summer comming soon and me buying a new hard drive so I have room to mod AoE3 is a good sign for my learning of the commands.
What particularly draws me to RMS is that I don't really need a teacher like with modeling because to get results you just try typing in different codes for hours until something works.
Hhm, I've never played Ozarks and now I never will after seeing the natives in that code AoE Fan posted. At least I won't play on Ozarks until I can make the natives more historically accurate. Souix on the Ozarks is just E.S. not even trying.
Re: AOE_Fan's RMS Command Tutorial
Lel, you don't even have made one.
Pepp- Moderator
- Age : 28
Posts : 5277
Join date : 2011-04-29
Re: AOE_Fan's RMS Command Tutorial
And also, this is incorrect...
You definitely don't need to place the map into two folders.(1) Remember that you must put the ozark.xml and ozark.xs files in BOTH the C:/.../Documents/My Games/Age of Empires III/RM3/ AND the C:/.../Microsoft Games/Age of Empires III/RM3/, or else the map won't load.
AOE_Fan- K&B Leader
- Posts : 3615
Join date : 2011-05-27
Re: AOE_Fan's RMS Command Tutorial
Hello it's me again with another problem. (Tell me if this bothers you, then I will stop)
I'm trying to insert herdables into a map, but it crashes. I put the constraints and then I put the placement. The placement causes it to crash. Is there a reason? Or does the RM overlord just not like me...
I'm trying to insert herdables into a map, but it crashes. I put the constraints and then I put the placement. The placement causes it to crash. Is there a reason? Or does the RM overlord just not like me...
- Code:
//herdable1
int herdable1ID=rmCreateObjectDef("herdable1");
rmAddObjectDefItem(herdable1ID, herdable1, 2, 3.0);
rmSetObjectDefMinDistance(herdable1ID, 0.0);
rmSetObjectDefMaxDistance(herdable1ID, rmXFractionToMeters(0.5));
rmAddObjectDefConstraint(huntable2ID, avoidHuntable2);
rmAddObjectDefConstraint(huntable2ID, avoidHuntable1);
rmAddObjectDefConstraint(herdable1ID, avoidHerdable1);
rmAddObjectDefConstraint(herdable1ID, avoidAll);
rmAddObjectDefConstraint(herdable1ID, avoidSocket);
rmAddObjectDefConstraint(herdable1ID, avoidTradeRoute);
rmAddObjectDefConstraint(herdable1ID, avoidImpassableLand);
rmAddObjectDefConstraint(herdable1ID, longPlayerConstraint);
rmPlaceObjectDefAtLoc(herdable1ID, 0, 0.5, 0.5, cNumberNonGaiaPlayers*2);
checanos- Peasant
- Age : 26
Posts : 15
Join date : 2012-06-02
Re: AOE_Fan's RMS Command Tutorial
There is something funny, but might not be the problem:
I don't really remember what is wrong... I haven't script a map for years.
rmAddObjectDefConstraint(huntable2ID, avoidHuntable2);
rmAddObjectDefConstraint(huntable2ID, avoidHuntable1);
I don't really remember what is wrong... I haven't script a map for years.
Pepp- Moderator
- Age : 28
Posts : 5277
Join date : 2011-04-29
Re: AOE_Fan's RMS Command Tutorial
Can musketeer please reupload his RMS tutorial somewhere? The link on the tutorial database for his tutorial doesn't work anymore.
Edit: Never mind, I found it here in a "web archive". http://web.archive.org/web/20100421112530/http://hyenastudios.mugamo.com/aoe3rmstutorial.htm
But I'm not sure if the web archive is viewable on other sites. Well I don't know how web archives work. The link on the Wotta tutorial database doesn't work and the tutorial is no longer included in the AoE3H tutorial database.
Edit: Never mind, I found it here in a "web archive". http://web.archive.org/web/20100421112530/http://hyenastudios.mugamo.com/aoe3rmstutorial.htm
But I'm not sure if the web archive is viewable on other sites. Well I don't know how web archives work. The link on the Wotta tutorial database doesn't work and the tutorial is no longer included in the AoE3H tutorial database.
Re: AOE_Fan's RMS Command Tutorial
Hello it is me again. I have encountered another problem with natives. I have a modified version of Deccan. I am trying to change the natives but I don't know what to change. I have tried by changing the names but then an error comes up.
Does anyone know what I am supposed to change?
Is there an easier way to implement natives that doesn't involve changing existing code. Are there simpler lines of code?
- Code:
// Natives
int randomNative1 = rmRandInt(1,3);
int randomNative2 = rmRandInt(1,3);
string nativeString1 = "native udasi village ";
string nativeString2 = "native bhakti village ";
string nativeString3 = "native sufi mosque deccan ";
string stringNative1 = "";
string stringNative2 = "";
if(randomNative1 == 1)
stringNative1 = nativeString1;
else if (randomNative1 == 2)
stringNative1 = nativeString2;
else
stringNative1 = nativeString3;
if(randomNative2 == 1)
stringNative2 = nativeString1;
else if (randomNative2 == 2)
stringNative2 = nativeString2;
else
stringNative2 = nativeString3;
if (subCiv0 == rmGetCivID("Udasi")) {
int udasiVillageAID = -1;
int udasiVillageType = rmRandInt(1,5);
udasiVillageAID = rmCreateGrouping("Udasi village A", stringNative1+udasiVillageType);
rmSetGroupingMinDistance(udasiVillageAID, 0.0);
rmSetGroupingMaxDistance(udasiVillageAID, 10.0);
rmAddGroupingConstraint(udasiVillageAID, avoidImpassableLandFar);
rmAddGroupingConstraint(udasiVillageAID, playerConstraint);
rmAddGroupingConstraint(udasiVillageAID, avoidImportantItemFar);
rmAddGroupingToClass(udasiVillageAID, rmClassID("importantItem"));
if(cNumberTeams > 2) {
if(whichVersion == 1)
rmPlaceGroupingAtLoc(udasiVillageAID, 0, 0.2, 0.8);
else
rmPlaceGroupingAtLoc(udasiVillageAID, 0, 0.8, 0.8);
}
else {
//~ rmPlaceGroupingInArea(udasiVillageAID, 0, startingCliff1, 1);
rmPlaceGroupingAtLoc(udasiVillageAID, 0, 0.5, 0.6);
}
}
if (subCiv1 == rmGetCivID("Bhakti")) {
int bhaktiVillageAID = -1;
int bhaktiVillageType = rmRandInt(1,5);
bhaktiVillageAID = rmCreateGrouping("Bhakti village A", stringNative2+bhaktiVillageType);
rmSetGroupingMinDistance(bhaktiVillageAID, 0.0);
rmSetGroupingMaxDistance(bhaktiVillageAID, 10.0);
rmAddGroupingConstraint(bhaktiVillageAID, avoidImpassableLandFar);
rmAddGroupingToClass(bhaktiVillageAID, rmClassID("importantItem"));
rmAddGroupingConstraint(bhaktiVillageAID, playerConstraint);
rmAddGroupingConstraint(bhaktiVillageAID, avoidImportantItemFar);
if(cNumberTeams > 2) {
if(whichVersion == 1)
rmPlaceGroupingAtLoc(bhaktiVillageAID, 0, 0.8, 0.2);
else
rmPlaceGroupingAtLoc(bhaktiVillageAID, 0, 0.2, 0.2);
}
else {
//~ rmPlaceGroupingInArea(bhaktiVillageAID, 0, startingCliff1, 1);
rmPlaceGroupingAtLoc(bhaktiVillageAID, 0, 0.5, 0.4);
}
}
Does anyone know what I am supposed to change?
Is there an easier way to implement natives that doesn't involve changing existing code. Are there simpler lines of code?
checanos- Peasant
- Age : 26
Posts : 15
Join date : 2012-06-02
Re: AOE_Fan's RMS Command Tutorial
The grouping is what you have to change. Here:
Compare it with another map's code, so you'll know what will change the grouping.
- Code:
udasiVillageAID = rmCreateGrouping("Udasi village A", stringNative1+udasiVillageType);
Compare it with another map's code, so you'll know what will change the grouping.
Pepp- Moderator
- Age : 28
Posts : 5277
Join date : 2011-04-29
Re: AOE_Fan's RMS Command Tutorial
I try to avoid using external integers that TAD developers clearly loved very much. By doing this, you can compress your script a tiny bit. This is what I'd do:
- Code:
if (randomNative1 == 1)
udasiVillageAID = rmCreateGrouping("Udasi village A", "native udasi village "+udasiVillageType);
else if (randomNative1 == 2)
udasiVillageAID = rmCreateGrouping("Bhakti village A", "native bhakti village "+udasiVillageType);
else
udasiVillageAID = rmCreateGrouping("Sufi village A", "native sufi mosque deccan "+udasiVillageType);
AOE_Fan- K&B Leader
- Posts : 3615
Join date : 2011-05-27
Re: AOE_Fan's RMS Command Tutorial
Well I tried that and it crashes :/ But I also don't need a random native since there will be only one type.
EDIT: I got it working after a lot of trail and error. Thanks for helping @Pepp @AOE_Fan.
EDIT: I got it working after a lot of trail and error. Thanks for helping @Pepp @AOE_Fan.
checanos- Peasant
- Age : 26
Posts : 15
Join date : 2012-06-02
Similar topics
» Maxulino's "The Trigger Tutorial"
» Tutorial: Gebruiken van de Granny Viewer ('Using the Granny Viewer' translated to DUTCH)
» Tutorial: Gebruiken van de Granny Viewer ('Using the Granny Viewer' translated to DUTCH)
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|
Thu 11 Feb 2016 - 2:13 by danielpereira
» Friday Update: Week 48/2015, Double English Trouble
Sat 28 Nov 2015 - 1:42 by peugeot407
» Friday Update: Week 45/2015, Introducing the English
Sat 7 Nov 2015 - 2:00 by peugeot407
» Friday Update Monthly Report: Week 44/2015, Final News on the Germans
Sat 31 Oct 2015 - 6:46 by peugeot407
» Knights and Barbarians Updates and Patches
Wed 28 Oct 2015 - 8:46 by peugeot407
» Friday Update: Week 42/2015, German Knightly Orders
Sat 17 Oct 2015 - 0:03 by peugeot407
» Friday Update: Week 41/2015, German population bonuses
Sat 10 Oct 2015 - 8:47 by peugeot407
» Friday Update: Week 40/2015, Introducing the Germans
Sat 3 Oct 2015 - 22:23 by peugeot407
» Friday Update: Week 39/2015, Duality!
Sat 26 Sep 2015 - 22:24 by peugeot407