 |
|
child of Thor
|
|
If balanced nicely,say just a one or two extra squares viewing distance, then it would be a good feature to have. Hmmmm, a z dimension in CTP2 terrain? I've no idea, but could be easy to do i guess. Just as units get a bonus defence when on mountains i suppose you could just add a bonus to units view range in the same way?
|
|
|  |
 |
|
Maquiladora
|
|
So it could be done. Would it slow the game down to a crawl with all that extra weight in the Units.txt files etc?
|
|
|  |
 |
|  |
 |
|
ahenobarb
|
|
quote: Originally posted by Martin Gühmann
Actual this is the harder way, first you have to create the tile improvement, but then it isn't finished so you need a second event to finish it, until tehn the unit left the mountain. Then you can only build a tile improvement on land with an owner so you would have to give the land to the civ to which the units belongs. So it would only effective to use the test tile improvement of GoodMod for it. You couldn't pillage without huge problems the tile improvement afterwards. And if you pillage the location you will remove all the tile improvements at that place. So I would say it is possible to do it this way but the price is too high.
-Martin |
Couldn't you just reach into the structure of each unit to the visionrage through a .slc? it seems that all you would need to do (And I haven't fully undertaken learning all the .slc variables) is write a .slc that says in essence:
While terrain = mountain or hills (In another .slc project I was reading about the land was being checked to see who was the owner in order to influence the movement rate, so it seems this could be done),
UNIT_[TYPE or whatever the varible should be].visionrage = UNIT_TYPE.visionrange + 1
Last edited by ahenobarb on 24-07-2002 at 21:37
|
|
|  |
 |
|
Martin Gühmann
|
 |
Berlin, Germany
Mar 2001 time: 06:21
|
|
quote: Originally posted by ahenobarb
You guys are the experts in this, but in looking at the units.txt file, all the units are set up as C structures. As you know any C structure element can be access by referencing the structure name adding the structure member operator (i.e. '.' ) and the name of the structure element you want to access (in this case, for example "UNIT_ARCHER.visionrange" Visionrange is one of the elments in a unit structure listed in units.txt). Once you have refenced the specific element you want, you should be able to change it.
What I don't know is whether you can do this with .slc I'm not certain if .slc only let's you use the variables that are named in the modification section of the CTP2 portion of this site. Or, if once you know a structure name, you can access that structure just like a C strucutre through the .slc file.
|
Would it is such easy then you have to answer me this question: Why we need such a function to add additional movement points:
AddMovement
Another question would be what do you exactly change if you use the dot operator, do you change just the vision range of one particular unit or would it rather change the vision range of all the units of the same type. Of course I didn't tryed it, so at least I will try it afterwards I finished my GOTM, finished GoodMod1 v.1.0 and started with GoodMod2, there such a thing would be very helpfull if it work.
-Martin
|
|
|  |
 |
|
Peter Triggs
|
|
Gone Fishin, Canada
Jan 2000 time: 05:21
|
|
Here's the problem:
quote:
SLIC provides direct read-only access to much of the data contained in the game databases.
|
Also, although it's written that you can access many fields from the databases (using dot notation) this only seems to work for the UnitDB. Every time I've tried a different one (even using the examples that were given in the documentation), I get a syntax error. So it looks to me that this was something that was intended to be included but didn't get finished. It's a pity, being able to access the fields in strategies.txt and diplomacy.txt would be very useful.
|
|
|  |
 |
|
ahenobarb
|
|
quote: Originally posted by Peter Triggs
Here's the problem:
Also, although it's written that you can access many fields from the databases (using dot notation) this only seems to work for the UnitDB. Every time I've tried a different one (even using the examples that were given in the documentation), I get a syntax error. So it looks to me that this was something that was intended to be included but didn't get finished. It's a pity, being able to access the fields in strategies.txt and diplomacy.txt would be very useful. |
I read through the SLIC documentation yesterday and saw that same passage. However, in the 10 minutes I had free last night, I tried my hand at it. I expected that I would get an error, but it should point me to the proper solution.
However, that one part I thought wasn't in error apparantly was. The error message said: "No TERRAIN_HILL in the TerrainDB" "No TERRAIN_MOUNTAIN in the TerrainDB" (I had referenced both with TerrainDB(TERRAIN_XXXX))
I haven't had anytime to look at it again, but that struck me as odd. Unless the Terrain.txt is not considered the TerrainDB, I don't know what is wrong.
Any ideas?
|
|
|  |
 |
|  |
 |
