User avatar
United States of America Durokan
ESOC Maps Team
Posts: 894
ESO: Durokan

18 Jan 2016, 05:29

I have decided to make a thread dedicated to random map script resources. I will link stuff I find useful here.

Attached is a reasonably well annotated RMS that I created in order to help people get their bearings within a RMS if they have never seen one before. It probably will not teach you everything you need to know about everything, that is what the RMS guide is for. It will; however, tell you what a certain block of code is for and what it does. In conjunction with the RMS guide it should make it easy to write your own maps. Place it in your RM3 folder, which will be in your install location. drive\Age Of Empires 3\bin\RM3\mapname

Edit: I found an improved version of my desk-top picture on aoe3 heaven. Shoutout to Kyle Leach (10 years later)
Image

original image


Here is a great guide on how to create maps
http://web.archive.org/web/201004211125 ... torial.htm
Attachments
Tutorial RMS.xs
(17.79 KiB) Downloaded 43 times
Tutorial RMS.xml
(518 Bytes) Downloaded 36 times
Check out my Custom Map Workshop here!
viewtopic.php?p=98718#top
User avatar
Japan Aizamk
Lancer
ESOC WarChiefs Classic 2017
Posts: 712

21 Jan 2016, 19:51

Should be x and z :P
Palestine Mimsy for President
Jaeger
Posts: 3680

21 Jan 2016, 20:48

It should have been doable from the scenario editor. F*ck microsoft.
User avatar
United States of America Durokan
ESOC Maps Team
Posts: 894
ESO: Durokan

22 Jan 2016, 00:09

Mimsy for President wrote:It should have been doable from the scenario editor. F*ck microsoft.

its *really* hard to make random maps work in an editor. :c
Though I guess if you didn't want randomness from a gameplay perspective an editor would be fine.

It is kinda disappointing though. :c
Check out my Custom Map Workshop here!
viewtopic.php?p=98718#top
Palestine Mimsy for President
Jaeger
Posts: 3680

22 Jan 2016, 00:36

Durokan wrote:
Mimsy for President wrote:It should have been doable from the scenario editor. F*ck microsoft.

its *really* hard to make random maps work in an editor. :c
Though I guess if you didn't want randomness from a gameplay perspective an editor would be fine.

It is kinda disappointing though. :c
Yeah exactly, I forgot to mention the randomness. But wouldn't it only apply for treasures, herds, mercs etc ? Because the general design would remain the same.
User avatar
United States of America Durokan
ESOC Maps Team
Posts: 894
ESO: Durokan

22 Jan 2016, 01:36

Mimsy for President wrote:
Durokan wrote:
Mimsy for President wrote:It should have been doable from the scenario editor. F*ck microsoft.

its *really* hard to make random maps work in an editor. :c
Though I guess if you didn't want randomness from a gameplay perspective an editor would be fine.

It is kinda disappointing though. :c
Yeah exactly, I forgot to mention the randomness. But wouldn't it only apply for treasures, herds, mercs etc ? Because the general design would remain the same.

everything is randomly generated each time the map is loaded. The curvature of a coast, for example changes every single time you load it unless you set the edge to be perfectly straight. Coding things to be "generally the same" is incredibly hard when using a non-dynamic editor. I guess there could have been some sort of interface that tells a painted area to do something within certain boundaries, but it would have been really, really, hard to do and use a lot of resources that ES thought was better spent on other stuff, like making the game. RMS haven't ever been supported either to my knowledge.

If the game had supported RMS through an editor it would probably have been the equivalent of a scenario, where there is no fluctuation.
Check out my Custom Map Workshop here!
viewtopic.php?p=98718#top
User avatar
Sweden 91
Retired Contributor
Donator 01
Posts: 376

27 Jan 2016, 11:03

What's a good way to place starting mines in a more strict position? For example if one player gets 1 mine in front, and 1 mine a bit further away behind the TC, I want the opponent to get the exact same mine placement to make it fair.

- Is it possible to randomly generate, but mirror the placement for all players?
- Is it possible to strictly place 1 mine in front and 1 mine behind TC? (Or 1 mine to the side, and 1 mine on the other side further away etc.)?

