 |
|
stankarp
|
|
australia
Feb 2002 time: 05:35
|
|
"The HasGood function returns the database index of the good." Posted by Martin.
I thought it only returned 0-3 for the good type ,eg Landclass Good 1 would return a "0". Good 2 a "1". etc.
Wheres the database index? Cant say I have seen anything that gives each good an id number, except in Goodmod.
Thanks.
|
|
|  |
 |
|
stankarp
|
|
australia
Feb 2002 time: 05:35
|
|
Except of course Goods.txt.
Are you saying Martin that if I use HasGood on a desert tile with oil, it will return 5, the number in CRA_Goods.txt, which I am using now?
|
|
|  |
 |
|
Maquiladora
|
|
quote: The probability for goods of one terrain has to be one at maximum. |
I noticed that you dont need to have it equal 1 from the whole goods on one tile, but say if you put:
code: # Cotton/Flax
TERRAIN_GRASSLAND_GOOD_ONE {
SpriteID 5
Sound SOUND_ID_COTTON
Gold 1
Probability 1
Icon ICON_GOOD_GRASSLAND_ONE
}
# Tobacco
TERRAIN_GRASSLAND_GOOD_TWO {
SpriteID 21
Sound SOUND_ID_TOBACCO
Gold 1
Probability 1
Icon ICON_GOOD_GRASSLAND_TWO
which is probability 1 for both, it will always use the first one in the goods.txt (cotton/flax) and ignore the other one. Not very useful information just something i noticed messing with goodmod.
|
|
|  |
 |
|
Martin Gühmann
|
 |
Berlin, Germany
Mar 2001 time: 06:35
|
|
quote: Originally posted by stankarp
Except of course Goods.txt.
Are you saying Martin that if I use HasGood on a desert tile with oil, it will return 5, the number in CRA_Goods.txt, which I am using now? |
The database index is given by the order of the entries you find in goods.txt, I added these indices in the comments to GM1_Goods.txt, so that I don't need to count the entries everytime I hardencode an Good index into slic everytime, of course instead of hardencoding the indices you could also use the ResourceDB function to get the index of a certain good:
code:
int_t anIndex;
anIndex = ResourceDB(TERRAIN_ARCTIC_MOUNTAIN_GOOD_ONE);
anIndex should after the execution of that piece of code the value 0.
quote: Originally posted by Maquiladora
which is probability 1 for both, it will always use the first one in the goods.txt (cotton/flax) and ignore the other one. Not very useful information just something i noticed messing with goodmod. |
That's right and therefore you can have so many goods for a terrain so that the total summed up probability is greater than 1. Of course you can also have a total summed up probability less then 1. In the second case this is not a problem, but it is a problem in the first case, and therefore the maximum total probability is 1 given you want that the game places all the goods onto the map.
-Martin
|
|
|  |
 |
|
stankarp
|
|
australia
Feb 2002 time: 05:35
|
|
Just checking then, if I use HasGood, it will return 0-3 on a good depending on its class, eg Landgood class 1 would be 0.
If I use anIndex, I can get the exact number of the good from the Resource DB.
"int_t anIndex;
anIndex = ResourceDB(TERRAIN_ARCTIC_MOUNTAIN_GOOD_ONE);
If(anIndex=0){
do stuff}
That be the right syntax?
I was thinking ahead how to get round the 0-3 from HasGood by re-organising the goods so that class 1 is all the luxury type goods, 2 and 3 strategic types and 4 other types. With the help of IW and Peter Triggs I have created a new unit (migrant) and new tile, colony. Among other things the migrant can disband and create a watch tower that also extends borders like a fort. The colony is a normal improvement except it returns 10 gold to the owner each turn. This doubles if this is on any good. The next step is to adjust happiness if it is on a luxury good. By grouping the classes I can just use HasGood, 0 = a luxury good.
However, using the index to get the exact type is very useful.
Thanks.
|
|
|  |
 |
|
stankarp
|
|
australia
Feb 2002 time: 05:35
|
|
Just checking again ,
is this the right syntax to use anIndex?
"int_t anIndex;
anIndex = ResourceDB(TERRAIN_ARCTIC_MOUNTAIN_GOOD_ONE);
If(anIndex=5){
do stuff}
|
|
|  |
 |
|
Peter Triggs
|
|
Gone Fishin, Canada
Jan 2000 time: 05:35
|
|
Generally you want to use this index business when you want to cycle through the whole file/database. So you might have something like:
code:
for (index=0;index<42;index=index+1){ // 42 should be the number of types in goods.txt
if (index == resourceDB(TERRAIN_ARCTIC_MOUNTAIN_GOOD_ONE){ //TRUE when i==0
//do stuff
}
if (index == resourceDB(TERRAIN_ARCTIC_MOUNTAIN_GOOD_TWO){ //TRUE when i==1
//do stuff
}
// and so on
}
Did that special effects thing work? A timer is the last resort.
|
|
|  |
 |
|
stankarp
|
|
australia
Feb 2002 time: 05:35
|
|
Thanks Peter :-)))))
|
|
|  |
 |
|
stankarp
|
|
australia
Feb 2002 time: 05:35
|
|
Trying the speceffects thing tonight.
|
|
|  |
 |
|
stankarp
|
|
australia
Feb 2002 time: 05:35
|
|
Couple of questions re goods please.
Is there a limit of 68 goods in the game. I started getting a DataBase error that I could not figure out until I, eventually, deleted my last good no 69 and all references to it in unitcon, gl strings, terrain.txt etc. Then the errors stopped.
When you right click on a good, where is the name of the good held, ie the string name. I have altered everything to reorganise goods, but when I right click on the good on the map, the names are wrong. The sprite picture is correct, just the name string is wrong. I have altered gl_string.txt, goodsID.txt, gl.txt where the goods appear between <....>. Altered good txt and good.slic(goodmod)
The right click is still showing the old name of that good class on that terrain as far as I can tell.
|
|
|  |
 |
|
stankarp
|
|
australia
Feb 2002 time: 05:35
|
|
I'll try a search but have to be careful as I dont want to muckup the original naming used in other mods.
|
|
|  |
 |
|
stankarp
|
|
australia
Feb 2002 time: 05:35
|
|
I found the offending problem with the wrong names in the right click good function.
In my strings.txt file which I had copied from cradle was a reference to the cradle gl strings txt file which I had not noticed, so it was picking up those first and then going to my new gl strings text file for any missing ones. So my new units were coming up correctly and some goods where there were not old names, were showing. Thats what confused me the most.
Phew:-))
|
|
|  |
All times are GMT. The time now is 05:35. Apolyton Time is 00:35. |
top of page
|
|
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|