AOE_Fan's RMS Command Tutorial

View previous topic View next topic Go down

AOE_Fan's RMS Command Tutorial

Post by AOE_Fan on Sat 31 Dec 2011 - 3:24

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

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.
avatar
AOE_Fan
K&B Leader
K&B Leader

Posts : 3615
Join date : 2011-05-27

Back to top Go down

Re: AOE_Fan's RMS Command Tutorial

Post by checanos on Fri 4 Apr 2014 - 8:18

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?
avatar
checanos
Peasant
Peasant

Age : 19
Posts : 15
Join date : 2012-06-02

Back to top Go down

Re: AOE_Fan's RMS Command Tutorial

Post by AOE_Fan on Fri 4 Apr 2014 - 23:25

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).
avatar
AOE_Fan
K&B Leader
K&B Leader

Posts : 3615
Join date : 2011-05-27

Back to top Go down

Re: AOE_Fan's RMS Command Tutorial

Post by checanos on Sat 5 Apr 2014 - 11:05

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
avatar
checanos
Peasant
Peasant

Age : 19
Posts : 15
Join date : 2012-06-02

Back to top Go down

Re: AOE_Fan's RMS Command Tutorial

Post by AOE_Fan on Sat 5 Apr 2014 - 21:33

I see the problem but instead of only posting a fixed script, I'll go through it so you can understand it better. Smile

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...
avatar
AOE_Fan
K&B Leader
K&B Leader

Posts : 3615
Join date : 2011-05-27

Back to top Go down

Re: AOE_Fan's RMS Command Tutorial

Post by Pepp on Sat 5 Apr 2014 - 23:33

And pretty creepy...

_________________
Philosophy of gaming: A player is a noobish modder; a modder is a noobish player.

Spoiler:
The Pepp Noble Way to Make and Drink Tea
Pepp's Eye Candy thread
Pepp's First Random Map Script!
avatar
Pepp
Moderator
Moderator

Age : 21
Posts : 5277
Join date : 2011-04-29

Back to top Go down

Re: AOE_Fan's RMS Command Tutorial

Post by checanos on Mon 7 Apr 2014 - 1:23

And for the Map to show up in skirmish, do I just have to keep the xml and xs files in the RM3 foldor?
avatar
checanos
Peasant
Peasant

Age : 19
Posts : 15
Join date : 2012-06-02

Back to top Go down

Re: AOE_Fan's RMS Command Tutorial

Post by dietermoreno on Mon 7 Apr 2014 - 18:43

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:
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.
avatar
dietermoreno
Enemy of the Realm
Enemy of the Realm

Age : 25
Posts : 121
Join date : 2012-12-29

http://youtube.com/dietermoreno

Back to top Go down

Re: AOE_Fan's RMS Command Tutorial

Post by Pepp on Tue 8 Apr 2014 - 2:04

Lel, you don't even have made one.

_________________
Philosophy of gaming: A player is a noobish modder; a modder is a noobish player.

Spoiler:
The Pepp Noble Way to Make and Drink Tea
Pepp's Eye Candy thread
Pepp's First Random Map Script!
avatar
Pepp
Moderator
Moderator

Age : 21
Posts : 5277
Join date : 2011-04-29

Back to top Go down

Re: AOE_Fan's RMS Command Tutorial

Post by AOE_Fan on Tue 8 Apr 2014 - 7:07

And also, this is incorrect... RTFM 
(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.
You definitely don't need to place the map into two folders.
avatar
AOE_Fan
K&B Leader
K&B Leader

Posts : 3615
Join date : 2011-05-27

Back to top Go down

Re: AOE_Fan's RMS Command Tutorial

Post by checanos on Thu 10 Apr 2014 - 10:32

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...

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);
avatar
checanos
Peasant
Peasant

Age : 19
Posts : 15
Join date : 2012-06-02

Back to top Go down

Re: AOE_Fan's RMS Command Tutorial

Post by Pepp on Sun 13 Apr 2014 - 23:26

There is something funny, but might not be the problem:
rmAddObjectDefConstraint(huntable2ID, avoidHuntable2);
rmAddObjectDefConstraint(huntable2ID, avoidHuntable1);

I don't really remember what is wrong... I haven't script a map for years.

_________________
Philosophy of gaming: A player is a noobish modder; a modder is a noobish player.

Spoiler:
The Pepp Noble Way to Make and Drink Tea
Pepp's Eye Candy thread
Pepp's First Random Map Script!
avatar
Pepp
Moderator
Moderator

Age : 21
Posts : 5277
Join date : 2011-04-29

Back to top Go down

Re: AOE_Fan's RMS Command Tutorial

Post by dietermoreno on Thu 22 May 2014 - 7:37

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.
avatar
dietermoreno
Enemy of the Realm
Enemy of the Realm

Age : 25
Posts : 121
Join date : 2012-12-29

http://youtube.com/dietermoreno

Back to top Go down

Re: AOE_Fan's RMS Command Tutorial

Post by checanos on Tue 29 Jul 2014 - 8:12

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.

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?
avatar
checanos
Peasant
Peasant

Age : 19
Posts : 15
Join date : 2012-06-02

Back to top Go down

Re: AOE_Fan's RMS Command Tutorial

Post by Pepp on Tue 29 Jul 2014 - 12:42

The grouping is what you have to change. Here:
Code:
    udasiVillageAID = rmCreateGrouping("Udasi village A", stringNative1+udasiVillageType);

Compare it with another map's code, so you'll know what will change the grouping.

_________________
Philosophy of gaming: A player is a noobish modder; a modder is a noobish player.

Spoiler:
The Pepp Noble Way to Make and Drink Tea
Pepp's Eye Candy thread
Pepp's First Random Map Script!
avatar
Pepp
Moderator
Moderator

Age : 21
Posts : 5277
Join date : 2011-04-29

Back to top Go down

Re: AOE_Fan's RMS Command Tutorial

Post by AOE_Fan on Tue 29 Jul 2014 - 20:27

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);
avatar
AOE_Fan
K&B Leader
K&B Leader

Posts : 3615
Join date : 2011-05-27

Back to top Go down

Re: AOE_Fan's RMS Command Tutorial

Post by checanos on Wed 30 Jul 2014 - 0:10

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 Smile after a lot of trail and error. Thanks for helping @Pepp @AOE_Fan.
avatar
checanos
Peasant
Peasant

Age : 19
Posts : 15
Join date : 2012-06-02

Back to top Go down

Re: AOE_Fan's RMS Command Tutorial

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum