You must be logged in to post messages.
Please login or register

Scenario Design
Moderated by MosheLevi, Mister SCP

Hop to:    
Welcome! You are not logged in. Please Login or Register.735 replies, Sticky
Age of Empires III Heaven » Forums » Scenario Design » The RMS question Thread
Bottom
Topic Subject:The RMS question Thread
« Previous Page  1 ··· 10 ··· 18 19 20 21 22 ··· 30  Next Page »
RF_Gandalf
Skirmisher
posted 04-27-06 06:09 AM EDT (US)         
This thread is intended for discussion of questions regarding Random Map Scripting for AOE3. Instead of posting questions separately in the forum, use this thread which will serve as a collection of (?)wisdom for those looking for information. I will be checking this thread at least several times per week, and I hope that the other experienced scripters will join in to add their wisdom.

For those seeking some basic starting help, try these links to some helpful information:
The Age of Wiki has a useful section on Random Map Scripting.

An AOE3RMS Tutorial by MOnTy PyThOn is a pretty complete guide to help you understand the various commands.

Finally, try downloading some of the map scripts at the Age of Empires IIIHeaven RMS Download section and open the map scripts in a text editor and check them out to see how it is done. You could also open the map scripts that came with the game to study their commands; these will be found in the directory: Program Files\Microsoft Games\Age of Empires III\rm.

So post any RMS questions here, we will try to help!

AuthorReplies:
sufjanfan
Skirmisher
posted 08-07-10 04:49 PM EDT (US)     476 / 735       
I'm running into a little bug while adding triggers into a random map I am making. The triggers work fine, but they add one extra condition and one extra effect, the default ones ("Always" and "SetIdleProcessing"). I assume there is a quick solution to this I am missing...any ideas?
RiverWalker
Skirmisher
posted 08-07-10 07:03 PM EDT (US)     477 / 735       
I don't see your problem. Are you saying the default condition and effects are firing and causing problems?

~River_God
Good Luck! Have Fun! DON'T DIE!!
Custom Trilogy, DRAW IV, Monopoly 2, Pergatory, Cats and Mice,Custom Colosseums
sufjanfan
Skirmisher
posted 08-07-10 07:10 PM EDT (US)     478 / 735       
Every trigger I add in the script has one extra condition and one extra effect ingame.

Here's an excerpt from my code:
rmCreateTrigger("Move"+i);
rmSwitchToTrigger(rmTriggerID("Move"+i));
rmAddTriggerCondition("Quest Var Check");
rmSetTriggerConditionParam("QuestVar", "PlayerLowestXP");
rmSetTriggerConditionParam("PlayerID", "==");
rmSetTriggerConditionParamInt("PlayerID", i);
rmAddTriggerEffect("Move to Unit");
rmSetTriggerEffectParamInt("SrcObject", rmGetUnitPlacedOfPlayer(stuffID, 0));
rmSetTriggerEffectParamInt("DstObject", rmGetUnitPlacedOfPlayer(TCID, i));
rmSetTriggerEffectParamInt("AttackMove", true);}
This works - it creates the conditions and effects fine, but ingame, the conditions and effects are shown as follows:

Conditions:
Quest Var Check
Always

Effects:
Move to Unit
SetIdleProcessing

