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 > Popular Uprisings and other Triggers
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    < Last Thread     Next Thread > Post New Thread     Post A Reply
Gedrin is offline Gedrin
Warlord

Jun 1999
time: 05:13
Post  Old Post 28-09-2000 23:09
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
Popular Uprisings and other Triggers Support Apolyton, buy Galactic Civilizations

This is an idea for a trigger I am developing. The motivation is to generate internal strife within an empire that might contribute to its eventual downfall.

It revolves around the idea that the player or AI is the continually re-incarnated leader of your nation... but you are not the whole nation. The Citizens of your nation have opinions about how you do things.

Some events are likely to make your people call out for blood:
city.captured when its your city by another civ
agreement.broken when you are the victim
special.attacked when you are the victim
special.terrorism when you are the victim
special.citizenenslaved when you are the victim
special.settlerenslaved when you are the victim
special.victoryenslavement when you are the victim
special.piracy when you are the victim
special.pillage when you are the victim

Some things you do will result in protests:
city.captured by barbarians
city.captured from a peaceful civ.
player.pollution from you
unit.dead when it is a Nuke that you used
unit.deadnofuel because you screwed up
unit.deadnosupport because you screwed up
agreement.broken when you broke it
special.terrorism when you are the attacker
special.attacked when you are the attacker
special.terrorism when you are the attacker
special.citizenenslaved when you are the attacker
special.settlerenslaved when you are the attacker
special.victoryenslavement when you are the attacker
special.piracy when you are the attacker
special.pillage when you are the attacker


Now so long as you are responding to an attack ie your people are already calling out for blood... then you could go trample all over that offensive civ and no one would get upset. However if you are the instigator you should not go to far to fast or you own people might oust you.

Implementing this is easy enough. Each player will have a rating and a delta.
Every turn the rating and delta will both decay towards 0 and the delta will also be added to the rating.

Events as described above will alter the current delta value by some fixed amount. This effectively gives the rope with which to hang oneself.

Lets say your unrest level is 0.
And you co capture 4 enemy cities in one turn. This increases your delta to say 40.
Next turn your unrest rating=0+40-1=39 and the delta=40-1=39.
Next turn unrest rating=39+39-1=77 and the delta=39-1=38..
Next turn unrest rating=77+38-1=114 and the delta=38-1=37..
etc etc etc...

Interpretation: Your people considered your war against the other civ to be unjustified. They had done nothing to you. If you had taken maybe one city they may have been ok with that and settled down eventually but you captured 4, you're a frickin despot and they're freakin on you! You better make restitution somehow or they're gonna defect or something.

The amends part I'm working on.

Anyway those are my thoughts on this and they are developing.

JPF_civplayer is offline JPF_civplayer
Settler
Seattle, WA, USA
Jul 2000
time: 05:13
Post  Old Post 29-09-2000 00:16 Visit JPF_civplayer's homepage!
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Support Apolyton, buy Alpha Centauri

The overall idea seems sound to me. Be sure to throw in government effects..obviously under fascism you should be able to act nastier than under democracy before unrest happens.

Gedrin is offline Gedrin
Warlord

Jun 1999
time: 05:13
Post  Old Post 29-09-2000 00:26
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Full PM-box? Change here!

Yes I've been considering that too.

I don't want to unbalance the governements though so such things take a great deal of care and consideration. I've had thoughts like...
Ok a fascist gov may be able to take a city without upsetting their people as much as they would in a democracy. However all govs call out for a similarly larger amount of blood when they do so.

Meaning that while a democracy could not fight an agressive war against anyone it would be particularly good at retribution. "You take one of mine I'll take two of yours".

There's nothing quite like a democracy incited to war.

This is a significant trigger and must not be taken lightly. It will profoundly alter the game.

Gedrin

gemini is offline gemini
Settler

Jan 1970
time: 05:13
Post  Old Post 29-09-2000 11:38
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Support Apolyton, buy GURPS/ Alpha Centauri

Hey sounds like a great idea!!!!

But, one problem I can think of immediately is that you can't save values of variables without ctp crashing.

I'll explain, if you had a trigger to increment the value of "x" by 1 each turn, it would do it, but when you save the game and then later try to load that game it will either crash when loading or crash on the next game turn.

I just wanted to say that so you don't waste your time if that was the way you were planning to program the trigger. There may be another way around that, I don't know what exactly you had in mind but I just thought I'd let you know. There's gotta be a work around though.

But man, if you can do all that you are talking about that is really !!!!!!

------------------
Gemini
[This message has been edited by gemini (edited September 29, 2000).]

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

Gemini is probably right, both he and I experienced problems with that in the past. This may also be causing the mysterious MedMod crashes, like I said in a post on the CtP General Forum (along with a way to test this).

But the idea's sound themselves sound very cool. I think the best (and probably only ) solution however might be to wait for CtPII, SLIC will be much more powerfull and the variable thing may well have been fixed there.

Gedrin is offline Gedrin
Warlord

