Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Civilization: Call To Power > CtP-Creation > SLIC - Units in City
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!
12.Sep: `CTP CHALLENGE LADDER` - SEPTEMBER UPDATE
09.Sep: EARLY BUILD SPRITE EDITOR
02.Aug: `SUPERLEAGUE` SIGN-UP

bottom of page
  - CIVILIZATION: CALL TO POWER @ GAMESTOP $9.99 - CIVILIZATION: CALL TO POWER @ AMAZON $9.99
Author
Thread   
Pages (2): [ 1   2   ]
< Last Thread     Next Thread > Post New Thread     Post A Reply
Dreamer is offline Dreamer
Chieftain
Singapore
Dec 1999
time: 05:13
Thumbs down  Old Post 05-01-2000 10:53 Visit Dreamer's homepage!
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
SLIC - Units in City Support Apolyton, pre-order Civilization IV

I was day dreaming in the office and came out this trigger and quickly started scripting once I reached home. It is suppose to show the number of combat units in a city.

code:
Trigger 'CheckCityUnits' when (city.selected) { cityunits = city.combatunits; Message(player, 'CheckCityUnitsMessage'); } Alertbox 'CheckCityUnitsMessage' { Text(ID_CHECK_CITY_UNITS_MESSAGE); Button(ID_BUTTON_CLOSE) { Kill(); } }


The following should be in scen_str.txt
code:
CHECK_CITY_UNITS_MESSAGE "There are [cityunits.value] in the city of [city.name]."

It was tested and working fine but .... damn!!! I CAN'T CLICK ON THE ENEMY CITY.

[This message has been edited by Dreamer (edited January 05, 2000).]

Dreamer is offline Dreamer
Chieftain
Singapore
Dec 1999
time: 05:13
Thumbs down  Old Post 05-01-2000 14:07 Visit Dreamer's homepage!
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Full PM-box? Change here!

Here's another trigger in replacement of the above one. This time it report the no. of units in the city upon entering a enemy city.

code:
Trigger 'CheckCityUnits' when (special.singlecombat && (unit.2.location == city.location) && IsHumanPlayer(g.player)) { // This line is continous of the above. cityunits = UnitsInCell(unit.2.location); Message(g.player, 'CheckCityUnitsMessage'); } Alertbox 'CheckCityUnitsMessage' { Text(ID_CHECK_CITY_UNITS_MESSAGE); Button(ID_BUTTON_YES) { Kill(); } Button(ID_BUTTON_NO) { ClearOrders(unit); Kill(); } }

I am still trying a way to get the unit.2.location to check if the units are in a city.

[This message has been edited by Dreamer (edited January 05, 2000).]

skorpion59 is offline skorpion59
Prince
Tulsa, Oklahoma, USA
May 1999
time: 23:13
Post  Old Post 05-01-2000 15:09 Visit skorpion59's homepage!
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Support Apolyton or Terrorists Win

Dreamer,

Wouldn't there be no units in a city when you enter it. If it had units in it, you wouldn't be able to enter it.

Don

Dreamer is offline Dreamer
Chieftain
Singapore
Dec 1999
time: 05:13
Wink  Old Post 05-01-2000 17:47 Visit Dreamer's homepage!
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Increase the size of your Attachments

Skorpion59,

The special.singlecombat will trigger only when 2 parties units start a battle, so if the city does not have any unit in it, this trigger will not happen.

When there is units in it, the trigger activate and popup and message box telling you the number of units in the city. I'll have an option to choose YES or NO to continue.

If you choose no, the ClearOrders(unit) will clear the previous order given, but I think you'll lose some movement points for doing that.

skorpion59 is offline skorpion59
Prince
Tulsa, Oklahoma, USA
May 1999
time: 23:13
Post  Old Post 05-01-2000 23:13 Visit skorpion59's homepage!
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Support Apolyton, buy Civilization: The Boardgame

Dreamer,

WOW, that is a slick. What a good idea. I have to try this out. Keep up the work.

Don

Dreamer is offline Dreamer
Chieftain
Singapore
Dec 1999
time: 05:13
Thumbs down  Old Post 06-01-2000 00:41 Visit Dreamer's homepage!
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Suffering from ads?

Skorpion59,

Sorry the trigger still not working, if you look closely in the codes (unit.2.location == city.location), there is still no reference to the city.location.

Need to check the units are in a city location tile.

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:13
Post  Old Post 06-01-2000 01:57 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Support Apolyton buy from Amazon

At first I didn't know exactly what you were trying to do, but now I understand (and have the time to respond). I can see one possible solution: check all cities of unit.2 and compare their locations with unit.2.location.
If this is possible at all (it might be tricky because SLIC by my knowledge doesn't have arrays - apart from city.1, city.2, city.3, etc.) this trigger can also be adapted to check the contents of a stack/city. Instead of displaying the number of cities, just cycle through all player.2's unit's to check if their at unit.2.location and then display them.
I'll look at this problem of checking all cities as soon as I find the time.

BTW You can prevent loosing movement-points by using AddMovement(1, unit).

Locutus

P.S. These triggers will both probably be very slow, but that doesn't really matter because it's only used by human players, so the player knows what he is waiting for.

skorpion59 is offline skorpion59
Prince
Tulsa, Oklahoma, USA
May 1999
time: 23:13
Post  Old Post 06-01-2000 17:10 Visit skorpion59's homepage!
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Tired of ads?

Dreamer,

I really like this option so I modified your code slightly. Nothing like cheating without going into cheat mode.

This shows how many units are in a city (by single clicking on the city) and then gives you the option to open the Diplomacy screen. It has been thoroughly tested.

Script.slc code: (with 1st line split to be narrower)

code:
TypeLocation location5; Trigger 'CheckCityUnits' when ((IsHumanPlayer(g.player)) && (clicked.city) && (city.owner != g.player)) { location5 = city.location; cityunits = UnitsInCell(location5); Message(g.player, 'CheckCityUnitsMessage'); } // // Alertbox 'CheckCityUnitsMessage' { Text(ID_CHECK_CITY_UNITS_MESSAGE); Button(ID_BUTTON_CLOSE) { Kill(); } Button(ID_BUTTON_DIPLOMATIC_MENU) { OpenDiplomacy(); Kill(); } }


Scen.str code: (split to be narrower)
code:
CHECK_CITY_UNITS_MESSAGE "There are [cityunits.value] units in the city of [city.name]."


This is really way to powerful. I'm thinking about putting a counter in so it can only be used every so many rounds. I can modify this to make a version like you started with (only popping up when a battle starts). Also, it could be modified to tell you how many units are in a stack. Like I said, too much power here.

Side note:
As is, you have to click on the terrain somewhere (to deselect everything) before you click once on the city. If not, or if you click twice on the city, it automatically opens the Diplomacy menu.

Don

UPDATE:
I guess you will have to narrower your code above to narrow this thread.

[This message has been edited by skorpion59 (edited January 06, 2000).]

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:13
Post  Old Post 06-01-2000 17:40 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#9 Report this post to a moderator
Remove this text

Hi guys,

I've been working on this thing last night as well, but then on another version: here's a crude and untested first try to make a spy unit check a stack/city and show its contents.
I've got one question already before I start testing this: Are you sure special.singlecombat works? According to the documentation single.combat involves two single units (so no stacks). If this is true we will have to add | | special.stackedcombat to the when-clause of the trigger.

code:
Trigger 'CheckStackContents' when (special.singlecombat && IsHumanPlayer(g.player) && UnitHasFlag(unit.1, VISIBILITY_CAN_SEE_4) ) { // continued from above Message(g.player, 'CheckCityUnitsMessage'); } // in this alertbox all units will be checked, if they are at the same location as unit.2, // then they are added to the unit.array at the first available spot // (he, this actually resembles programming ) Alertbox 'CheckStackContentsMessage' { i = 0; number = 4; // 1 stands for inspecting unit (e.g. Spy), 2 for inspected unit // and 3 for temporary unit (see later), so 4 is the first available spot to start with while (i < player.totalunits) { SetUnitByIndex(3, unit.2.owner, i); // temporary unit (see above) if (unit.3.location == unit.2.location) { SetUnit(number, unit.3); // add temporary unit to array number = number + 1; } i = i + 1; // (this time it *should* be here and not in an else-clause ) } // somehow list unit.4 t/m unit.number Text(ID_CHECK_STACK_CONTENTS_MESSAGE); EyeDropDown(4, unit); // or should it be EyeDropDown(4, unit.type) or something like that? // better but tougher alternative: show pics of units Button(ID_BUTTON_CLOSE) { // or ID_BUTTON_CONTINUE or whatever ClearOrders(unit.1); AddMovement(1, unit.1); Kill(); } }


I'll work on this today (but first I'll try and perfect the garrison thing, so I can't guarantee to have a working version of it tonight, but I'll try)

Locutus
[This message has been edited by Locutus (edited January 06, 2000).]

skorpion59 is offline skorpion59
Prince
Tulsa, Oklahoma, USA
May 1999
time: 23:13
Post  Old Post 06-01-2000 17:57 Visit skorpion59's homepage!
Edit/Delete Message Reply w/Quote
#10 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations: Deluxe Edition

Locutus,
You are correct. Singlecombat only works when each player has one unit. That is why I did it differently.

I find it amazing that you can do the same thing in so many ways.

Dreamer,
Have you got any of the SLIC group emails? I have heard from all but you.

Don

[This message has been edited by skorpion59 (edited January 06, 2000).]

Dreamer is offline Dreamer
Chieftain
Singapore
Dec 1999
time: 05:13
Post  Old Post 06-01-2000 21:10 Visit Dreamer's homepage!
Edit/Delete Message Reply w/Quote
#11 Report this post to a moderator
Support Apolyton buy from Amazon

WOW!!! you guys are fantastic. I have tested the special.stackedcombat, doesn't trigger even the enemy have two or more units in the same location.

I was actually trying these.

code:
Trigger 'CheckUnits' when (special.attacked && IsHumanPlayer(g.player)) { u = 3; i = 0; While (i <= player.2.totalunits) { SetUnitByIndex(u, player.2, i); If (unit.[u].location == city.1.location) { u = u + 1; cityunits = UnitsInCell(unit.2.location); Message(g.player, 'CheckUnitsMessage'); } i = i + 1; } } Alertbox 'CheckUnitsMessage' { Text(ID_CHECK_UNITS); EyeDropDown(3, unit); Button(ID_BUTTON_YES) { Kill(); } Button(ID_BUTTON_NO) { ClearOrders(unit.1); Kill(); } }

I got syntax error, probably due to unit.[u].location, can't SLIC use array?

[This message has been edited by Dreamer (edited January 06, 2000).]

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:13
Post  Old Post 07-01-2000 02:15 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#12 Report this post to a moderator
Support Apolyton, buy Call to Power 2

He Dreamer,

That's exactly what I started with (that unit.[u].location thing. But I thought: that will never work (didn't try it though, maybe unit.u.location will work?) so I changed it to what you see above in my trigger: you must create a temporary unit. In you're case try this (this is, BTW, not tested either but it has a much better change of working IMHO):

code:
Trigger 'CheckUnits' when (special.attacked && IsHumanPlayer(g.player)) { u = 4; // one higher because 3 will be temporary unit i = 0; While (i <= player.2.totalunits) { SetUnitByIndex(3, player.2, i); If (unit.3.location == city.1.location) { // compare temporary unit // with city location SetUnit(u, unit.3); // add temporary unit to array u = u + 1; cityunits = UnitsInCell(unit.2.location); Message(g.player, 'CheckUnitsMessage'); } i = i + 1; } } Alertbox 'CheckUnitsMessage' { Text(ID_CHECK_UNITS); EyeDropDown(4, unit); Button(ID_BUTTON_YES) { Kill(); } Button(ID_BUTTON_NO) { ClearOrders(unit.1); Kill(); } }


I didn't test your trigger so there could be a dozen other things wrong with it, but it looks sound. I've finished my garrison-code, I send it out to you all, so tonight/tomorrow I will have a look at this one.

Locutus

Dreamer is offline Dreamer
Chieftain
Singapore
Dec 1999
time: 05:13
Red face  Old Post 07-01-2000 12:57 Visit Dreamer's homepage!
Edit/Delete Message Reply w/Quote
#13 Report this post to a moderator
Support Apolyton, buy GURPS/ Alpha Centauri

Locutus,

I had tested your script, there are a few things not happen during the trigger.

First, the special.singlecombat only trigger when both party have only 1 unit each. I tried putting 2 units to the enemy and nothing happen. Later I change to special.attacked, it works but not the followings.

Second, the popup message does not show the dropdown listing of units. I only get an eye button in it and clicked got no effect.

Third, the messagebox popup while the two units still fights, it doesn't halt the battle and ClearOders(unit.1) does not apply here.

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:13
Post  Old Post 08-01-2000 00:28 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#14 Report this post to a moderator
Remove this text

Dreamer,

I'm working on this right now, you'll here from me. (I'm in a bit of a hurry)

Dreamer is offline Dreamer
Chieftain
Singapore
Dec 1999
time: 05:13
Smile  Old Post 08-01-2000 12:25 Visit Dreamer's homepage!
Edit/Delete Message Reply w/Quote
#15 Report this post to a moderator
Enter the AD-FREE zone

Locutus,

Why don't we use clicked.unit for the trigger? Can get the player by using SetPlayer(1, unit.owner). BTW, how does EyeDropdown() works? I modify your codes a bit just to get the dropdown appear and I still see the eye button there doing nothing when clicked.

code:
// Check no. of city units when clicked on enemy's city TypeUnit currentunit; Trigger 'CheckUnits' when (clicked.unit && (unit.owner != g.player)) { Message(g.player, 'CheckUnitsMessage'); } Alertbox 'CheckUnitsMessage' { SetPlayer(1, unit.owner); i = 0; u = 4; While ( i < player.1.totalunits) { SetUnitByIndex(3, player.1, i); If (unit.3.location == unit.location) { CurrentUnit = unit.3; SetUnit(u, CurrentUnit); u = u + 1; } i = i + 1; } Text(ID_CHECK_UNITS_MESSAGE); EyeDropDown(4, unit); Button(ID_BUTTON_CLOSE) { Kill(); } }

[This message has been edited by Dreamer (edited January 08, 2000).]

skorpion59 is offline skorpion59
Prince
Tulsa, Oklahoma, USA
May 1999
time: 23:13
Post  Old Post 08-01-2000 17:28 Visit skorpion59's homepage!
Edit/Delete Message Reply w/Quote
#16 Report this post to a moderator
Support Apolyton or Terrorists Win

Dreamer,

What exactly is going on? I don't see any problems with this. I don't know how much you know so I will start at the basics.

An EyePoint selects and centers on a unit.
An EyeDropdown supplies a list of EyePoint locations so you can select 1 to apply the EyePoint to (in English, you pick 1 to go to).

EyePoint Syntax: EyePoint(Location)
EyeDropdown Syntax: EyeDropdown(StartIndexNumber, ListVariable)
ListVariable can be any BuiltIn variable that can be used as a list. (Currently that is Unit, City or Discovery. Unit & City provide locations while Discovery provides research items. Hmm, research item huh?)

If you click on ONLY 1 unit, it automatically selects it. Since this is what EyePoint is for, it has already been done so EyeDropdown does not have to do anything. Thus no list is produced. You can still click on the EyePoint in the AlertBox but you won't be able to tell anything is happening. So just close the box out.

If you click on 2 or more units, the Alertbox has the normal EyePoint PLUS a dropdown list to the right of that. Clicking on the dropdown list brings up the list of units in that tile. When you click on one of the selections, it selects that unit. Open the dropdown list again, select another units and it selects that one. You can keep doing this until you close the Alertbox.

Since you are using this to find out how many units are in a stack, you are going to have to put that information in your ID message. If you don't, the users are not going to have any idea what is going on.

I assume you want it done this way so you can actually see what unit it is, right?


Now for the bad part.

You will have to go back to using the spy if you want it done this way. Clicked.Unit won't work on cities, only tiles. When you click on a city, Clicked.City gets activated instead.

When you decide exactly what you want to do, let me know. If you want to use Clicked.City, we are going to have to merge what you want in with the Clicked.City code I have. Since you weren't interested in my code above, I took Clicked.City into a whole new realm all its own.

Don

[This message has been edited by skorpion59 (edited January 08, 2000).]

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:13
Post  Old Post 08-01-2000 19:04 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#17 Report this post to a moderator
Increase Your PM Length

Dreamer,

quote:
Originally posted by Dreamer on 01-08-2000 02:25 AM
Why don't we use clicked.unit for the trigger? Can get the player by using SetPlayer(1, unit.owner). BTW, how does EyeDropdown() works? I modify your codes a bit just to get the dropdown appear and I still see the eye button there doing nothing when clicked.


Actually, I was planning on doing just that (using clicked.unit) from the beginning, but when you came up with that special.singleattack thing or whatever it was, I thought I'd give that a try first. Right now, all the testing I'm doing I'm doing with unit.sighted, so I'll be sure the trigger triggers at all, I'll worry on making it trigger at the right moment (unit.attacked, clicked.unit, whatever) later. One step at a time is my philosophy in programming (and I can recommend it to anyone).

About the EyeDropDown, until Don posted his explanation I didn't knew how it worked. It's nowhere in the doc's that I have (that's why I need your's so much, Don) but I think we should be able to get it all to work now Don has explained a few things. I'll keep trying as well, but I still have a project for my study to finish that should have been finished two weeks ago, so I don't have too much time this weekend. If you don't get it to work before I finished my project I'll put all my time in helping you, since I really like this option myself. What would you think of displaying the icons of the units and some statistics (such as health, movementfactor, etc.) instead of a simple dropdownlist? I don't know how to do this yet, but maybe we can find out or someone else knows?

See ya,

Locutus

[This message has been edited by Locutus (edited January 08, 2000).]

skorpion59 is offline skorpion59
Prince
Tulsa, Oklahoma, USA
May 1999
time: 23:13
Post  Old Post 08-01-2000 19:56 Visit skorpion59's homepage!
Edit/Delete Message Reply w/Quote
#18 Report this post to a moderator
Help yourself to an AD-FREE life

Locutus,

Go back and read my last post from 'Now for the bad part'.

I was editing it at the same time you were posting and you missed that part. I didn't catch you were planning on trying to use Clicked.Unit on a city until I reread it.

Also, most of the information you mentioned is already in my Clicked.City code. And the new SLIC docs are about done.

Don

Dreamer is offline Dreamer
Chieftain
Singapore
Dec 1999
time: 05:13
Wink  Old Post 08-01-2000 20:25 Visit Dreamer's homepage!
Edit/Delete Message Reply w/Quote
#19 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations: Deluxe Edition

skorpion59,
Well it all started were I wanted to check no. of units in enemy city, with your help we made it. Regarding the problem to open up Diplomacy Window, I found out that is just a missing string to address the button ID, so is fixed now.

Later after seeing Locutus script that his idea were to view enemy units in stack not only in city but on the field. Both Locutus and I were thinking of using the EyeDropdown() to list the unit name.

Now after seeing your message, then I know it is actually passing unit location into the dropdown list. What a bad news, like what Locutus had said "It's nowhere in the doc's that I have (that's why I need your's so much, Don)."

Locutus,
You mentioned "What would you think of displaying the icons of the units and some statistics (such as health, movementfactor, etc.)"

Err....thinking that these is going to be a major one. Anyway, I'll try.

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:13
Post  Old Post 09-01-2000 10:33 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#20 Report this post to a moderator
Suffering from ads?

Don,
Thanks for pointing that out, I would have never noticed the edited part if you hadn't said it, while it contains some important info. I do think we should include the units present in a city in your clicked.city thing. I will concentrate on the units in the field. Do you have some code on the clicked.city thing already? I'd be interested in seeing that if you have. It doesn't have to be finished or working or anything.
I don't have to tell you how glad I am that you've almost finished the docs, I've been whining about it like crazy ever since you first mentioned it.

Dreamer,
I don't see why the passing of the unit-location into the dropdown list is such bad news. It can still work, take a look at the code under this text. It works now - only the when-clause of the trigger isn't right yet, but I don't think that's much a problem.
About the icons and statistics, that is not easy, I know, but with a lot of research and perhaps some help from others with more experience in this area we might get it done. It would be great if we could pull it off, don't you think?

Later,

Locutus

code:
////////// Check contents of stack ////////// // Not the final trigger yet, should be "&& unit.clicked" or something // We'll see about that later Trigger 'CheckStackContents' when (unit.sighted && IsHumanPlayer(g.player) && (unit.2.type == UnitType("UNIT_SPY") ) ) { // continued from above Message(g.player, 'CheckStackContentsMessage'); } // in this alertbox all units will be checked, if they are at the same location as unit.1, // then they are added to the unit.array at the first available spot // (he, this actually resembles programming ) Messagebox 'CheckStackContentsMessage' { // why won't this work with an alertbox? Oh well, at least it works... i = 0; number = 4; // 1 stands for inspecting unit (e.g. Spy), 2 for inspected unit // and 3 for temporary unit (see later), so 4 is the first available spot to start with while (i < player.totalunits) { SetUnitByIndex(3, unit.owner, i); // temporary unit (see above) if (unit.3.location == unit.1.location) { SetUnit(number, unit.3); // add tempory unit to array number = number + 1; } i = i + 1; } Text(ID_CHECK_STACK_CONTENTS_MESSAGE); EyeDropDown(4, unit); // better but tougher alternative: show pics of units Button(ID_BUTTON_CLOSE) { Kill(); } }

[This message has been edited by Locutus (edited January 08, 2000).]
[This message has been edited by Locutus (edited January 08, 2000).]

Dreamer is offline Dreamer
Chieftain
Singapore
Dec 1999
time: 05:13
Thumbs up  Old Post 08-01-2000 23:51 Visit Dreamer's homepage!
Edit/Delete Message Reply w/Quote
#21 Report this post to a moderator
Full PM-box? Change here!

All,

Hurray!!! It works now even in Alertbox(). Locutus, there is nothing much I change in your script just renaming of variable name and changed the trigger container to clicked.unit as example from skorpion59's clicked.city.

I have included a slaver in the stacked unit during testing and it is shown in the list dropdown. So what you guys think, good or bad?

Here's the trigger :-

code:
// Check contents of stacked units Trigger 'CheckStackContents' when (clicked.unit && (unit.owner != g.player)) { Message(g.player, 'CheckStackContentsMessage'); } Alertbox 'CheckStackContentsMessage' { SetPlayer(1, unit.owner); i = 0; u = 4; while (i < player.1.totalunits) { SetUnitByIndex(3, player.1, i); if (unit.3.location == unit.location) { SetUnit(u, unit.3); u = u + 1; } i = i + 1; } Text(ID_CHECK_STACK_CONTENTS_MESSAGE); EyeDropDown(4, unit); Button(ID_BUTTON_CLOSE) { Kill(); } }

Dreamer is offline Dreamer
Chieftain
Singapore
Dec 1999
time: 05:13
Thumbs up  Old Post 09-01-2000 00:18 Visit Dreamer's homepage!
Edit/Delete Message Reply w/Quote
#22 Report this post to a moderator
Full PM-box? Change here!

skorpion59,

With the success of the above ""Stacked Unit Trigger", the "Check City Units Trigger" should be as follows :-

code:
// Check no. of enemy units in city upon clicking Trigger 'CheckCityUnits' when (clicked.city && (city.owner != g.player)) { cityunits = UnitsInCell(city.location); Message(g.player, 'CheckCityUnitsMessage'); } Alertbox 'CheckCityUnitsMessage' { SetPlayer(1, city.owner); i = 0; u = 4; while (i < player.1.totalunits) { SetUnitByIndex(3, player.1, i); if (unit.3.location == city.location) { SetUnit(u, unit.3); u = u + 1; } i = i + 1; } Text(ID_CHECK_CITY_UNITS_MESSAGE); EyeDropdown(4, unit); Button(ID_BUTTON_CLOSE) { Kill(); } }

skorpion59 is offline skorpion59
Prince
Tulsa, Oklahoma, USA
May 1999
time: 23:13
Post  Old Post 09-01-2000 02:49 Visit skorpion59's homepage!
Edit/Delete Message Reply w/Quote
#23 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations

Looking good guys. I always enjoy seeing the fruits of my labor pay off. Apparently, you do to. That is one reason I enjoy programming so much. Of course, then I look at it and say, 'That was easy, why didn't I think of that in the first place'. Oh well, that's life.

*Hiding my head in shame*
Now I must apologize to you and anybody following this thread. I had been up 20 hours when I started my last thread so I wasn't quit thinking right. So, to clarify...
You CAN have multiple triggers triggering off the same trigger. Either by having multiple Clicked.City triggers or by having 1 Clicked.City trigger with multiple MessageBoxes. Sorry about that.


------------------
Don, Apolyton Junkie

skorpion59 is offline skorpion59
Prince
Tulsa, Oklahoma, USA
May 1999
time: 23:13
Post  Old Post 09-01-2000 09:03 Visit skorpion59's homepage!
Edit/Delete Message Reply w/Quote
#24 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations

All,

Let me pass along another little bit of info. You might already know this but it has bit me before.

Variables used in triggers are evaluated according to the 'Lowest Common Denominator' therory. Triggers are associated with 1 variable only and that is the one with the lowest common denominator. No other variables are even looked at until the 'LCD' variable has triggered.

Now in English. Say you are checking city.built and unit.built in a trigger. Unit.built is the 'LCD' so this trigger gets placed in the unit.built trigger queue. (It is in no way associated with the city.built trigger queue at this point in time. If you never build a unit, this trigger will never be evaluated. Even if you DO build a city.) Okay, now you go build a unit. It goes through the unit.built queue and comes across this trigger. If the unit.built expression is met, it will then, and only then, evaluate the city.built expression. If both expressions are met, it will now execute this trigger. If both are not met, it will not execute this trigger.

Hopefully this will save you some future frustration.

------------------
Don, Apolyton Junkie

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:13
  Old Post 09-01-2000 19:13 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#25 Report this post to a moderator
Remove this text

Don't remind me now, remind me when I'm stuck and I've completely forgotten about this

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:13
Smile  Old Post 10-01-2000 01:39 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#26 Report this post to a moderator
Support Apolyton buy from Amazon

Dreamer,

I found some time to try out your trigger and it works great. A few minor issues though:

I think we should add a message if there's only one unit. Now the EyeDropDown doesn't appear, which is sort of ugly. This is what happens now:

code:
|-----------------------------------------------| | | | This stack contains of the following units: | | | | | | | | | |-----------------------------------------------|

It's a minor thing but still... It can easily be resolved like this (didn't test it, but it can't contain many errors):

code:
Trigger 'CheckStackContents' when (clicked.unit && (unit.owner != g.player)) { if (UnitsInCell(unit.location) > 1) { Message(g.player, 'CheckStackContentsMessage'); } else { Message(g.player, 'OnlyOneUnit'); } } Altertbox 'OnlyOneUnit' { Text(ID_ONLY_ONE_UNIT_MESSAGE); Button(ID_BUTTON_CLOSE) { Kill(); } }


Besides that I discovered another ugly bug. Once you've clicked on an enemy unit, you must first click on one of your own units before you can click on another enemy stack and see it's contents. I doubt this can be resolved though.

Also I think the ability to see the contents of a stack should be limited to spy-like units (Spy, Cyber Ninja, Diplomat, etc.) What do you guys think of this?

Later,

Locutus

[This message has been edited by Locutus (edited January 09, 2000).]

Dreamer is offline Dreamer
Chieftain
Singapore
Dec 1999
time: 05:13
Post  Old Post 10-01-2000 09:20 Visit Dreamer's homepage!
Edit/Delete Message Reply w/Quote
#27 Report this post to a moderator
Got spare money?

Locutus,

I don't have the problem of clicking own unit before clicking enemy unit. All you need is to left click on any empty tile before clicking next enemy, seems like there is a invisible selected frame there when clicking enemy unit or city, just like when we click on our own unit or city.

I think is fair to view enemy stacks without spy etc. I believe the AI do know what units are within our stacks too.

skorpion59 is offline skorpion59
Prince
Tulsa, Oklahoma, USA
May 1999
time: 23:13
Post  Old Post 10-01-2000 09:46 Visit skorpion59's homepage!
Edit/Delete Message Reply w/Quote
#28 Report this post to a moderator
Support Apolyton, buy Civilization: The Boardgame

The terrain click is required because you have to deselect an object before you can select (click) it. (See Side Note above.)

Personally, I don't think you should have to only use a spy to get the info. The computer cheats and knows exactly what we have and where we have it. (Why else does the barbarians mysteriously appear right next to the city with no defenders instead of next to the city with 4 defenders.)

From a gamer standpoint, clicking on a stack and getting the info would probably be to powerful. I think the average person would think just the spy should have this ability. At least until the AI learns how to fight and defend better. Hopefully, auto-upgrading the AI Garrison units will make this a moot point.

------------------
Don, Apolyton Junkie

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:13
  Old Post 10-01-2000 18:52 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#29 Report this post to a moderator
Support Apolyton, buy Call to Power 2

quote:
Originally posted by Dreamer on 01-09-2000 11:20 PM
I think is fair to view enemy stacks without spy etc. I believe the AI do know what units are within our stacks too.


I wasn't aware of that, well in that case I change my opinion. I guess we could make people choose (with my setup program) if they want to limit the ability to see stack-contents to spy-like units or not.

Locutus

DanMc is offline DanMc
Chieftain
Salisbury, UK
Oct 1999
time: 05:13
Post  Old Post 10-01-2000 20:18
Edit/Delete Message Reply w/Quote
#30 Report this post to a moderator
Put an end to popups!

Any chance of extending this to the spy plane/spy satelite too? And while your at it, you could include the 'investigate city' function too. This is something I feel is quite a major omission.... It doesn't have to have a 100% chance of success (e.g. as a result of cloud cover etc.), but it should be fairly high.

Dan

------------------
Just a thought......

 
Pages (2): [ 1   2   ]
< Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:13.
Apolyton Time is 00:13.
    top of page
Rate This Thread:
Forum Jump:
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
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0588 seconds (92.90% PHP - 7.10% MySQL) with 30 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net