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 > Miscellaneous > Archive > CtP2-Creation/AI/Mods/Scenarios-Archive > What Govt Am I? THE SOLUTION!
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!

bottom of page
  
Author
Thread    < Last Thread     Next Thread > Post New Thread     Post A Reply
Dale is offline Dale
King
Sir! Why do you keep clicking on me?
Dec 2000
time: 15:23
  Old Post 07-11-2002 14:38
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
What Govt Am I? THE SOLUTION! Support Apolyton, buy Call to Power 2

Yep, you modders read it right. I have the solution to finding out a players (Human or AI) government attached to this very thread.

WARNING!
This modification will NOT run by itself! This is a modders resource! Of course, if you were to add it to the default game, it will work.

Concept:
Okay. Here I was just quietly fixing Citrix profiles, when it suddenly hit me that a Cleric and Fascist is only built by certain governments. Then I remembered that it's possible to check what's in the build queue. So by putting two and two together, an idea formed........
1. Create units specific to one government.
2. Put that unit in the build queue.
3. Check if that unit is in the build queue.
4. If it is, then logically the player is in that government.

Now to find a unit which is in the game all the time....... a settler is available from turn 0, but is obsoleted by the urban planner. But who would build a settler over an urban planner? Not even the vanilla AI. So I figured, add a unit, call it something like "DONT BUILD ME AS I DISAPPEAR EVERY TURN!", and voila. I should be able to extract what government someone is in be checking what govt-specific unit I can build.

Installing:
1. Put the SLIC file in the usual place, and enable it through script.slc.
2. Add what's contained in units.txt to the real units.txt (my file only contains the changed values).
3. Add names for each unit in gl_str.txt.
4. And away we go! No need for uniticon.txt, newsprite.txt or any other file to be modified.

How to use:
The variable GOVT_WhatGovtAmI[player] contains the integar which correlates to the GovernmentDB index (hence why the array is setup in govern.txt order). Just check the value of that variable, and you have your government!

Bugs:
The bane of a modder.......
1. The unit will actually stay in the build queue. No matter where I put KillUnitFromBuildQueue, it only worked from HandleEvent(EndTurn). Maybe if we give the units names like "DONT BUILD ME!" or something, and definitely not put it in unitbuildlists.txt for the AI.
2. Because of the above bug, if you have nothing in the build queue, the production will accumulate and you'll eventually be able to build one of the temp units (not good). I'd say a simple CreateUnit check to see if one's built, and replace it with a standard settler if one actually is built will do nicely here.

This is definitely a huge step for us modders. SOOOOOOOOOOOOOOOOO much can be done with knowing what Government someone is in.

EDIT: Clarification - The temp unit only stays in the build queue till the EndTurn event is called. The KillUnitFromBuildQueue command works from there. So as soon as you hit the "End Turn" button, the temp unit disappears.

Last edited by Dale on 07-11-2002 at 14:49

Dale is offline Dale
King
Sir! Why do you keep clicking on me?
Dec 2000
time: 15:23
  Old Post 07-11-2002 14:39
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Avatar Enlargement: We've got the solution

The file.....................

EDIT: Removed attachment to save on confusion.

Last edited by Dale on 09-11-2002 at 02:18

Immortal Wombat is offline Immortal Wombat
Prince
in perpetuity
Dec 2000
time: 05:23
  Old Post 07-11-2002 15:31 Visit Immortal Wombat's homepage!
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Support Apolyton buy from Amazon

Genius!

Turambar is offline Turambar
Prince
England
Apr 2002
time: 05:23
  Old Post 07-11-2002 16:07 Visit Turambar's homepage!
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Suffering from ads?

Brilliant!!!!!

SMIFFGIG is offline SMIFFGIG
Prince
Great Britain
Jul 2002
time: 05:23
  Old Post 07-11-2002 17:06 Visit SMIFFGIG's homepage!
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Support Apolyton, buy Civilization: The Boardgame

Does this mean the idea i mentioned long ago about governments can be implemented ??

Here



EDIT:
A quote from the post

quote:

Originally posted by Pedrunn
But if we are gotng to implement this how do we know wich gov the player has?


Ah yes. This is not possible.

Posted by Immortal Wombat

Immortal Wombat is offline Immortal Wombat
Prince
in perpetuity
Dec 2000
time: 05:23
  Old Post 07-11-2002 20:55 Visit Immortal Wombat's homepage!
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations

oops...

J Bytheway is offline J Bytheway
Emperor
England
Jul 2001
time: 05:23
  Old Post 08-11-2002 00:31 Visit J Bytheway's homepage!
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Support Apolyton, buy Civilization 2

A truly inspired workaround . It seems there's not much we can't do if we think about it long enough.

Dale is offline Dale
King
Sir! Why do you keep clicking on me?
Dec 2000
time: 15:23
  Old Post 08-11-2002 10:20
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Support Apolyton or Terrorists Win

I'm sure a few of you know I've been looking at this problem for almost 2 years now. Remember for the first diplomod I wanted same-government diplomatic bonuses. And that was Jan 01!!!!