Jun 1999
time: 05:13
Post  Old Post 29-09-2000 19:04
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Support Apolyton, buy GURPS/ Alpha Centauri

Hmmm.... I had not thought of that... or realized it really...
This might work though:
INT Preference(prefname)
INT SetPreference(prefname, value)

'Course if you are playing multiple games you will need to swap out userprefs.txt (is that the file name? Can't recall)
And this does rely on the idea that the prefs file is updated or at least can be updated when a value is changed... but I'm unsure of that one either.

Anyone know for sure?

Gedrin

Pintello is offline Pintello
Warlord
Deltona, Florida
Jan 1970
time: 05:13
Post  Old Post 29-09-2000 19:17
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Avatar Enlargement: We've got the solution

Hi Gedrin,

Your idea sounds very good. However, I have only one question. Will the AI be aware of these things like the human is? If the AI is not, then this whole setup is a recipe for the AIs to self destruct every time and very quickly, unless you apply these rules only to the human player. However, if you only apply these rules to the human player, you are giving the AIs a huge advantage, though that may be what they need to be competetive.

Timothy Pintello

Gedrin is offline Gedrin
Warlord

Jun 1999
time: 05:13
Post  Old Post 29-09-2000 20:26
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Get a bigger avatar today!

Yes, I've been concerned about that too.

My approach is to contrive the rules to benifit strategies that the AI already engages in. I do not see AI's going on the decidedly Human 'Holy Jihad' and totally destroy a civ, always refusing to accept peace. I mean that's what I do. I *never* start wars but once one starts it usually ends with a message something like...
The has been completely destroyed...


My desire is to make it harder for human players to do things that human players do. Make them play more moderately, a little more like an AI.

Of course this all may be a moot point if I can't persist the values over a restart.

Gedrin

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:13
Unhappy  Old Post 29-09-2000 20:42 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
Inflate your Upload Space

No, storing it in profile.txt won't work either, simply because you can't add your own fields to it. I've tried but it doesn't work.

Gedrin is offline Gedrin
Warlord

Jun 1999
time: 05:13
Post  Old Post 02-10-2000 20:58
Edit/Delete Message Reply w/Quote
#10 Report this post to a moderator
Suffering from ads?

Oh Pooh.

Ok how about this.
Regard for players.
IE the
ForceRegard(ofPlayer, forPlayer, toRegard): Force the regard ofPlayer forPlayer toRegard.
INT RegardLevel(player1, player2): Return player 1's regard toward player 2.

One could imagine these values are stored in an array. I wonder if we can store values in the player (n,n) element. Anyone know? Anyone want to same me the trouble of checking? Anyone know legal ranges of this value?

If it can be set then two values can be stored in it easily by either using the decimal digit columns or actually spliting the values into bits... say 5 most sig for a rating and 3 least sig for a delta.

Now this will take some testing.


Gedrin

Gedrin is offline Gedrin
Warlord

Jun 1999
time: 05:13
Post  Old Post 03-10-2000 09:52
Edit/Delete Message Reply w/Quote
#11 Report this post to a moderator
Support Apolyton

As promised some of the other triggers I experiment with:


//Setup
trigger 'Setup' when ((g.player == 0) && (g.year == 0)) {
// This is the value from userprofile.txt that details the number of players that STARTED the game.
// This may of course be very different from the number currently in the game.
numberOfPlayers = Preference("NumPlayers");
}

messagebox 'PopFlees' {
// POP_FLEES must be defined in info_str.txt and reads like:
// POP_FLEES "Refugees from [city.1.name] flee in terror."
Text(ID_POP_FLEES);
MessageType("WARNING");
}

trigger 'Refugees' when (city.captured) {
// This value will rounded down.
popCount = city.1.population / 2;
cityCount = Cities(player.2);
// Skip the last city in a civ. They have nowhere to go.
// Optionaly we could find a Random civ that is still alive and let them flee there.
if (cityCount > 0) {
AddPops(city.1, -popCount);
Message (player.1, 'PopFlees');
Message (player.2, 'PopFlees');
index = 0;
while (index < popCount) {
destCity = Random(Cities(player.2));
SetCityByIndex(2,player.2,destCity);
AddPops(city.2, 1);
index = index + 1;
}
}
}

messagebox 'PopEmmigrates' {
// POP_EMMIGRATES must be defined in info_str.txt and reads like:
// POP_EMMIGRATES "Your authority is questioned in [city.2.name]. Citizens have Emmigrated to [city.3.name]."
Text(ID_POP_EMMIGRATES);
MessageType("INCITE");
}

messagebox 'PopImmigrates' {
// POP_IMMIGRATES must be defined in info_str.txt and reads like:
// POP_IMMIGRATES "Political refugees arrive from [city.2.name] in [city.3.name].
Text(ID_POP_IMMIGRATES);
MessageType("INCITE");
}