I don't know why those are being added on.
RiverWalker
Skirmisher
posted 08-07-10 11:45 PM EDT (US)     479 / 735       
Well, first of all, these lines are wrong unless you modded your typetest (modding it this way wouldn't make sense):

rmSetTriggerConditionParam("PlayerID", "=="); rmSetTriggerConditionParamInt("PlayerID", i);

What you probably actually want is this:

rmSetTriggerConditionParam("Op", "==");
rmSetTriggerConditionParamInt("Value", i);

What I'm thinking is if you're making the triggers wrong, the game would be confused and just set it to default, which may be why the default condition and effect are being added. So, if fixing this doesn't fix your problem, you may want to make sure your Functions are working properly, and your objects are being placed. If the object isn't placed it may not know and give the wrong thing.

Have you play-tested the trigger at all? To make sure the trigger itself is working fine?

~River_God
Good Luck! Have Fun! DON'T DIE!!
Custom Trilogy, DRAW IV, Monopoly 2, Pergatory, Cats and Mice,Custom Colosseums
sufjanfan
Skirmisher
posted 08-08-10 07:53 AM EDT (US)     480 / 735       
Yes, I realised the lines are wrong and fixed them. The problem is happening with all my triggers, and not all of the have to do with the objects. But, I think the problem is not an issue at all, because the conditions list works by the 'and' operator, so an extra always does nothing. The effect also does nothing, since it turns idle processing on.

I'm getting a different problem now though. My triggers don't fire at all. I tried having each one of them have the extra effect of destroying a unit, but none of the units died. It only worked when I deleted all of the triggers except one in the scenario editor.

EDIT: Nvm, I figured out that the problem was the fire event trigger. I'll ask somewhere else.

[This message has been edited by sufjanfan (edited 08-08-2010 @ 08:31 AM).]

Mister SCP
Scenario Reviewer
posted 08-09-10 09:22 AM EDT (US)     481 / 735       
at least in scenarios you cant do the triggernaming that way cause all trigger names need to be set without variables so "move"+i dont work but "move1","move2","move3" works at least in scenarios (else trigger lock). But you can at least call the trigger with variables (fire event)

rmCreateTrigger("Move"+i);

rmCreateTrigger("Move1");


ESO2 Name:Sir_ConstantinESO Name:Sir_Pacman
Trigger Freak and Modder for AOE3

SCP Editor Tools---my map pack---Some incomplete stuff
My trigger Pack

[This message has been edited by Mister SCP (edited 08-09-2010 @ 09:42 AM).]

sufjanfan
Skirmisher
posted 08-09-10 06:29 PM EDT (US)     482 / 735       
In RM scripting, if 'i' is a variable (for example 1), "Move"+i would be "Move1". Are you saying if you create a trigger using this it will lock the trigger up?
RF_Gandalf
Skirmisher
posted 08-09-10 09:40 PM EDT (US)     483 / 735       
Do you really need to rename the trigger each time? I am not an expert on triggers, have no experience with them in scenarios, and have used them in only a few RMS. But maybe you could redo you trigger so that the trigger is called multiple times, each time with the variable i in a 'for' statement to execute the effect for each player.

Here is an example I used in a map script that repeatedly gave extra xp to each player every 60 seconds, using 2 triggers:

rmCreateTrigger("XPShipment");
rmCreateTrigger("XPTimer");

rmSwitchToTrigger(rmTriggerID("XPTimer"));
rmSetTriggerPriority(3);
rmSetTriggerActive(false);
rmSetTriggerRunImmediately(false);
rmSetTriggerLoop(false);
rmAddTriggerCondition("Timer");
rmSetTriggerConditionParamInt("Param1", 60);
rmAddTriggerEffect("Fire Event");
rmSetTriggerEffectParamInt("EventID", rmTriggerID("XPShipment"));

rmSwitchToTrigger(rmTriggerID("XPShipment"));
rmSetTriggerPriority(3);
rmSetTriggerActive(false);
rmSetTriggerRunImmediately(false);
rmSetTriggerLoop(false);
for(i=1; <= cNumberNonGaiaPlayers)
{
rmAddTriggerEffect("Grant Resources");
rmSetTriggerEffectParamInt("PlayerID", i);
rmSetTriggerEffectParam("ResName", "XP");
rmSetTriggerEffectParamInt("Amount", 200);
}
rmAddTriggerEffect("Fire Event");
rmSetTriggerEffectParamInt("EventID", rmTriggerID("XPTimer"));


Why don't you try something like that for your script (and let us know if it works) ?

[This message has been edited by RF_Gandalf (edited 08-09-2010 @ 09:41 PM).]

sufjanfan
Skirmisher
posted 08-10-10 09:29 AM EDT (US)     484 / 735       
I needed a move trigger for each player, and because you can't know that, I had to have a loop define the triggers. Since Mister SCP hinted that that causes problems, I'm just doing this at the beginning of my trigger section.

rmCreateTrigger("Move1");
rmCreateTrigger("Move2");
rmCreateTrigger("Move3");
rmCreateTrigger("Move4");
rmCreateTrigger("Move5");
rmCreateTrigger("Move6");
rmCreateTrigger("Move7");
rmCreateTrigger("Move8");
RiverWalker
Skirmisher
posted 08-10-10 10:48 AM EDT (US)     485 / 735       
I have a little more experience with triggers in RMS, and maybe I just have a different style, but it seems to work. Instead of this:

rmCreateTrigger("Move1");

I make it an integer:

int Move1=rmCreateTrigger("Move Player 1");

And if I needed it for each player I would do it this way:

for(i=1; <=cNumberNonGaiaPlayers){
int Move=rmCreateTrigger("Move Player "+i);
}

Doing it this way makes it harder to call, but if you don't need to Fire it from anywhere else a trigger done this way works perfectly. If you do need to call it for a FireEvent or something, using rmTriggerID("Move Player 1"); might work, but may cause a few problems if you try calling a trigger that doesn't exist. For example trying to call for Player 8 in a 4 player game. Keep this in mind and be careful and you should be fine.

~River_God
Good Luck! Have Fun! DON'T DIE!!
Custom Trilogy, DRAW IV, Monopoly 2, Pergatory, Cats and Mice,Custom Colosseums
sufjanfan
Skirmisher
posted 08-10-10 11:07 AM EDT (US)     486 / 735       
I finally figured out what my real problem was! I have this line in my script:

rmSetTriggerEffectParamInt("AttackMove", true);

When I commented it out, it worked fine. Does anyone know how to set AttackMove to true properly? The line in typetest is this:
<Param name="AttackMove" dispName="$$22416$$Attack Move" varType="bool">false</Param>

[This message has been edited by sufjanfan (edited 08-10-2010 @ 11:09 AM).]

RiverWalker
Skirmisher
posted 08-10-10 11:29 AM EDT (US)     487 / 735       
Since there is no rmSetTriggerEffectParamBool I just do it like a string:

rmSetTriggerEffectParam("AttackMove", "true");

~River_God
Good Luck! Have Fun! DON'T DIE!!
Custom Trilogy, DRAW IV, Monopoly 2, Pergatory, Cats and Mice,Custom Colosseums
sufjanfan
Skirmisher
posted 08-10-10 01:23 PM EDT (US)     488 / 735       
I didn't think that would work. But thanks, I'll try that.

EDIT: It did work. Thank you very much for the help. I have one more (and hopefully final) question. How do I pass an area specification to a trigger via RM?

[This message has been edited by sufjanfan (edited 08-11-2010 @ 02:13 PM).]

DalEk
Skirmisher
posted 08-19-10 04:20 AM EDT (US)     489 / 735       
Hello

I am very new to RMS scripting and have just read M0nTy_PyTh0n's RMS tutorial. I do, however have some questions.

Is there anywhere I can find a full list of all rm functions/variables? Also, while looking through the ES maps, I found many lines of script I did not understand.

e.g:// rmSetMapElevationParameters(long type, float minFrequency, long numberOctaves, float persistence, float heightVariation) What is this and how does it affect my map's elevation?

What are classes?

What is a nugget?

What are sockets and how can I place them?

Why do many commands contain ".........."+i. What value does i have?

Sorry if my questions sound so simple, but I cannot find answers anywhere else, and would be very grateful if you answered my questions.

Thanks
RiverWalker
Skirmisher
posted 08-19-10 11:09 PM EDT (US)     490 / 735       
I'll see what I can do.

First off, if you go in your RM file (or RM3, whichever) and find some .dmp text files, and scroll down a bit, you will get two versions of a full list of xs, rm and c commands, the first one I think just numbers them, the second tells you what the input types are, but doesn't explain them at all. You'll have to get some more experience with the simpler explained commands in the tutorial, then get to experimenting with new ones.

A class is a way of defining a group of things, variables, objects, areas, together. They are used in conjunction with constraints, to help avoid areas overlapping, or TC's trying to place in water.

Nugget=Treasure

Socket=somewhere you can build a Trading Post, like a native site or a Trade Route. Placing them is different depending on which you want to place. For a native site just look at the code for any map in the game, it will have how you place them as a Grouping. Pretty much if you want to know how to make something, check the examples you have already, either in the game or on this site.

A lot of people use i withing for() loops. For example:
for(i=1; <=cNumberNonGaiaPlayers){
some code
}
the i here represents the player number, looping from 1 to the last player. This is used the most so that you can for example create an area for each player without typing the code 8 times and it not even working when there's only 6 players.

Check out the Wiki, it has tons of great info.

~River_God
Good Luck! Have Fun! DON'T DIE!!
Custom Trilogy, DRAW IV, Monopoly 2, Pergatory, Cats and Mice,Custom Colosseums
musketeer925
Skirmisher
posted 08-20-10 10:56 AM EDT (US)     491 / 735       
How do I pass an area specification to a trigger via RM?
The param will be filled with a coordinate, such as "0,0,0" (Without the quotations). At least I'm pretty sure.
RF_Gandalf
Skirmisher
posted 08-20-10 01:15 PM EDT (US)     492 / 735       
DalEk

The elevation command you asked about:
rmSetMapElevationParameters(long type, float minFrequency, long numberOctaves, float persistence, float heightVariation)

This is a way to randomly vary the elevation on the map - it tells the map generator to put some variability into the height of the map. I think you only want to use this on non-water maps. ES never explained the functions but I have played around with it, looked at the way elevation appears in various ES maps, and figured out how to use it.

Here is the elevation parameter statement from Deccan:
rmSetMapElevationParameters(cElevTurbulence, 0.06, 1, 0.4, 3.0);

The first number, the minFrequency, seems to refer to how often the variability is repeated, The numberOctaves exact meaning is unclear. The persistance seems to refer to how big an area stays at a given elevation, and the heightVariation refers to the number of tiles a height can vary from the base height of the map - I think both above and below the base elevation.

To my eye, the 1st, 3rd and 4th of the variables seem to affect the appearance more than the 2nd number. For most maps you could really just use one of these lines from a standard ES map, or leave it out for a flat map.

Play around with a map script and try varying things. You can make a map look really odd by making big changes in the heightVariation.
DalEk
Skirmisher
posted 08-21-10 02:06 AM EDT (US)     493 / 735       
Thanks RiverWalker and RF_Gandalf.

That answers all the questions I have for now.
camo90
Skirmisher
posted 08-23-10 11:39 AM EDT (US)     494 / 735       
On a california style map, I want each player to start with a Mango Grove (ypGroveBuilding). The map loads, but the mango grove doesn't appear. Here is the script I typed, what is missing?

int avoidypGroveBuilding=rmCreateTypeDistanceConstraint("mango groves avoid mango groves", "ypGroveBuilding", 35.0);
----------------------------------------
int startingMangoGroveID=rmCreateObjectDef("Starting Mango Grove");
rmAddObjectDefItem(startingMangoGroveID, "ypGroveBuilding", 1, 0.0);
rmSetObjectDefMinDistance(startingMangoGroveID, 20.0);
rmSetObjectDefMaxDistance(startingMangoGroveID, 22.0);
rmAddObjectDefToClass(startingMangoGroveID, rmClassID("importantItem"));
rmAddObjectDefConstraint(startingMangoGroveID, avoidypGroveBuilding);
rmAddObjectDefConstraint(startingMangoGroveID, avoidTradeRoute);
rmAddObjectDefConstraint(startingMangoGroveID, avoidImportantItem);
rmAddObjectDefConstraint(startingMangoGroveID, avoidAll);
rmAddObjectDefConstraint(startingMangoGroveID, avoidCliff);
rmAddObjectDefConstraint(startingMangoGroveID, avoidImpassableLand);
rmAddObjectDefConstraint(startingMangoGroveID, avoidTownCenter);
rmAddObjectDefConstraint(startingMangoGroveID, playerEdgeConstraint);
rmAddObjectDefConstraint(startingMangoGroveID, longAvoidImpassableLand);

rmPlaceObjectDefAtLoc(startingMangoGroveID, 0, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
RiverWalker
Skirmisher
posted 08-23-10 01:06 PM EDT (US)     495 / 735       
on the third line:

rmAddObjectDefItem... blah

where you have 0.0, change that to like 10. It'll give more room for the grove to find a place to stay.

~River_God
Good Luck! Have Fun! DON'T DIE!!
Custom Trilogy, DRAW IV, Monopoly 2, Pergatory, Cats and Mice,Custom Colosseums
camo90
Skirmisher
posted 08-23-10 01:54 PM EDT (US)     496 / 735       
Unfortunately, it didn't work...
RF_Gandalf
Skirmisher
posted 08-23-10 08:29 PM EDT (US)     497 / 735       
camo90
There are numerous potential problems in your script section. Your whole script is not visible to see all the details needed to know the problem.

First, your placement command:
rmPlaceObjectDefAtLoc(startingMangoGroveID, 0, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
is wrong. You could instead use the line:
rmPlaceObjectDefPerPlayer(startingMangoGroveID, false, 1);
However that method does have the highest success rate in placement. ES never used that type of comand for placing starting units and the most essential resources.

A better and more certain to succeed method of resource placement would be used to place a grove for each player only in a loop that went thru a variable like this(where TCID is the players predefined starting TC):

for(i=1; <cNumberPlayers)
{
rmPlaceObjectDefAtLoc(TCID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
vector TCLoc = rmGetUnitPosition(rmGetUnitPlacedOfPlayer(TCID, i));
rmPlaceObjectDefAtLoc(startingMangoGroveID, i, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
}

Note that the variable i has to replace the 0 in your command so the resource belongs to the player. Also, you must define the vector of the TCLoc that you used.

Yet another style of placing those starting objects is seen the the Bayou map script. Check out the simpler way that is done. Not sure of the difference in placement success between these ways of placing starting objects.

Another potential problem with your script is the large number of constraints for these mango groves. If you are having a problem with objects not always placing(intermittantly, that is), constraints or other objects being placed on top of them are the usual causes. Try remarking out all of your constraints at first (and maybe all objects placed later if that does not work) and if the objects are placed then add the constraints back one or two at a time.

From the look of your constraints, I would wonder about a couple of them - what is the size of your 'avoidTownCenter' constraint?? If that is > or = to the distance the object is to be placed, you will probably not see it.

And RiverWalker's suggestion, while more likely to make the object show up, could give an instance of where one player's grove is 10 tiles closer and another's is 10 tiles farther, which could be seen as unfair.

Let us know what works (or doesn't).

[This message has been edited by RF_Gandalf (edited 08-23-2010 @ 08:30 PM).]

camo90
Skirmisher
posted 08-24-10 01:23 PM EDT (US)     498 / 735       
Ok, I removed two avoid constraints, I replaced the 0 with "i"and I put the mango grove placing variable on top of the starting resources placing variable lines, and now each player has a Mango Grove, it worked. Right now however I have another problem. Take a look at the minimap here
http://i980.photobucket.com/albums/ae290/camo90/screen43.jpg
When I designed this map I wanted forest to stay in the grassy area and mines to stay in the desert, while huntable could stay both in the desert and in the grass. However, as you see by the picture, animals tend to gather in just two points, while there are empty portions of the map. Moreover, I'd like mines to be more, so should I change
rmAddObjectDefItem(goldID, "minegold", 2, 0.0);
with rmAddObjectDefItem(goldID, "minegold", 5, 0.0);?
That's because I did it, but they didn't grow considerably in number, they seem the same... and forest, sometimes covers wide areas, sometimes it doesn't... Since I'd have to post too much script here, if you need to have the map file I'll post a download link for you, thank you for your help and your time
RF_Gandalf
Skirmisher
posted 08-24-10 08:24 PM EDT (US)     499 / 735       
camo90 -
Well, your statements:
rmAddObjectDefItem(goldID, "minegold", 2, 0.0);
rmAddObjectDefItem(goldID, "minegold", 5, 0.0);
will not add more gold. What you tried to do with those lines was to put more mines in a group(adding objects to a group), but the 0.0 is the diameter of the group so only a single one places. If your statement said:
rmAddObjectDefItem(goldID, "minegold", 5, 12.0);
you would get 5 mines in a diameter of 12 tiles.

Anyway, you need additional statements that actually place the mines. What is the placement statement you are using for the mines? After defining your 'goldID', I would try:
rmPlaceObjectDefPerPlayer(goldID, false, 1); to get one mine per player. Or use that line twice to get 2 mines per player. or use the line:
rmPlaceObjectDefPerPlayer(goldID, false, 2);
to place 2 mines per player. The concern is that your constraints, such as having mines avoid players and other mines, eventually cause some to be dropped.

You might want to define more than one set of mines (like a farGoldID and a medGoldID) with differing distances from the players and other objects or areas or terrain.

You could, if you desired, place them all at a long, minimum distance from the sea using a constraint vs water.

Another way to place the mines would be to place them in a defined location using the map coordinates. This command would place 1 defined 'extraMineID' at the map center:
rmPlaceObjectDefAtLoc(extraMineID, 0, 0.5, 0.5, 1);

The last suggestion would be to place them in a defined area. For example if you wanted to place objects in an area far from the water, create an area (say, called interiorID) with a long constraint from water, then place them in that area with the statement:
rmPlaceObjectDefInArea(goldID, 0, rmAreaID("interiorID"), 3);
to place 3 mines in the area. You would have to experiment with the size, distances, constraints etc for the area as well as the mine objects.

Sorry, I would like to help further but I will not have time to specifically look at your map script.
camo90
Skirmisher
posted 08-25-10 09:10 AM EDT (US)     500 / 735       
Ok ok you don't have to, I solved the problems myself: I incremented the gold mines as you suggested, then I succeeded in eliminating the overpopulation of huntable by changing from:
{
rmPlaceObjectDefAtLoc(deerID, 0, 0.5, 0.5, 4*cNumberNonGaiaPlayers);
rmPlaceObjectDefAtLoc(elkID, 0, 0.5, 0.5, 5*cNumberNonGaiaPlayers);
}
to
{
rmPlaceObjectDefAtLoc(deerID, 0, 0.5, 0.5, 2.5*cNumberNonGaiaPlayers);
rmPlaceObjectDefAtLoc(elkID, 0, 0.5, 0.5, 2*cNumberNonGaiaPlayers);
}

I'm not sure of what that number means, maybe how many herds should be per player?

And finally I adjusted the forest reducing the range of its size variation.
« Previous Page  1 ··· 10 ··· 18 19 20 21 22 ··· 30  Next Page »
You must be logged in to post messages.
Please login or register

Hop to:    

Age of Empires III Heaven | HeavenGames