As it is now on the maps, as far as I can see, it's quite random
Insert Signature here...
User avatar
France Rikikipu
ESOC Dev Team
Posts: 1181
ESO: p-of
Location: In your base

27 Jan 2016, 11:13

Remember, you can pretty do whatever you want on rms map, it's just more or less difficult to code.
User avatar
Sweden 91
Retired Contributor
Donator 01
Posts: 376

27 Jan 2016, 12:46

Rikikipu wrote:Remember, you can pretty do whatever you want on rms map, it's just more or less difficult to code.

Yes, this is why I ask :P

Maybe "possible" is the wrong word. Possible without spending countless hours
Insert Signature here...
User avatar
France iNcog
Gendarme
Posts: 9248
ESO: status = SAVED!!1²
Location: LOCATION LOCATION LOCATION

27 Jan 2016, 12:56

91 wrote:
- Is it possible to randomly generate, but mirror the placement for all players?



Cash question right there!
Fear is freedom! Subjugation is liberation! Contradiction is truth!
User avatar
United States of America Durokan
ESOC Maps Team
Posts: 894
ESO: Durokan

27 Jan 2016, 13:44

iNcog wrote:
91 wrote:
- Is it possible to randomly generate, but mirror the placement for all players?



Cash question right there!


I don't know how it works, but Garja uses the function "rmCreatePieConstraint" and that has the ability to put in rmDegreesToRadians, which sounds like it allows something with that constraint to be put in a specific area relation to the spawn location. Example hypothesis code for the first gold constraint:

int startGoldTop= rmCreatePieConstraint("startGold Top", tcLocX, tcLocZ, 0.0, 20.0, rmDegreesToRadians(0), rmDegreesToRadians(90));

Theoretically that should set up an area to have a goldmine placed within a 20 meter radius from the degrees of 0 to 90.

Image

If you were to set up random number generators for the distance between the town center, set up random numbers to select from which quadrant (0-90, 90-180, 180-270, 270-360) you want to place the mines, and keep them the same for both players, it could probably work well. You would then do another mine with the same random distance divided by two or something like that, that also uses the opposite quadrant.
Check out my Custom Map Workshop here!
viewtopic.php?p=98718#top
User avatar
Sweden 91
Retired Contributor
Donator 01
Posts: 376

27 Jan 2016, 14:06

Wow, that's a pretty handy pie function, thanks! :D are there more documentation of these functions (except in the code of course) because I couldn't find this one in the guide in hyena studios.

Anyway I played around a bit without it so I used it like this, maybe uglier, but it works pretty damn well. might just need some map size variable too. south-north team placement in this case:

int k = 1;
if (rmPlayerLocXFraction(i) > 0.5) {
k = -1;
}
rmPlaceObjectDefAtLoc(playerGoldID, 0, rmPlayerLocXFraction(i) + 0.02*k, rmPlayerLocZFraction(i) + 0.02*k);

I managed to get the mines spawning towards the enemy, very close to TC 10 times out of 10, with minimal variation in distance, 1vs1, 2vs2, 3vs3 etc. I'm Just sharing in case anyone else is interested
Insert Signature here...
User avatar
United States of America Durokan
ESOC Maps Team
Posts: 894
ESO: Durokan

27 Jan 2016, 14:14

91 wrote:Wow, that's a pretty handy pie function, thanks! :D are there more documentation of these functions (except in the code of course) because I couldn't find this one in the guide in hyena studios.

Anyway I played around a bit without it so I used it like this, maybe uglier, but it works pretty damn well. might just need some map size variable too. south-north team placement in this case:

int k = 1;
if (rmPlayerLocXFraction(i) > 0.5) {
k = -1;
}
rmPlaceObjectDefAtLoc(playerGoldID, 0, rmPlayerLocXFraction(i) + 0.02*k, rmPlayerLocZFraction(i) + 0.02*k);

I managed to get the mines spawning towards the enemy, very close to TC 10 times out of 10, with minimal variation in distance, 1vs1, 2vs2, 3vs3 etc. I'm Just sharing in case anyone else is interested