Dale is offline Dale
King
Sir! Why do you keep clicking on me?
Dec 2000
time: 15:23
  Old Post 08-11-2002 10:40
Edit/Delete Message Reply w/Quote
#9 Report this post to a moderator
Got spare money?

quote:
Originally posted by J Bytheway
A truly inspired workaround . It seems there's not much we can't do if we think about it long enough.


Does this put me in the ranks of St Swithin?

More workarounds than you can shake a lemur poo at!

Dale is offline Dale
King
Sir! Why do you keep clicking on me?
Dec 2000
time: 15:23
  Old Post 08-11-2002 10:48
Edit/Delete Message Reply w/Quote
#10 Report this post to a moderator
Support Apolyton, buy Civilization: The Boardgame

quote:
Originally posted by SMIFFGIG
Does this mean the idea i mentioned long ago about governments can be implemented ??

Here




Yeah I suppose it could, but I agree with Locutus that it's not realistic, unless you use it as a diplomatic bonus, not an absolute like you suggested. I mean come on! 5 years ago Australia was flirting with China for an alliance!

Dale is offline Dale
King
Sir! Why do you keep clicking on me?
Dec 2000
time: 15:23
  Old Post 08-11-2002 18:30
Edit/Delete Message Reply w/Quote
#11 Report this post to a moderator
SLIC Update! Version 0.2 Tired of ads?

Here's an updated SLIC file for the modders. It fixes all bugs found thus far, including the ones mentioned above.

- So you will no longer accumulate production if the temp unit is the only thing in your capital's build queue.
- The temp unit will no longer show in the player's turn in the build queue (but will still be selectable from the list). The temp unit will actually be in the build queue during everyone else's turn. But that's irrelevant as far as I can see.
- The government you are in is now updated on the turn you change government, instead of the next turn as previous. IE: You click "Enact" on a government, and when you hit "End Turn" the variable updates to "Anarchy".

This is pretty much finished/fixed and working properly now.

EDIT: Deleted attachment to save on confusion.

Last edited by Dale on 09-11-2002 at 02:19

ískallin is offline ískallin
Prince
of the Republic of Iceland
Mar 2002
time: 05:23
Post  Old Post 08-11-2002 18:47
Edit/Delete Message Reply w/Quote
#12 Report this post to a moderator
Flott!!!! Remove this text


Wonderful

Dale is offline Dale
King
Sir! Why do you keep clicking on me?
Dec 2000
time: 15:23
  Old Post 09-11-2002 01:44
Edit/Delete Message Reply w/Quote
#13 Report this post to a moderator
Version 0.3 Remove this text

Okay, one last update v0.3:

- I've made it easier to Mod.

What this Mod does:
This Mod is a project I've been trying to get working for almost 2 years. It finds out and stores what Govt everyone is in for use in other scripts. This script is intended for other Modders to help them in their projects. Please leave the header of this script with the code.

How to add this to a Mod?
1. Put this SLIC in the usual place and add to script.slc
2. Create temp units in Units.txt for every government in the Mod, remembering to use the "GovernmentType" flag to limit each unit to a seperate government (IE: like the Cleric is). These units MUST be one after the other and in GovernmentDB order!
3. Open this SLIC and modify the following:
- In 'GOVT_SetupArrays' setup the GOVT_GovtUnits array with the names of every temp unit.
- In 'GOVT_SetupArrays' change the variable GOVT_FirstUnitIndex to the UnitDB index of the first temp unit. In the vanilla game this is 72 if you put the temp units after all the others.
4. In 'gl_str.txt' add names for these temp units (I would use something like "Govt Check Unit").
5. When referencing the Govt variable, check GOVT_WhatGovtAmI[playerNum] to get the GovernmentDB index (IE: If in Tyranny in vanilla game you get 10).

Any comments let me know. Hope this helps expand people's Mods. This will be VERY useful for the Dark Ages in Ages of Man!

EDIT: Added to the directory in Modification\Text and Slics.

Attachment: whatgovtami.zip
This has been downloaded 90 time(s).

Last edited by Dale on 09-11-2002 at 01:52

Pedrunn is offline Pedrunn
King
of Natal, Brazil
Jul 2001
time: 02:23
  Old Post 19-12-2002 18:59
Edit/Delete Message Reply w/Quote
#14 Report this post to a moderator
Support Apolyton, pre-order Civilization IV

Are you sure BuildUnit(city_t, int_t) does work as a funtion?

I tested it as a event handler and it didnt!

Dale is offline Dale
King
Sir! Why do you keep clicking on me?
Dec 2000
time: 15:23
  Old Post 20-12-2002 02:34
Edit/Delete Message Reply w/Quote
#15 Report this post to a moderator
Support Apolyton, buy Civilization: The Boardgame

quote:
Originally posted by Pedrunn
Are you sure BuildUnit(city_t, int_t) does work as a funtion?

I tested it as a event handler and it didnt!


Yep. I tested extensively.

Pedrunn is offline Pedrunn
King
of Natal, Brazil
Jul 2001
time: 02:23
  Old Post 20-12-2002 03:01
