 |
|
Turambar
|
|
England
Apr 2002 time: 05:18
|
|
Hey everyone I've been lurking round this forum and trying out mods etc for a few weeks now and I've finally decided to join. Anyway I started learning SLIC today thanks to some of the guides here and it's alot easier than it looks but I've a question (and probably will have a load more soon):
Could somone tell me the expression to use in an if statement when a type of unit is attacked. e.g if an archer is attacked I want x to happen, I just don't know the expression to use in the if () bit.
Thanks!
|
|
|  |
 |
|
Locutus
|
|
ACS CTP1/2 Manager & Civ4 Co-Manager
|
 |
Hengelo, The Netherlands
Nov 1999 time: 06:18
|
|
Well, welcome to the forums, I'm very glad to hear you decided to join and even gladder to see you're interested in SLIC 
The answer to your question is simple. The type of a unit is a unit property and therefore, logically (but unfortunately SLIC isn't always this logical), it is a variable of the unit[0] array. So the expression to use in the if statement would be 'unit[0].type == UnitDB(UNIT_ARCHER)', assuming that you have the unit stored in unit[0].
Note that in this case (an unit in the attack), the logical event to use is 'Battle' (not sure if any others could be used as well). However, from 'Battle' you can't directly access each and every unit involved, you must use army[0] (the attacking army) instead. So you should use the GetUnitFromArmy function to extract the unit(s) from this army before you can check the type.
Let me know if you have any more questions, I love to help (especially with simple questions like this one ).
|
|
|  |
 |
|  |
All times are GMT. The time now is 05:18. Apolyton Time is 00:18. |
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
|
|
|
|
|
|