[Solved] Need help with RM xs file modding

Here you can post about your scenario's, mods, custom maps and YouTube channels!
User avatar
No Flag GruntGG
Crossbow
Posts: 23
Joined: Apr 20, 2016
ESO: Kenob

[Solved] Need help with RM xs file modding

Post by GruntGG »

Hello fellow players and modders,

I write here to ask for your help on modding a RM xs file. I am currently working on a new version of "Lost" map (based on "Unknown" map) and although my knowledge of scripting is very limited, I had some success in some improvements. However, there are some changes that I am trying to implement that do not work and I have no idea why :unsure:

To be more precise: I am working on the natives section of the map and I would the map to have native villages randomly chosen within the whole pool of natives (all possible native tribes excluding Aztecs, Iroquois and Lakota). So far I have managed to have all of them working except for Jesuit, Shaolin and Zen, which for some weird reason do not accept the same script lines used for the rest of natives (which include Sufi and Udasi). Since the whole section with all native possibilities is very long, I attach a shorter version including only Jesuit, Shaolin, Zen and Zapotec (see Spoiler). Zapotec is functional and works as a control. This is just a fragment of the whole file, but all the native stuff should be included in this fragment. Right now if I play this map all the native villages are Zapotec 100% of the time. :sad:

[spoiler=spoiler]// ============= Choose Natives =============
int JesuitVillageID = -1;
int ShaolinVillageID = -1;
int ZapotecVillageID = -1;
int ZenVillageID = -1;

float nativeChance = -1;

int nativeNumber = rmRandInt(10,12);


rmEchoInfo("Native number = "+nativeNumber);

rmAllocateSubCivs(nativeNumber);

// For each native, randomly determine tribe

for(i = 0; <nativeNumber)
{
nativeChance = rmRandInt(0,4);

if(nativeChance < 1)
{
rmSetSubCiv(i, "Jesuit");
rmEchoInfo("subCiv"+i+" is Jesuit");
JesuitVillageID = rmCreateGrouping("Jesuit mission A"+i, "native jesuit mission borneo"+rmRandInt(1,5));
rmSetGroupingMinDistance(JesuitVillageID, 0);
rmSetGroupingMaxDistance(JesuitVillageID, rmXFractionToMeters(0.45));
rmAddGroupingToClass(JesuitVillageID, rmClassID("natives"));
rmAddGroupingConstraint(JesuitVillageID, avoidImpassableLand);
rmAddGroupingConstraint(JesuitVillageID, avoidTradeRoute);
rmAddGroupingConstraint(JesuitVillageID, avoidTradeRouteSocket);
rmAddGroupingConstraint(JesuitVillageID, nativesAvoidPlayers);
rmAddGroupingConstraint(JesuitVillageID, avoidNatives);
rmAddGroupingConstraint(JesuitVillageID, avoidCanyon);
rmAddGroupingConstraint(JesuitVillageID, edgeConstraint);
rmPlaceGroupingAtLoc(JesuitVillageID, 0, 0.5, 0.5);
}
else if(nativeChance < 2)
{
rmSetSubCiv(i, "Shaolin");
rmEchoInfo("subCiv"+i+" is Shaolin");
ShaolinVillageID = rmCreateGrouping("Shaolin temple A"+i, "native shaolin temple "+rmRandInt(1,5));
rmSetGroupingMinDistance(ShaolinVillageID, 0);
rmSetGroupingMaxDistance(ShaolinVillageID, rmXFractionToMeters(0.45));
rmAddGroupingToClass(ShaolinVillageID, rmClassID("natives"));
rmAddGroupingConstraint(ShaolinVillageID, avoidImpassableLand);
rmAddGroupingConstraint(ShaolinVillageID, avoidTradeRoute);
rmAddGroupingConstraint(ShaolinVillageID, avoidTradeRouteSocket);
rmAddGroupingConstraint(ShaolinVillageID, nativesAvoidPlayers);
rmAddGroupingConstraint(ShaolinVillageID, avoidNatives);
rmAddGroupingConstraint(ShaolinVillageID, avoidCanyon);
rmAddGroupingConstraint(ShaolinVillageID, edgeConstraint);
rmPlaceGroupingAtLoc(ShaolinVillageID, 0, 0.5, 0.5);
}
else if(nativeChance < 3)
{
rmSetSubCiv(i, "Zapotec");
rmEchoInfo("subCiv"+i+" is Zapotec");
ZapotecVillageID = rmCreateGrouping("zapotec village "+i, "native zapotec village "+rmRandInt(1,5));
rmSetGroupingMinDistance(ZapotecVillageID, 0);
rmSetGroupingMaxDistance(ZapotecVillageID, rmXFractionToMeters(0.45));
rmAddGroupingToClass(ZapotecVillageID, rmClassID("natives"));
rmAddGroupingConstraint(ZapotecVillageID, avoidImpassableLand);
rmAddGroupingConstraint(ZapotecVillageID, avoidTradeRoute);
rmAddGroupingConstraint(ZapotecVillageID, avoidTradeRouteSocket);
rmAddGroupingConstraint(ZapotecVillageID, nativesAvoidPlayers);
rmAddGroupingConstraint(ZapotecVillageID, avoidNatives);
rmAddGroupingConstraint(ZapotecVillageID, avoidCanyon);
rmAddGroupingConstraint(ZapotecVillageID, edgeConstraint);
rmPlaceGroupingAtLoc(ZapotecVillageID, 0, 0.5, 0.5);
}
else
{
rmSetSubCiv(i, "Zen");
rmEchoInfo("subCiv"+i+" is Zen");
ZenVillageID = rmCreateGrouping("Zen temple A"+i, "native zen temple "+rmRandInt(1,5));
rmSetGroupingMinDistance(ZenVillageID, 0);
rmSetGroupingMaxDistance(ZenVillageID, rmXFractionToMeters(0.45));
rmAddGroupingToClass(ZenVillageID, rmClassID("natives"));
rmAddGroupingConstraint(ZenVillageID, avoidImpassableLand);
rmAddGroupingConstraint(ZenVillageID, avoidTradeRoute);
rmAddGroupingConstraint(ZenVillageID, avoidTradeRouteSocket);
rmAddGroupingConstraint(ZenVillageID, avoidPlayers);
rmAddGroupingConstraint(ZenVillageID, avoidNatives);
rmAddGroupingConstraint(ZenVillageID, avoidCanyon);
rmAddGroupingConstraint(ZenVillageID, edgeConstraint);
rmPlaceGroupingAtLoc(ZenVillageID, 0, 0.5, 0.5);
}
}