Edit/Delete Message Reply w/Quote
#16 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations



That really is funny. But nice to hear that since i couldnt get the function AddUnitToBuildList(city, unittype) to wortk either. The BuildUnit(city_t, int_t) will be the perfect replacement to my plans.

HuangShang is offline HuangShang
King
USA, SoCal, L.A.
Jul 2002
time: 21:23
  Old Post 20-12-2002 06:43
Edit/Delete Message Reply w/Quote
#17 Report this post to a moderator
Browse Apolyton AD-FREE

so many updates

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:23
Post  Old Post 23-12-2002 03:57 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#18 Report this post to a moderator
Support Apolyton, buy Alpha Centauri

I just took a look into the directory and find this file there, but actual Locutus I thought Dale made this file and not you.

-Martin

Dale is offline Dale
King
Sir! Why do you keep clicking on me?
Dec 2000
time: 15:23
  Old Post 23-12-2002 11:39
Edit/Delete Message Reply w/Quote
#19 Report this post to a moderator
Full PM-box? Change here!

Yeah! That's my file! :doitnow:

BureauBert is offline BureauBert
Chieftain
Vienna, Europe
Apr 2003
time: 06:23
  Old Post 22-05-2003 22:17 Visit BureauBert's homepage!
Edit/Delete Message Reply w/Quote
#20 Report this post to a moderator
Support Apolyton buy from Amazon

Hi everybody!

As I am working on my own humble MOD, in which governements should be more important in some aspects, I am very interested in the „SLICability“ of government-types. I read this thread & SLIC, also Martin’s “getting the government by comparing GovernmentDB-entries”, finally I recurred to the “placeholder”-lines in IW’s “AI-superpowers-script”:

PHP:

if(
player[0].govttype  == GovernmentDB(GOVERNMENT_ANARCHY)){
        
;
    }



I understood that player.govttype contains a string. If I compare the above lines with the way you may check unit.type I presume that

SomeDB(DATABASE_ITEM)

always returns the database-index (integer) of that item – as for unit.type you may use

either
    unit.type == 99

or
    unit.type == UnitDB(UNIT_SOMEUNIT)


So IMHO the above govttype-example doesen’t work because it compares some string with the database-index of GOVERNMENT_ANARCHY rather than the string ‘GOVERNMENT_ANARCHY’. The obvious thing for me would be trying something like

PHP:

if(
player[0].govttype  == ‘GOVERNMENT_ANARCHY’){
        
;
    }



instead. Alternatively – if the “string” mentioned in the documentation is NOT the database-string – I could think of the “string” from gl_str.txt (if it was meant to be used in messages rather than functions), unfortunately I can’t think of any other “string” in this context.

Obviously I have to admit that I haven’t tested that at all – taking into consideration that most likely someone in this forum would explain to me in five words that my ‘idea’ is merely useless and what the heck am I thinking why the whole experienced community is researching some more advanced workarounds for months …. ????

BUT after some hesitating I just had to post this before messing around for some hours or days – thank you for your patience!

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:23
Post  Old Post 22-05-2003 22:52 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#21 Report this post to a moderator
Inflate your Upload Space

So why don't you test it on your own, BureauBert. Well in this case I tested it, and it does not work, I did not test the a String from the gl_str.txt, I doubt that this would work. And the disadvantage of this method would be that you have to modify the slic code for every language version of CTP2, so it is not a good idea. Actual noone got the idea to make it like this, because there is a not working StringCompare function, so why is there such a function if it would be so easy. Well it could have worked...

-Martin

Immortal Wombat is offline Immortal Wombat
Prince
in perpetuity
Dec 2000
time: 05:23
  Old Post 23-05-2003 03:35 Visit Immortal Wombat's homepage!
Edit/Delete Message Reply w/Quote
#22 Report this post to a moderator
Lose 30 kilos (of popups)

Nah, I tested both ways, using GOVERNMENT_* and the string from gl_str.txt, eg. "Monarchy", neither method even loads in the game.

child of Thor is offline child of Thor
Emperor
UK
Jan 2002
time: 05:23
  Old Post 23-05-2003 03:53
Edit/Delete Message Reply w/Quote
#23 Report this post to a moderator
Get a bigger avatar today!

this is really usefull, it can be used in loads of ways to help keep the AI's game up to pace.......Dale i'm glad this has stayed in your mind for the last two years! Hey i'm glad you are still around to think on CTP2

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:23
Post  Old Post 24-05-2003 20:37 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#24 Report this post to a moderator
Avatar Enlargement: We've got the solution

quote:
Originally posted by child of Thor
this is really usefull, it can be used in loads of ways to help keep the AI's game up to pace.......Dale i'm glad this has stayed in your mind for the last two years! Hey i'm glad you are still around to think on CTP2


Well I rather use my way, so I only have to modify some governments slightly instead of adding some units.

-Martin

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:23.
Apolyton Time is 00:23.
    top of page
Rate This Thread:
archivepost
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.0581 seconds (90.82% PHP - 9.18% MySQL) with 31 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