// PopMigration and B-Tax merged for speed.
trigger 'AvePopBasedEffects' when ((g.player) && (g.year)) {
cityCount = Cities(g.player);
totalPop = 0;
smallestPop = 100;
index = 0;
// find the total population and smallest city
while (index < cityCount) {
SetCityByIndex(1, g.player, index);
totalPop = totalPop + city.1.population;
// Remember which is the smallest-newest city for PopMigration
if (city.1.population <= smallestPop) {
SetCityByIndex(2,g.player,index);
smallestPop = city.2.population;
}
index = index + 1;
}

// apply the BureaucracyTaxes
surtax = (2*totalPop - cityCount * cityCount) * (600 - g.year) / 200;
AddGold(g.player,surtax);

// Migration becomes more likey as time goes on and while ave pops remain low.
// if ((g.year/30) > (Random(20) + avePop))
if ((cityCount*g.year) > (30*(Random(20)*cityCount + totalPop))) {
recipientPlayer = 0;
cityCount = 1000;
// find the civ with fewest cities
index = 1;
// Exclude player = 0 so the Barbarians do not get them at all.
while (index < numberOfPlayers) {
if ((Cities(index) > 0) && (Cities(index) < cityCount)) {
cityCount = Cities(index);
recipientPlayer = index;
}
index = index + 1;
}
// if it is not me then move 1 pop... yes this does mean the player with
// the fewest cities may ICS with impunity, to catch up of course.
if (recipientPlayer != g.player) {
// This actually produces a number from [0,cityCount) ie not inclusive!!!
index = Random (cityCount);
SetCityByIndex(3,recipientPlayer,index);
Message (g.player,'PopEmmigrates' );
Message (recipientPlayer,'PopImmigrates' );
AddPops(city.2, -1);
AddPops(city.3, 1);
}
}
}

Gedrin

Gedrin is offline Gedrin
Warlord

Jun 1999
time: 05:13
Post  Old Post 03-10-2000 09:55
Edit/Delete Message Reply w/Quote
#12 Report this post to a moderator
Tired of ads?

I forgot one:
This also requires the setup trigger above to set numberOfPlayers


messagebox 'PopTerrorized' {
// POP_TERRORIZED defined in info_str.txt reads like:
// POP_TERRORIZED "Foreign backed terrorists strike in [city.1.name]. Casualties are high."
Text(ID_POP_TERRORIZED);
MessageType("WARNING");
}

trigger 'AveScoreBasedEffects' when ((g.player) && (g.year)) {
// Player = 0 is the Barbarian who does not suffer from terrorist...
// but we still need the total score since ave = total/number
if (g.player == 0) {
totalScore = 0;
index = 1;
while (index < numberOfPlayers) {
SetPlayer(1,index);
totalScore = totalScore + player.1.score;
}
} else {
cityCount = Cities (g.player);
if (cityCount > 0) {
SetPlayer(1,g.player);
// This equates to [-2,0] + (player.1.score - aveScore)/aveScore
// I multiplied by numberOfPlayers/numberOfPlayers = 1 to clear some divisions
strikes = Random(3) - 2 + (player.1.score * numberOfPlayers - totalScore)/totalScore;
while (strikes > 0) {
destCity = Random (cityCount);
SetCityByIndex(1,g.player,destCity);
AddPops(city.1, -1);
Message(g.player, 'PopTerrorized');
strikes = strikes - 1;
}
}
}
}


Gedrin

Gedrin is offline Gedrin
Warlord

Jun 1999
time: 05:13
Post  Old Post 02-10-2000 22:02
Edit/Delete Message Reply w/Quote
#13 Report this post to a moderator
Put an end to popups!

Arrgg...

Those with a keen eye will notice I have an infinite loop in the trigger above...

The terrorist is currently being tested so I make no garuntees about it yet. :P
the while loop should be:


if (g.player == 0) {
totalScore = 0;
index = 1;
while (index < numberOfPlayers) {
SetPlayer(1,index);
totalScore = totalScore + player.1.score;
index = index + 1;
}
} else {


I forgot that index = index + 1;
Although I have not hit an infinite loop yet so I think I must have changed it already at home :O

Gedrin

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:13
Post  Old Post 03-10-2000 00:17 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
Avatar Enlargement: We've got the solution

quote:

Originally posted by Gedrin on 10-02-2000 11:58 AM
Oh Pooh.

Ok how about this.
Regard for players.
IE the
ForceRegard(ofPlayer, forPlayer, toRegard): Force the regard ofPlayer forPlayer toRegard.
INT RegardLevel(player1, player2): Return player 1's regard toward player 2.

One could imagine these values are stored in an array. I wonder if we can store values in the player (n,n) element. Anyone know? Anyone want to same me the trouble of checking? Anyone know legal ranges of this value?

If it can be set then two values can be stored in it easily by either using the decimal digit columns or actually spliting the values into bits... say 5 most sig for a rating and 3 least sig for a delta.

Now this will take some testing.


Gedrin




Christ, that's so desperate you're better of waiting for CtPII But it *could* indeed work.

I'm not sure if there are legal ranges for the regard values (other then that they have to be integers of course) and I wouldn't know where to look for them. I guess trial and error is the way to go.

Damn, for the first time since I bought CtP I don't have it installed and I immediately regret it And it doesn't look like I'll be getting a lot of free disk-space anytime soon

gemini is offline gemini
Settler

Jan 1970
time: 05:13
Post  Old Post 03-10-2000 11:26
Edit/Delete Message Reply w/Quote
#15 Report this post to a moderator
Full PM-box? Change here!

Yes, I have tested to see what it returns with the regardlevel function. If I remember correctly it returns an integer ranging from 1 to 5 (or 0 to 5 can't remember), anyway 1 is low regard and 5 is high.

Btw, I read your other post about storing variables and I read Locutus's response. I can't explain why you have no problems loading your games when you use your trigger. I would be interested in knowing if your variables are retained correctly after loading. Let me know. Thxs.

Anyway, Ctp does remember which triggers have been disabled. And I haven't run into any problems disabling and enabling triggers over and over when loading save games. I did something similar for my on map date display. Any way, maybe you could set ranges for certain triggers and disable other triggers that don't apply.

Eg.

code:
trigger 'ged' when (g.player){ x = 40; } trigger 'gad' when (g.player){ x = 50; } trigger 'god' when (g.player){ x = 60; } trigger 'gcd' when (g.player){ x = 70; } trigger 'code' when (g.player){ if(player.cities < 2){ disabletrigger('gcd'); disabletrigger('ged'); disabletrigger('gad'); } if(player.cities > 1 | | player.cities < 5){ disabletrigger('god'); disabletrigger('ged'); disabletrigger('gad'); } if(player.cities > 4){ disabletrigger('gad'); disabletrigger('god'); disabletrigger('gcd'); } } trigger 'whatyouwanttorun' (g.player){ if(x == 60){ //run the code } if(x == sorry not worth it for me to go on and on but thats it }


I know the code above doesn't make much sense but it's the idea that might be useful.
I thought I might throw it at you.

Looking back at your post about the regardlevel function, if I am understanding correctly, you want to store values in the element for the regardlevel function??? Like regardlevel(12,12);

If that's what you want to do I know it won't work. Only the built in player variables work in there.

------------------
Gemini
[This message has been edited by gemini (edited October 03, 2000).]

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

That sounds like a good alternative, Gemini. Personally I'd probably go with that rather then with the regard thing, but that's just me...

quote:

Originally posted by gemini on 10-03-2000 02:26 AM
Only the built in player variables work in there.



True, but you can say something like this:

player.1 = 12;
player.2 = 12;
RegardLevel(player.1, player.2);

I used this to create barbarian units for flat-map support so I know for sure that this will work. Only you're probably limited to numbers between 0 and 32 and IIRC all non-existing players are automaticly barbarians. So if you have 8 players in the game, player 0 and players 9 and higher are all really the same player (though I'm not entirely sure about this).

Gedrin is offline Gedrin
Warlord

Jun 1999
time: 05:13
Post  Old Post 03-10-2000 20:11
Edit/Delete Message Reply w/Quote
#17 Report this post to a moderator
Support Apolyton buy from Amazon

Locutus:
Have you been able to set the player context with:
player.1 = x;
I thought it crapped out when you tried to write to built in variables. That's what the VOID SetPlayer(index, player) function is for.

Doesn't change the accuracy of your statement though. That is what I had in mind for setting regard.

I imagine since the regard goes from 0 to 5 (vs 1 to 5) and these are War; Angry; Unhappy; Neutral; Happy; Love.
This is a shame since I doubt the function would allow larger values.

However, having said that and having read the thread Locutus pointed me too I do not think it matters.

As you probably know SLIC is not using a true random number generator... or at least I don't think it does. It uses a pseudoRandom function. This means that the nth random number will be x and if you back up to some prior condition it will be x again. I have repeatedly saved games, run a turn, got a disseminated tech, reloaded a game and again got a disseminated tech. In addition I have never failed to get this result. This makes me very confident, although not positive, that the values used in my disseminate trigger are preserved over restarts.
IE:numberOfPlayers and numberWith*some_advance*

I believe quite strongly that the entire SLIC stack would be saved on a savegame.

I do not know why the triggers described [in the thread Locutus pointed to me] crashed on a restart. I suspect actually that some small error was made in typing it in.

Would:
trigger 'move' when (IsHumanPlayer(g.player)){
even load?

trigger 'move' when (IsHumanPlayer(g.player) == 1){
might.
Having noted that and assuming that this was the case then I also have concerns over placing IsHumanPlayer in the trigger conditions. There are warnings about this sort of thing in the SLIC guide.

The reason I suspect this is that (IsHumanPlayer(g.player) == 1) does not provide enough information to determine if it is true or not. You also need to know if g.player is human.

On the other hand something like g.player == 1 does provide enough information since g.player is an integer already. You guys follow me?

I suspect that to be the cause of the crash but would need to know a good deal more about the guts of SLIC to answer it.

Having read over point 2) in the at thread also I think this is the sort of thing you need.

TypeLocation locationvar;

VOID MakeLocation(locationvar, x, y, z)
Set locationvar to (x,y,z)

VOID SetLocation(index, locationvar)
Set location.index to locationvar.

VOID ExtractLocation(location, locationvar)
Get a location from built in variable and put it in locationvar.

These can be used in combination to handle any function arguments depending on if they expect a user defined TypeLocation locationvar; or a built variable in the location container: SetLocation(3, locationvar) and then use location.3 in a function... or gain access to any of the fields on location [which unfortunately are not detailed in the SLIC docs]; or even just a index into the current location context.

Gedrin


And on another note: My Terrorist Trigger 'fully' tested for functionality. I have no idea how well it balances things but it should certainly hamper the runaway civ... Human or AI.



messagebox 'PopTerrorized' {
// POP_TERRORIZED defined in info_str.txt reads like:
// POP_TERRORIZED "Foreign backed terrorists strike in [city.1.name]. Casualties are high."
Text(ID_POP_TERRORIZED);
MessageType("WARNING");
}

trigger 'AveScoreEff' when ((g.player) && (g.year)) {
// Player = 0 is the Barbarian who does not suffer from terrorist attacks
// but we still need the total score since ave = total/number
if (g.player == 0) {
totalScore = 0;
numberPlayersLeft = 1;
index = 1;
while (index < Preference("NumPlayers")) {
if (IsPlayerAlive(index) == 1) {
SetPlayer(1,index);
totalScore = totalScore + player.1.score;
numberPlayersLeft = numberPlayersLeft + 1;
}
index = index + 1;
}
} else {
cityCount = Cities (g.player);
// Note that CityCount > 0 is not the same as IsPlayerAlive. Consider turn 0.
if (cityCount > 0) {
SetPlayer(1,g.player);
// The following = Random(3) - 2 - (player.1.score - average)/average
// where average = totalScore/numberPlayerLeft
strikes = Random(3) - 3 + (player.1.score * numberPlayersLeft / totalScore);
// The chances that a terrorist strike kills a civ's last city is small but not nil
while ((strikes > 0) && (cityCount > 0)) {
destCity = Random (cityCount);
SetCityByIndex(1,g.player,destCity);
// Always message BEFORE reducing pop since it might destroy the city
Message(g.player, 'PopTerrorized');
AddPops(city.1, -1);
cityCount = Cities (g.player);
strikes = strikes - 1;
}
}
}
}


Gedrin

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

Gedrin,

quote:


Locutus:
Have you been able to set the player context with:
player.1 = x;
I thought it crapped out when you tried to write to built in variables. That's what the VOID SetPlayer(index, player) function is for.
Doesn't change the accuracy of your statement though. That is what I had in mind for setting regard.



Sorry, I made a minor mistake, it should be:
x = 12;
y = 12;
RegardLevel(x, y);

You can't set built-in variables (directly) but you *can* use user-defined variables whenever you would normally have used built-in ones. I don't know what I was thinking when I wrote that down

quote:


I imagine since the regard goes from 0 to 5 (vs 1 to 5) and these are War; Angry; Unhappy; Neutral; Happy; Love.
This is a shame since I doubt the function would allow larger values.



Hmm, you're probably right. I think I got confused with something else when I said there probably was no limit.

quote:


However, having said that and having read the thread Locutus pointed me too I do not think it matters.

As you probably know SLIC is not using a true random number generator... or at least I don't think it does. It uses a pseudoRandom function. This means that the nth random number will be x and if you back up to some prior condition it will be x again. I have repeatedly saved games, run a turn, got a disseminated tech, reloaded a game and again got a disseminated tech. In addition I have never failed to get this result. This makes me very confident, although not positive, that the values used in my disseminate trigger are preserved over restarts.
IE:numberOfPlayers and numberWith*some_advance*



Yeah, I noticed that the Random function was only pseudo-random as well but didn't draw any conclusions from it. You have a good point there. (Where were you six months ago? )

quote:


I believe quite strongly that the entire SLIC stack would be saved on a savegame.

I do not know why the triggers described [in the thread Locutus pointed to me] crashed on a restart. I suspect actually that some small error was made in typing it in.



It could well be, I must say I'm doubting our theory more and more as well. Oh well, it was nice while it lasted

quote:


Would:
trigger 'move' when (IsHumanPlayer(g.player)){
even load?

trigger 'move' when (IsHumanPlayer(g.player) == 1){
might.
Having noted that and assuming that this was the case then I also have concerns over placing IsHumanPlayer in the trigger conditions. There are warnings about this sort of thing in the SLIC guide.

The reason I suspect this is that (IsHumanPlayer(g.player) == 1) does not provide enough information to determine if it is true or not. You also need to know if g.player is human.

On the other hand something like g.player == 1 does provide enough information since g.player is an integer already. You guys follow me?

I suspect that to be the cause of the crash but would need to know a good deal more about the guts of SLIC to answer it.



I think the "trigger 'move' when (IsHumanPlayer(g.player)) {" should work.
IsHumanPlayer(g.player) will return either true (but since there is no boolean datatype it will return 1) or false (or 0), so "(IsHumanPlayer(g.player))" and "(IsHumanPlayer(g.player) == 1)" do exactly the same, the logical expression "(1)" is the same as the expression "(1 == 1)" (the last one will evaluate to "(1)" anyway). I hope you can follow this.

Also, I'm pretty confident that I've used it before with succes. In fact, even in Activision's standard script.slc file it's used as trigger condition several times (though always in combination with other conditions, so that doesn't say everything).

I read through the entire SLIC guide but couldn't find the warnings you are referring to.

You say that you don't have enough information and that you need to know if g.player is human, but isn't that exactly what IsHumanPlayer does? I agree though that "g.player == 1" or even better, just "g.player" and check if the player is human later with an if-statement, is safer but using IsHumanPlayer as trigger condition should work as well.

Anyway, most of SLIC 1 looks like it was just hacked together anyway and not at all finished, so I expect and hope that all will be better in SLIC 2.

quote:


Having read over point 2) in the at thread also I think this is the sort of thing you need.

TypeLocation locationvar;

VOID MakeLocation(locationvar, x, y, z)
Set locationvar to (x,y,z)

VOID SetLocation(index, locationvar)
Set location.index to locationvar.

VOID ExtractLocation(location, locationvar)
Get a location from built in variable and put it in locationvar.

These can be used in combination to handle any function arguments depending on if they expect a user defined TypeLocation locationvar; or a built variable in the location container: SetLocation(3, locationvar) and then use location.3 in a function... or gain access to any of the fields on location [which unfortunately are not detailed in the SLIC docs]; or even just a index into the current location context.

Gedrin



I'm not sure what you're trying to tell but if you'd like to know how I eventually implemented the MakeLocation thing, I suggest you have a look at the flatmap version of MedMod 4

Locutus

BTW, your SLIC triggers look very cool, if I ever reinstall CtPI again I'll try them out
[This message has been edited by Locutus (edited October 03, 2000).]

Gedrin is offline Gedrin
Warlord

Jun 1999
time: 05:13
Post  Old Post 04-10-2000 02:24
Edit/Delete Message Reply w/Quote
#19 Report this post to a moderator
Avatar Enlargement: We've got the solution

Locutus

Six months ago I was digging a project out that had been assulted by programmers who knew enough about OO to be very very dangerous.

I think you are right about the evaluation of integers as booleans. 1 is true and 0 is not. Been working too long in a strongly typed language I think.

I withdraw all suspicions about IsHumanPlayer and SLIC crashes... I now havn't a clue... helpful arn't I

The warning paragraph is on: http://apolyton.net/ctp/modification/slicbuiltin.shtml
Each trigger object you create is only triggered for one type of event, even though it may contain more
than one variable that can be used as a trigger event! See Trigger Priorities for a discussion of how to
determine which events will cause your trigger to be run. A good way to be safe is to just put as little logic
in the when(...) condition as possible, and instead move everything else to an if(...) {} inside the trigger.

And you know you want it re-install CTP... it's not CTPII is out yet.

Oh and yeah Flat Map... just looked over. Seems you knew what I was talking about.

Gedrin

WesW is offline WesW
CTP1/2 Modification Site Admin
Florence, Al., USA
Jan 1970
time: 23:13
Post  Old Post 04-10-2000 12:01 Visit WesW's homepage!
Edit/Delete Message Reply w/Quote
#20 Report this post to a moderator
Get a bigger avatar today!

I don't get to the creation forum much any more, and so I have just read the entire thread here for the first time. To summarize: Does anyone have any ideas about the Med mod crashes?

Also, Gedrin, I was getting you mixed up with Gemini regarding the Partisan trigger.
Gemini, do you have such a trigger, ala civ2's, for your WWII mod?

You three, Locutus, Gemini and Gedrin, need to get together and list all the triggers that you have developed, either in the same or individual threads. No need for the code, just a brief description of the triggers. I think you may be surprised at what the others have done. Also, you may want to list ideas for triggers that you have, and triggers that you could not get to work, with the code included.
I am mainly looking ahead to CtP2 and its improved slic2 as far as using these lists and ideas. The game will be out before you know it, and it doesn't hurt to start kicking ideas around and comparing notes now. This thread is evidence that you are already doing that some, but putting things out in a detailed and standardized way would be beneficial to everyone, imo.

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

Gedrin,

quote:


The warning paragraph is on: http://apolyton.net/ctp/modification/slicbuiltin.shtml
Each trigger object you create is only triggered for one type of event, even though it may contain more
than one variable that can be used as a trigger event! See Trigger Priorities for a discussion of how to
determine which events will cause your trigger to be run. A good way to be safe is to just put as little logic
in the when(...) condition as possible, and instead move everything else to an if(...) {} inside the trigger.



I saw that paragraph but I didn't see how applying functions in trigger conditions has anything to do with it. Now you mention it and I rethink it, I know what you mean, but I still don't think it should be a problem (not in this case anyway).

quote:


And you know you want it re-install CTP... it's not CTPII is out yet.

Oh and yeah Flat Map... just looked over. Seems you knew what I was talking about.

Gedrin


Yeah, I know I want to reinstall it, but if I can is a different matter altogether
That probably won't be the case before CtPII comes out so I decided to just give CtP up altogether, but I just couldn't resist to at least keep posting here

Wes,

As far as the crashes go: no, we haven't got a frinnin' clue

Partisan trigger? Isn't that from the old SLIC group? Or did Gemini make one of his own version?

As far working together goes, I wouldn't mind that at all. In fact, I have already been thinking (and I *think* Don has too) to get a new SLIC group together for SLIC 2. It goes without saying that the people who I have in mind for this, presuming they have the time and energy for it, are Don, Darryl, Chris, you and myself (and one or two more people with SLIC expertise and/or good ideas). Anyway, that's something for the future...

But SLIC 2 will probably be *very* different from SLIC 1 so there's not much point doing an anything but gathering ideas for what should be converted to or implemented in SLIC 2 (and hoping that it will be possible). And gathering ideas is something that anyone can do, whether you have SLIC knowledge or not. Basicly, one could simply go to the CtPII forums and put every suggestion and idea mentioned there on a list and try and implement as much of that list as possible in SLIC 2 once it's available, but that could just as well be done once CtPII is released as well. Maybe even better 'cause we will then have a much better idea of what will be possible and what not. What I'm trying to say is that IMHO we don't have a friggin' clue what SLIC 2 will be like and can't do anything meaningfull until we do.

I do agree that writing down code that we already have (or that we've been working on but what doesn't work yet) would be usefull. That would be put on top of the list with stuff that should be converted to SLIC 2. We might even be able to help each other out if we're stuck with something.
When I get home tonight (I'm at my university now), I'll see if I can find the Leonardo's Workshop code, I started that a long time ago but never finished it because of unexplained bugs and other (non-CtPI) things that came up. Maybe one of the guys has an explanation for the bugs. Any other code that I have (all from the old SLIC group) is either already in your mod (apart from the Guerrilla/Partisan thing, it's basicly done but no-one ever did anyting with it) or not in an advanced enough state to share with others (i.e. more idea then actual code).

Anyway, I'm also leaving town tonight and I'll be gone for a few days (I'm going to Disneyland! ) and when I come back I have exams to study for so I'm not sure if I can actually post the LW code (or anything else for that matter) before the middle of next week.
[This message has been edited by Locutus (edited October 04, 2000).]

Gedrin is offline Gedrin
Warlord

Jun 1999
time: 05:13
Post  Old Post 05-10-2000 09:53
Edit/Delete Message Reply w/Quote
#22 Report this post to a moderator
Support Apolyton, buy GURPS/ Alpha Centauri

Well the triggers I have are pretty much described in this thread:

advance discovery effects:
Dissemination.

city.captured effects:
Refugees.

turn based average City Pop effects (ie punishments for ICS)
PopMigration and B-Tax merged into one trigger for speed.

turn based average Score effects (ie punishments for the runaway civ)
Terrorist strikes.

The last one is still testing but I think all the bugs are out... I just can't speak to balance.
In addition I might make things a little more varied than the simply pop killed effect there is now (such as unit killed, land pillaged, improvement detroyed- which I don't think I can do, etc etc).

My next project is the Popular Uprising which started this thread.
I have also considered random natural disasters like Earthquakes, local Flooding, Epedemics etc etc...

I have never actually tried and failed to get an idea to work. I'm pretty determined. I'm sure I have dismissed ideas as infeasible or too complex to execute quickly... such as the variable improvement costs based on city pop... basicly anything that requires two or more nested loops disuade me.

And of course I wait gleefully for SLIC2 but without a hint of docs I must agree with Locutus. Not much to do but wait.

What would I like to see? Well control over improvements within the city would be nice.
Built in fields like discovery.name would be great or at least the ability to assign an advance to an index in the current context.
But I think this above all:
User defined Arrays.

With arrays and a mapping from discovery.type to the DB string I could make disseminate generic for any mod instead of custom code for every advance set.

Having said that however I suspect the disseminate and other gossip events like maps and military readiness were intended for CTPI and will likely be finished in CTPII.

Gedrin

gemini is offline gemini
Settler

Jan 1970
time: 05:13
Post  Old Post 06-10-2000 09:27
Edit/Delete Message Reply w/Quote
#23 Report this post to a moderator
Support Apolyton, buy Civilization: The Boardgame

Hi guys, Nope, I never made a partisan trigger for anything but my own scenario. And it was designed for the scenario so unfortunately it would be not useful outside of that.

Yes, I am looking forward to slic2. I really can't wait to see what's going to be all added and improved. Hey, I'm sure I can spare some time the the new slic group Locutus so please keep me in mind. Thxs.

Gedrin, that's just what I was thinking. If slic2 allows arrays there is so much more we could do.

The one thing I hope, really hope is in slic2 is the ability to destroy and build improvements.


------------------
Gemini
[This message has been edited by gemini (edited October 06, 2000).]
[This message has been edited by gemini (edited October 06, 2000).]

Gedrin is offline Gedrin
Warlord

Jun 1999
time: 05:13
Post  Old Post 06-10-2000 19:11
Edit/Delete Message Reply w/Quote
#24 Report this post to a moderator
Suffering from ads?

Oh and I thought of one more thing I would like:

Either no functions that operate only within a Button or message box... or deliever messages and alertboxes to the AI and have a default button selection... like OK if it's the only one button there.

I wanted to try and create something to topple a governement but since SetGovernment only works in a button it does nothing to the AI.

Ooops I guess I did try and fail to do one.
Forgot about that.

Gedrin.

Gedrin is offline Gedrin
Warlord

Jun 1999
time: 05:13
Post  Old Post 09-10-2000 23:02
Edit/Delete Message Reply w/Quote
#25 Report this post to a moderator
Got spare money?

Alright, I'm getting torqued.

I have the following in my Terrorist trigger:

                                  SetPlayer(1,g.player);
// The following = Random(3) - 2 - (player.1.score - average)/average
// where average = totalScore/numberPlayerLeft
strikes = Random(3) - 3 + (player.1.score * numberPlayersLeft / totalScore);
// The chances that a terrorist strike kills a civ's last city is small but not nil
while ((strikes > 0) && (cityCount > 0)) {



And while the comment has an error, is should be:
// The following = Random(3) - 2 + (player.1.score - average)/average
The line in my code is what I really want:
strikes = Random(3) - 3 + (player.1.score * numberPlayersLeft / totalScore);

Now I know the trigger does what I want when the conditions are met because if I use:
strikes = Random(3) + 3 + (player.1.score * numberPlayersLeft / totalScore);
it fires 3 to 5 times a turn but, now matter how big my score gets:
player.1.score * numberPlayersLeft / totalScore = 0
(truncated of course because its an int)

So what the heck am I missing?

This value is supposed to be:
=player.1.score/average
=player.1.score/(totalScore/numberPlayersLeft)
=player.1.score*numberPlayersLeft/totalScore

right?

Is there something more in the human player score not in the AI score? Not that I think that matters because I've had some stupid large scores by virtue of the cheat mode and still the value never exceeds 0.

Does anyone know why?
Ok I just thought of something... does slic do divisions first?
I also tried and failed and display player.1.score in the message.
I've tried reducing scores by g.maxscore - 3600 which is the diff bonus and reducing scores by 75*(numberOfPlayers-1) which is the Opponents bonus.
No change. Grrr... Insights anyone?

Gedrin

Gedrin is offline Gedrin
Warlord

Jun 1999
time: 05:13
Post  Old Post 10-10-2000 19:03
Edit/Delete Message Reply w/Quote
#26 Report this post to a moderator
Browse Apolyton AD-FREE

Um so it appears that:
trigger 'AveScoreBasedEffects' when (g.player) {

fires for g.player == 0 it is not considered true and therefore the code does not trigger.
To trigger for every player requires
when (g.player >= 0)

Don't you hate it when you just have to say to yourself... Doh... I should have seen that sooner.



Anyway my Terrorist trigger is now being tested for play balance.
I think
score/average - 3 + Random(3)
will actually be a little insigificant.

On another note:
The power graph does not include score bonuses for difficulty, opponents, or map size.
player.score however does so if anyone else is ever using it keep that in mind.
Difficulty bonus = g.maxscore - 3600 if it is unchanged from the box.

Gedrin

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

Well, I dug into my archives and found a file that contains most, if not all, of the code developped by the SLIC group or me. I put it up on my website, you can download it here. I doubt this file will actually work, a lot of it is incomplete or doesn't work at all. It would be great if anyone could tell me what's wrong with the Leonardo's Workshop code (apart from the fact that it's butt-ugly and probably inefficient code ), that took a lot of time to code but for some reason doesn't seem to work.

The stuff that (should) work:

- Guerrilla/Partisan trigger: creates guerrilla units when a city is captured (should IMHO still be refined but at least it works )
- Check contents of stack: let's you view the contents of an enemy stack
- Flat map code: nothing new, already in MedMod
- Garrison code: nothing new here either.

I know, it ain't much but still...

Gotta run,

Locutus

Edit: Damn, screwed that whole post up and couldn't edit it until now because my Internet connection gave up on me.
[This message has been edited by Locutus (edited October 13, 2000).]

  < 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.0789 seconds (92.91% PHP - 7.09% 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