// Text
rmSetStatusText("", 0.6);[/spoiler]

Assistance needed:
- Could anyone tell me what changes to make in order to have Jesuit, Shaolin and Zen working? SOLVED
- Could anyone tell me how to restrict the number of times a certain native tribe appear in the map to 1 or 2 (to prevent that if there are 10 native villages, 5 of them would be Huron and instead have more variety)? SOLVED

Please let me know if you need any further information.

Thank you for your help! :smile:

GruntGG (Kenob)
User avatar
France Rikikipu
Retired Contributor
Posts: 1679
Joined: Feb 27, 2015
ESO: p-of
Location: In your base

Re: Need help with RM xs file modding

Post by Rikikipu »

Hey @GruntGG
Yep Shaolin, Jesuit and Zen have a another kind of name.
You can find my Unknown map version there, i'm pretty sure it will help you ;) : viewtopic.php?f=33&t=698
User avatar
No Flag GruntGG
Crossbow
Posts: 23
Joined: Apr 20, 2016
ESO: Kenob

Re: Need help with RM xs file modding

Post by GruntGG »

Hey @Rikikipu
Thank you very much for your reply and for letting me know about your Unknown map version. It will be great fun to play in it and I can now base my new Lost map version in it since you fixed some of the issues I wanted to take care of (hunts, natives and water). Using the same commands as you for the natives now it works. I noticed you forgot about the Apache but that could be quickly added.

That takes care of the first issue that I had.

As for the second one: How to restrict the number of times a certain native tribe appear in the map to a maximum of 2? Could anyone tell me how to do it? I want to have variety of native tribes so it is not good if I get too many native villages from the same tribe.

Thanks again! :smile:
User avatar
France Rikikipu
Retired Contributor
Posts: 1679
Joined: Feb 27, 2015
ESO: p-of
Location: In your base

Re: Need help with RM xs file modding

Post by Rikikipu »

@GruntGG
I've added your limit conditions in this update. Take care, you need to add/edit for the apache tps ;)
Attachments
Unknown_v2,61.xs
(69.2 KiB) Downloaded 31 times
Unknown_v2,61.xml
(715 Bytes) Downloaded 19 times
User avatar
No Flag GruntGG
Crossbow
Posts: 23
Joined: Apr 20, 2016
ESO: Kenob

Re: Need help with RM xs file modding

Post by GruntGG »

Thank you so much @Rikikipu !! :biggrin:

I'm doing the final adjustments and very soon I will have ready the latest Lost map, Lost 5! I will post it here when it will be ready :mrgreen:

Both your version of the unknown map and your comments have been really helpful.

Cheers!

GruntGG (Kenob)
User avatar
No Flag GruntGG
Crossbow
Posts: 23
Joined: Apr 20, 2016
ESO: Kenob

Re: [Solved] Need help with RM xs file modding

Post by GruntGG »

And done, see /viewtopic.php?f=33&t=6275

Who is online

Users browsing this forum: No registered users and 3 guests

Which top 10 players do you wish to see listed?

All-time

Active last two weeks

Active last month

Supremacy

Treaty

Official

ESOC Patch

Treaty Patch

1v1 Elo

2v2 Elo

3v3 Elo

Power Rating

Which streams do you wish to see listed?

Twitch

Age of Empires III

Age of Empires IV