Looks good! I don't know of any other documentation, other than I use it to avoid the edges of the map. (only placing things within a radius of .48 of the map in a 360 degree circle) Garja uses it for alot more than I do, check out Kamchatka. I know you asked for stuff outside of a map, but it uses that alot for setting up map areas.
Check out my Custom Map Workshop here!
viewtopic.php?p=98718#top
User avatar
France Rikikipu
ESOC Dev Team
Posts: 1181
ESO: p-of
Location: In your base

27 Jan 2016, 14:16

91 wrote:Wow, that's a pretty handy pie function, thanks! :D are there more documentation of these functions (except in the code of course) because I couldn't find this one in the guide in hyena studios.

Anyway I played around a bit without it so I used it like this, maybe uglier, but it works pretty damn well. might just need some map size variable too. south-north team placement in this case:

int k = 1;
if (rmPlayerLocXFraction(i) > 0.5) {
k = -1;
}
rmPlaceObjectDefAtLoc(playerGoldID, 0, rmPlayerLocXFraction(i) + 0.02*k, rmPlayerLocZFraction(i) + 0.02*k);

I managed to get the mines spawning towards the enemy, very close to TC 10 times out of 10, with minimal variation in distance, 1vs1, 2vs2, 3vs3 etc. I'm Just sharing in case anyone else is interested



In your case you can use FairLoc commands, which are exactly designed for your request. This command is explained in the hyena studio guide.
Here is an example : mineb = mine back ; minef = mine forward

Code: Select all

int mineb=rmAddFairLoc("TownCenter", false, false, 18, 19, 12, 5);

   if(rmPlaceFairLocs())
   {
   mineb=rmCreateObjectDef("mine behind");
   rmAddObjectDefItem(mineb, "mine", 1, 0.0);
   for(i=1; <cNumberNonGaiaPlayers+1)
      {
   for(j=0; <rmGetNumberFairLocs(i))
         {
   rmPlaceObjectDefAtLoc(mineb, i, rmFairLocXFraction(i, j), rmFairLocZFraction(i, j), 1);
         }
      }
   }

int minef=rmAddFairLoc("TownCenter", true, true, 18, 19, 12, 5);

   if(rmPlaceFairLocs())
   {
   minef=rmCreateObjectDef("forward mine");
   rmAddObjectDefItem(minef, "mine", 1, 0.0);
   for(i=1; <cNumberNonGaiaPlayers+1)
   {
   for(j=1; <rmGetNumberFairLocs(i))
   {
   rmPlaceObjectDefAtLoc(minef, i, rmFairLocXFraction(i, j), rmFairLocZFraction(i, j), 1);
   }
   }
   }



You can find all the rms command there : https://mythicfreak.github.io/aomcodere ... mmary.html
User avatar
Italy Garja
ESOC Maps Team
Donator 01
Posts: 4695
ESO: Garja

09 Feb 2016, 16:55

Ye fairlocation is probably the best function here. I never used it tho as I don't think it is worth it to place resources to such detail.
In general I just make sure that mines spawn on opposite sides of the TC so that if one is exposed the other is safe.
Btw pieconstraint normally works with map fractions so need to convert that value in meters or tiles to accomplish the mine thing for TCs.
User avatar
France iNcog
Gendarme
Posts: 9248
ESO: status = SAVED!!1²
Location: LOCATION LOCATION LOCATION

22 Feb 2016, 12:23

Having trouble setting up starting resources for players. Basically if I comment out the lines "if cnumbernongaiaplayers.....", then the map loads fine regardless of the number of players.

However I want to make it so that when there are more than two players, then each player gets an additional starting mine. However adding the "if (cNumber....." bugs out the map.