|
ahenobarb
|
|
quote: Originally posted by Locutus
That's odd, ahenobarb, I did the same thing just now and got a syntax error, just like Peter. Are you sure you didn't make any typos or anything silly like that? If not, could you post your code, so others can see they can reproduce and explain it?
Aside from that, it's good to know we have an experienced programmer looking into SLIC again. We desperately need people like you |
It was a case-sensitivity issue. i was rushing out the door and didn't get time to fool around to check it.
Anyway, here's the SLIC I did for this:
HandleEvent(MoveUnits) 'IncreaseVision' post {
unit_t tmpUnit;
While(tmpUnit.location == 8 ||
tmpUnit.location == 9 ||
tmpUnit.location == 18 ||
tmpUnit.location == 19 ||
tmpUnit.location == 20 ||
tmpUnit.location == 21 )
{
tmpUnit.visionrange = tmpUnit.visionrange + 1;
}
}
}
However, when I load it up, CTP2 tells me "Visionrange is not a member of tmpUnit".
So from this I believe I have learned the only parts of the unit array that can be used are:
unit.owner - the unit's owner
unit.location - the unit's location
unit.type - the unit's database index
unit.hp - the unit's remaining hit points
unit.valid - true if the unit still exists, false otherwise
unit.name - the unit's name, only useful in string replacements
|
|
|  |
 |
|
Martin Gühmann
|
 |
Berlin, Germany
Mar 2001 time: 06:21
|
|
quote: Originally posted by ahenobarb
It was a case-sensitivity issue. i was rushing out the door and didn't get time to fool around to check it.
Anyway, here's the SLIC I did for this:
HandleEvent(MoveUnits) 'IncreaseVision' post {
unit_t tmpUnit;
While(tmpUnit.location == 8 ||
tmpUnit.location == 9 ||
tmpUnit.location == 18 ||
tmpUnit.location == 19 ||
tmpUnit.location == 20 ||
tmpUnit.location == 21 )
{
tmpUnit.visionrange = tmpUnit.visionrange + 1;
}
}
}
However, when I load it up, CTP2 tells me "Visionrange is not a member of tmpUnit". |
Some notes about the code, the MoveUnits event has two location variables and an army variable in its context. You can take access with army[0] on the army variable. (See the slic documentation which variables are in the context) If you now want to take access on the units of the army you have to use the GetUnitByIndex function within a for loop. It is also possible to get the army size, the best thing here is to consult the various slic files and the slic documentation for examples. So your temporary unit variable actual contains nothing.
Another problem I see in your code is the while loop: As your handler is a post handler the code will be executed after the move event was done. The event is called everytime a unit moves from one tile to its adjacent tile. Once the army is on the hill for instance the condition in the while loop is true and the while loop will be executed until the army leaves the hill. But the next MoveUnits event want be called until the your code was be executed. So once the condition in the while loop is true it will be always true. And the loop turned in an endless loop.
quote: Originally posted by ahenobarb
So from this I believe I have learned the only parts of the unit array that can be used are:
unit.owner - the unit's owner
unit.location - the unit's location
unit.type - the unit's database index
unit.hp - the unit's remaining hit points
unit.valid - true if the unit still exists, false otherwise
unit.name - the unit's name, only useful in string replacements |
These ones does work with the unit array, for the other ones you have to use the unitrecord array. See the Great Library for some example code about this although I think the GL is not the best place to find examples.
Even if it takes some time to learn slic, don't give up keep on trying. 
-Martin
|
|
|  |
 |
|
Martin Gühmann
|
 |
Berlin, Germany
Mar 2001 time: 06:21
|
|
quote: Originally posted by ahenobarb
Thanks, Martin. I dumped the GetUnitsByIndex even though I saw an example using that. I figured, if I really needed it, CTP2 would say something when I started the game and it spat out its error messages. It didn't say anything when I dropped it, so I figured I didn't need it. Guess I was wrong.
While loop: I thought that might be the case, but figured I'd cross that bridge when/if I ever saw the visionrange actually increase.
I'll check the GL. Thanks again. |
There are two kinds of errors that can you code contain. On the one hand syntax errors on the other hand semantic errors. The syntax errors are the easier ones, because you will get an error message, even if slic error messages could give you more pieces of information. But the semantic errors are the ones that are much harder to detect, because the syntax is ok but the content is the problem. The only symptom that you notice is that your code doesn't do the stuff that it is supposed to do, and now you have to search why.
Here is an example in English:
code:
The only symptom code is that doesn't do the stuff that it is supposed and now have why.
You see I just deleted some words of my last sentece and you don't get the content, but nevertheless all the words I used are valid English words and also the form should be correct, capital letter on the beginning a dot at the end, and the grammer is ok more or (rather) less correct.
-Martin
|
|
|  |
 |
|  |
All times are GMT. The time now is 05:21. Apolyton Time is 00:21. |
top of page
|
| archivepost |
|
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
|
|
|
|
|
|