Code: Select all

      for(i=1; <cNumberPlayers) {
      int id=rmCreateArea("Player"+i);
      rmSetPlayerArea(i, id);
      int startID = rmCreateObjectDef("object"+i);
      rmAddObjectDefItem(startID, "TownCenter", 1, 5.0);
      rmPlaceObjectDefAtLoc(startID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      rmPlaceObjectDefAtLoc(playerStart, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      }
      
      if (cNumberNonGaiaPlayers>3)
      for(i=1; <cNumberPlayers) {
    int id=rmCreateArea("Player"+i);
     rmSetPlayerArea(i, id);
      int startID = rmCreateObjectDef("object"+i);
      rmAddObjectDefItem(startID, "TownCenter", 1, 5.0);
      rmPlaceObjectDefAtLoc(startID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
   rmPlaceObjectDefAtLoc(goldID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
   rmPlaceObjectDefAtLoc(berryID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
   rmPlaceObjectDefAtLoc(treeID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
   rmPlaceObjectDefAtLoc(foodID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
   rmPlaceObjectDefAtLoc(playerStart, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      }   
Fear is freedom! Subjugation is liberation! Contradiction is truth!
User avatar
Sweden 91
Retired Contributor
Donator 01
Posts: 376

22 Feb 2016, 13:16

iNcog wrote:Having trouble setting up starting resources for players. Basically if I comment out the lines "if cnumbernongaiaplayers.....", then the map loads fine regardless of the number of players.

However I want to make it so that when there are more than two players, then each player gets an additional starting mine. However adding the "if (cNumber....." bugs out the map.



Code: Select all

      for(i=1; <cNumberPlayers) {
      int id=rmCreateArea("Player"+i);
      rmSetPlayerArea(i, id);
      int startID = rmCreateObjectDef("object"+i);
      rmAddObjectDefItem(startID, "TownCenter", 1, 5.0);
      rmPlaceObjectDefAtLoc(startID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      rmPlaceObjectDefAtLoc(playerStart, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      }
      
      if (cNumberNonGaiaPlayers>3)
      for(i=1; <cNumberPlayers) {
    int id=rmCreateArea("Player"+i);
     rmSetPlayerArea(i, id);
      int startID = rmCreateObjectDef("object"+i);
      rmAddObjectDefItem(startID, "TownCenter", 1, 5.0);
      rmPlaceObjectDefAtLoc(startID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
   rmPlaceObjectDefAtLoc(goldID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
   rmPlaceObjectDefAtLoc(berryID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
   rmPlaceObjectDefAtLoc(treeID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
   rmPlaceObjectDefAtLoc(foodID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
   rmPlaceObjectDefAtLoc(playerStart, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      }   


Looks like you are missing a pair of brackets. Opening bracket after the "if (cNumberNonGaiaPlayers>3)" and closing bracket after the end of the for loop.

Code: Select all

for(i=1; <cNumberPlayers) {
   int id=rmCreateArea("Player"+i);
   rmSetPlayerArea(i, id);
   int startID = rmCreateObjectDef("object"+i);
   rmAddObjectDefItem(startID, "TownCenter", 1, 5.0);
   rmPlaceObjectDefAtLoc(startID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
   rmPlaceObjectDefAtLoc(playerStart, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
}

if (cNumberNonGaiaPlayers>3) {
   for(i=1; <cNumberPlayers) {
      int id=rmCreateArea("Player"+i);
      rmSetPlayerArea(i, id);
      int startID = rmCreateObjectDef("object"+i);
      rmAddObjectDefItem(startID, "TownCenter", 1, 5.0);
      rmPlaceObjectDefAtLoc(startID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      rmPlaceObjectDefAtLoc(goldID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      rmPlaceObjectDefAtLoc(berryID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      rmPlaceObjectDefAtLoc(treeID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      rmPlaceObjectDefAtLoc(foodID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      rmPlaceObjectDefAtLoc(playerStart, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
   }
}
Insert Signature here...
User avatar
Brazil Buckethead
Retired Contributor
Posts: 357

22 Feb 2016, 13:19

iNcog wrote:Having trouble setting up starting resources for players. Basically if I comment out the lines "if cnumbernongaiaplayers.....", then the map loads fine regardless of the number of players.

However I want to make it so that when there are more than two players, then each player gets an additional starting mine. However adding the "if (cNumber....." bugs out the map.



Code: Select all

      for(i=1; <cNumberPlayers) {
      int id=rmCreateArea("Player"+i);
      rmSetPlayerArea(i, id);
      int startID = rmCreateObjectDef("object"+i);
      rmAddObjectDefItem(startID, "TownCenter", 1, 5.0);
      rmPlaceObjectDefAtLoc(startID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      rmPlaceObjectDefAtLoc(playerStart, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      }
      
      if (cNumberNonGaiaPlayers>3)
      for(i=1; <cNumberPlayers) {
    int id=rmCreateArea("Player"+i);
     rmSetPlayerArea(i, id);
      int startID = rmCreateObjectDef("object"+i);
      rmAddObjectDefItem(startID, "TownCenter", 1, 5.0);
      rmPlaceObjectDefAtLoc(startID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
   rmPlaceObjectDefAtLoc(goldID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
   rmPlaceObjectDefAtLoc(berryID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
   rmPlaceObjectDefAtLoc(treeID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
   rmPlaceObjectDefAtLoc(foodID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
   rmPlaceObjectDefAtLoc(playerStart, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      }   

Not sure, but try to change that:

Code: Select all

if (cNumberNonGaiaPlayers>3)

To that:

Code: Select all

if (cNumberPlayers>2)
User avatar
France iNcog
Gendarme
Posts: 9248
ESO: status = SAVED!!1²
Location: LOCATION LOCATION LOCATION

22 Feb 2016, 14:14

Ah nice, thanks for the suggestions guys. If it's the map not loading it might indeed be a bracket loss. :p

Now atm my map won't load the 8th player in a 4v4

will get back to you guys

edit: no go, doesn't work like i want it to >_<

hmm this will load:

Code: Select all

      for(i=1; <cNumberPlayers) {
      int id=rmCreateArea("Player"+i);
      rmSetPlayerArea(i, id);
      int startID = rmCreateObjectDef("object"+i);
      rmAddObjectDefItem(startID, "TownCenter", 1, 5.0);
      rmPlaceObjectDefAtLoc(startID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      rmPlaceObjectDefAtLoc(playerStart, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      }


Code: Select all

   if(cNumberNonGaiaPlayers==2){
   for(i=1; <cNumberPlayers) {
      int id=rmCreateArea("Player"+i);
      rmSetPlayerArea(i, id);
      int startID = rmCreateObjectDef("object"+i);
      rmAddObjectDefItem(startID, "TownCenter", 1, 5.0);
      rmPlaceObjectDefAtLoc(startID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      rmPlaceObjectDefAtLoc(playerStart, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      }
   }


That one will load as well, though TCs only spawn if there are two players.

If I write this:

Code: Select all

   if(cNumberNonGaiaPlayers==2){
   for(i=1; <cNumberPlayers) {
      int id=rmCreateArea("Player"+i);
      rmSetPlayerArea(i, id);
      int startID = rmCreateObjectDef("object"+i);
      rmAddObjectDefItem(startID, "TownCenter", 1, 5.0);
      rmPlaceObjectDefAtLoc(startID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      rmPlaceObjectDefAtLoc(playerStart, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      }
   }
   else{
   for(i=1; <cNumberPlayers) {
      int id=rmCreateArea("Player"+i);
      rmSetPlayerArea(i, id);
      int startID = rmCreateObjectDef("object"+i);
      rmAddObjectDefItem(startID, "TownCenter", 1, 5.0);
      rmPlaceObjectDefAtLoc(startID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      rmPlaceObjectDefAtLoc(playerStart, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      }
   }
   
   


It doesn't load. ^^
Fear is freedom! Subjugation is liberation! Contradiction is truth!
User avatar
France iNcog
Gendarme
Posts: 9248
ESO: status = SAVED!!1²
Location: LOCATION LOCATION LOCATION

22 Feb 2016, 17:26

I'm confused as to what these lines do btw.

From Cascade Range:

Code: Select all

   // Resource avoidance
   int avoidForestFar=rmCreateClassDistanceConstraint("avoid forest far", rmClassID("Forest"), 40.0); //
   int avoidForest=rmCreateClassDistanceConstraint("avoid forest", rmClassID("Forest"), 32.0); //29.0
   int avoidForestShort=rmCreateClassDistanceConstraint("avoid forest short", rmClassID("Forest"), 20.0); //
   int avoidForestMin=rmCreateClassDistanceConstraint("avoid forest min", rmClassID("Forest"), 4.0);
   int avoidElkFar = rmCreateTypeDistanceConstraint("avoid elk far", "elk", 60.0);
   int avoidElk = rmCreateTypeDistanceConstraint("avoid elk", "elk", 45.0);
   int avoidElkShort = rmCreateTypeDistanceConstraint("avoid elk short", "elk", 30.0);
   int avoidElkMin = rmCreateTypeDistanceConstraint("avoid elk min", "elk", 5.0);
   int avoidBerriesFar = rmCreateTypeDistanceConstraint("avoid berries far", "berrybush", 56.0);
   int avoidBerries = rmCreateTypeDistanceConstraint("avoid  berries", "berrybush", 40.0);
   int avoidBerriesShort = rmCreateTypeDistanceConstraint("avoid  berries short", "berrybush", 30.0);
   int avoidBerriesMin = rmCreateTypeDistanceConstraint("avoid berries min", "berrybush", 10.0);
   int avoidGoldTypeMin = rmCreateTypeDistanceConstraint("coin avoids coin min ", "gold", 10.0);
   int avoidGoldTypeShort = rmCreateTypeDistanceConstraint("coin avoids coin short", "gold", 18.0);
   int avoidGoldType = rmCreateTypeDistanceConstraint("coin avoids coin ", "gold", 26.0);
   int avoidGoldTypeFar = rmCreateTypeDistanceConstraint("coin avoids coin far ", "gold", 50.0);
   int avoidGoldMin=rmCreateClassDistanceConstraint("min distance vs gold", rmClassID("Gold"), 10.0);
   int avoidGold = rmCreateClassDistanceConstraint ("gold avoid gold med", rmClassID("Gold"), 30.0);
   int avoidGoldFar = rmCreateClassDistanceConstraint ("gold avoid gold far", rmClassID("Gold"), 60.0);
   int avoidGoldVeryFar = rmCreateClassDistanceConstraint ("gold avoid gold very far", rmClassID("Gold"), 72.0);
   int avoidNuggetShort = rmCreateTypeDistanceConstraint("nugget avoid nugget short", "AbstractNugget", 40.0);
   int avoidNugget=rmCreateTypeDistanceConstraint("nugget avoid nugget", "AbstractNugget", 40.0);
   int avoidFish=rmCreateTypeDistanceConstraint("avoid fish", "fish", 10.0);
   
   int avoidTownCenterVeryFar=rmCreateTypeDistanceConstraint("avoid Town Center Very Far", "townCenter", 82.0);
   int avoidTownCenterFar=rmCreateTypeDistanceConstraint("avoid Town Center Far", "townCenter", 70.0);
   int avoidTownCenter=rmCreateTypeDistanceConstraint("avoid Town Center", "townCenter", 26.0);
   int avoidTownCenterMed=rmCreateTypeDistanceConstraint(" avoid Town Center med", "townCenter", 24.0);
   int avoidTownCenterShort=rmCreateTypeDistanceConstraint(" avoid Town Center short", "townCenter", 20.0);
   int avoidTownCenterResources=rmCreateTypeDistanceConstraint(" avoid Town Center", "townCenter", 40.0);
   int avoidNatives = rmCreateClassDistanceConstraint("stuff avoids natives", rmClassID("natives"), 8.0);
   int avoidNativesFar = rmCreateClassDistanceConstraint("stuff avoids natives far", rmClassID("natives"), 14.0);
   int avoidStartingResources  = rmCreateClassDistanceConstraint("avoid starting resource", rmClassID("startingResource"), 8.0);
   int avoidStartingResourcesShort  = rmCreateClassDistanceConstraint("avoid starting resource short", rmClassID("startingResource"), 4.0);



From Guinea:

Code: Select all

        int circleConstraint=rmCreatePieConstraint("circle Constraint", 0.5, 0.5, 0, rmZFractionToMeters(0.38), rmDegreesToRadians(0), rmDegreesToRadians(360));
        int circleConstraint2=rmCreatePieConstraint("circle Constraint2", 0.5, 0.5, 0, rmZFractionToMeters(0.405), rmDegreesToRadians(0), rmDegreesToRadians(360));
        int forestConstraint=rmCreateClassDistanceConstraint("forest vs. forest", rmClassID("classForest"), 30.0);
        int forestConstraintShort=rmCreateClassDistanceConstraint("object vs. forest", rmClassID("classForest"), 25);
      int forestConstraintHunt=rmCreateClassDistanceConstraint("river hunts vs. forest", rmClassID("classForest"), 15.0);
        int avoidHunt=rmCreateTypeDistanceConstraint("hunts avoid hunts", "huntable", 50.0);
      int avoidHuntShort=rmCreateTypeDistanceConstraint("hunts avoid hunts", "huntable", 5.0);
        int avoidCoin=rmCreateTypeDistanceConstraint("avoid coin", "Mine", 8.0);
        int avoidCoinMed=rmCreateTypeDistanceConstraint("avoid coin medium", "Mine", 60.0);
        int avoidCoinLong=rmCreateTypeDistanceConstraint("avoid coin medium", "Mine", 75.0);
        int avoidWaterShort = rmCreateTerrainDistanceConstraint("avoid water short", "Land", false, 6.0);
        int avoidWaterReallyShort = rmCreateTerrainDistanceConstraint("avoid water short", "Land", false, 1.0);
        int AvoidWaterShort2 = rmCreateTerrainDistanceConstraint("avoid water short 2", "Land", false, 15.0);
        int AvoidWaterLong = rmCreateTerrainDistanceConstraint("avoid water long", "Land", false, 22.0);
        int avoidTradeRoute = rmCreateTradeRouteDistanceConstraint("objects avoid trade route", 6);
        int avoidTradeRouteSmall = rmCreateTradeRouteDistanceConstraint("objects avoid trade route small", 4.0);
        int avoidSocket=rmCreateClassDistanceConstraint("socket avoidance", rmClassID("socketClass"), 5.0);
        int avoidSocketMore=rmCreateClassDistanceConstraint("bigger socket avoidance", rmClassID("socketClass"), 15.0);
        int avoidTownCenter=rmCreateTypeDistanceConstraint("avoid Town Center", "townCenter", 35.0);
        int avoidTownCenterSmall=rmCreateTypeDistanceConstraint("avoid Town Center small", "townCenter", 15.0);
        int avoidTownCenterMedium=rmCreateTypeDistanceConstraint("avoid Town Center medium", "townCenter", 18.0);
        int avoidTownCenterMore=rmCreateTypeDistanceConstraint("avoid Town Center more", "townCenter", 40.0); 
        int avoidNugget=rmCreateTypeDistanceConstraint("nugget avoid nugget", "AbstractNugget", 60.0);
        int avoidNuggetSmall=rmCreateTypeDistanceConstraint("avoid nuggets by a little", "AbstractNugget", 10.0);
      int AvoidHerdables = rmCreateTerrainDistanceConstraint("avoid herds by something", "herdables", false, 45.0);


I'm guessing it's to make it so that objects placed don't overlap / prevent each other from spawning or something? I have a hard time figuring out how it's implemented exactly. Are all those lines independent from each other?
Fear is freedom! Subjugation is liberation! Contradiction is truth!
User avatar
United States of America musketeer925
ESOC Dev Team
Donator 01
Posts: 1400
ESO: musketeer925

22 Feb 2016, 17:31

iNcog wrote:I'm confused as to what these lines do btw.

I'm guessing it's to make it so that objects placed don't overlap / prevent each other from spawning or something? I have a hard time figuring out how it's implemented exactly. Are all those lines independent from each other?

They're constraints, sort of placement rules for objects. If you look at different object defs, they'll have constraints added to the object definition, and then that object will be placed according to the "rules" that have been added for it.

All the lines are independent.
User avatar
Brazil Buckethead
Retired Contributor
Posts: 357

22 Feb 2016, 17:44

Interesting..
In others programm. language, if only one command, it is not obligatory brackets.

Anyway, use this, probably will work.
(This will do what you want: if more than two players, will give additional resources.)


Nevermind, missing some things.
Let someone experienced RMS do this :?
User avatar
France iNcog
Gendarme
Posts: 9248
ESO: status = SAVED!!1²
Location: LOCATION LOCATION LOCATION

22 Feb 2016, 18:31

musketeer925 wrote:
iNcog wrote:I'm confused as to what these lines do btw.

I'm guessing it's to make it so that objects placed don't overlap / prevent each other from spawning or something? I have a hard time figuring out how it's implemented exactly. Are all those lines independent from each other?

They're constraints, sort of placement rules for objects. If you look at different object defs, they'll have constraints added to the object definition, and then that object will be placed according to the "rules" that have been added for it.

All the lines are independent.


That makes a lot of sense actually.

Code: Select all

   // Starting mines
   int playergoldID = rmCreateObjectDef("player mine");
   rmAddObjectDefItem(playergoldID, "minetin", 1, 0);
   rmSetObjectDefMinDistance(playergoldID, 12.0);
   rmSetObjectDefMaxDistance(playergoldID, 14.0);
   rmAddObjectDefToClass(playergoldID, classStartingResource);
   rmAddObjectDefToClass(playergoldID, classGold);
   rmAddObjectDefConstraint(playergoldID, avoidImpassableLand);
   rmAddObjectDefConstraint(playergoldID, avoidNatives);
   rmAddObjectDefConstraint(playergoldID, avoidStartingResources);


If I look at that example, then it's clear that "rmAddObjectDefConstraint(playergoldID, avoidNatives);" makes it so that the starting mine follows the "avoidNatives" rule. That rule would be set by:

" int avoidNatives = rmCreateClassDistanceConstraint("stuff avoids natives", rmClassID("natives"), 8.0); "

This in turn means that the starting mine will be AT LEAST 8 metres away from an " "rmClassID("natives") ".

That makes sense, thank you. :)
Fear is freedom! Subjugation is liberation! Contradiction is truth!
User avatar
France iNcog
Gendarme
Posts: 9248
ESO: status = SAVED!!1²
Location: LOCATION LOCATION LOCATION

24 Feb 2016, 11:14

iNcog wrote:
My problem


Just wanted to say that I figured this one out!

This is my solution:

Code: Select all

   for(i=1; <9) {
      int id=rmCreateArea("Player"+i);
      rmSetPlayerArea(i, id);
      int startID = rmCreateObjectDef("object"+i);
      rmAddObjectDefItem(startID, "TownCenter", 1, 5.0);
      rmPlaceObjectDefAtLoc(startID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      rmPlaceObjectDefAtLoc(playerStart, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      }

   if (cNumberNonGaiaPlayers!=2){       
   for(i=1; <9) { 
      rmPlaceObjectDefAtLoc(goldID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
      }
   }


I'm not sure why the other solutions did not work, but it seems that if you place the "rmAddObjectDefItem(startID, "TownCenter", 1, 5.0);" twice, then there's some sort of interference. The simple solution is to run the place town center ONCE for all players and then add other resources if there are more than two players. Either way, the map now loads and mines spawn for each player only if there are more than two players (i.e. team game).
Fear is freedom! Subjugation is liberation! Contradiction is truth!
User avatar
United States of America Durokan
ESOC Maps Team
Posts: 894
ESO: Durokan

02 Mar 2016, 18:44

Added a much improved image to the main post courtesy of user "Kyle Leach" on aoe3heaven
(original link)
http://aoe3.heavengames.com/downloads/s ... fileid=435
Check out my Custom Map Workshop here!
viewtopic.php?p=98718#top

Forum Info

Return to “User-created Content”



Who is online

Users browsing this forum: No registered users and 1 guest