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 > Call To Power II > CtP2-Creation/AI/Mods/Scenarios > MM2 PW Repair code.
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
stankarp is offline stankarp
Prince
australia
Feb 2002
time: 05:35
  Old Post 26-04-2004 02:29
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
MM2 PW Repair code. Support Apolyton, buy Alpha Centauri

I incorporated Wouters MM2 PW repair code into a Cradle mod.

It worked fine for over 100 turns then I suddenly noticed that I was getting a lump sum of pw every turn of over 1000 points which defeated the purpose of the code.

I checked it by commenting the code out again then back in again and it was definitely the MM2 PW repair code.

Wondering if anyone else had the same problem in MM2.

stankarp is offline stankarp
Prince
australia
Feb 2002
time: 05:35
  Old Post 27-04-2004 03:10
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Avatar Enlargement: We've got the solution

I gather no one has had this problem in Med Mod or has not noticed it then??

Peter Triggs is offline Peter Triggs
Prince
Gone Fishin, Canada
Jan 2000
time: 05:35
  Old Post 27-04-2004 03:24
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Increase the size of your Attachments

I can't remember the last time I played MedMod. It's hardly ever mentioned around here anymore so I don't think there's a lot of people playing it now.

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:35
  Old Post 27-04-2004 03:59 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations: Deluxe Edition

That wasn't the case when I last played the MedMod (though granted, that was a while ago) and that certainly shouldn't happen based on the code. Unless you have weird negative numbers for MapHP or ShieldCost in Units.txt, the SLIC code can only decrease the amount of PW a player has, not increase it.

Are you sure it's not because you're setting your HP value higher than usual to compensate for the extra PW demand?

If so, try disabling the SetHP lines of the SLIC code(there should be 2 of them: one following the second if statement and one as last line in the block following the elseif), see if you still get too much PW then? (The effect of this change will be that you're units are still repaired normally, but the cost is not deducted from your PW reserve.)

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:35
  Old Post 27-04-2004 04:03 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 or Terrorists Win

Also, post the SLIC file with your version of the code, something may have gone wrong incorporating it in Cradle.

stankarp is offline stankarp
Prince
australia
Feb 2002
time: 05:35
  Old Post 27-04-2004 05:09
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Support Apolyton, buy Civilization III: Complete

I havnt done anything wierd re hit points or stuff like that. As I said it seems to go fine for about 100 or more turns then suddenly I start getting PW as if I was an AI

I'll try attaching the file but I remember having trouble doing this sometimes.

Attachment: craskcw_wouter.slc
This has been downloaded 5 time(s).

Gilgamensch is offline Gilgamensch
King
France
Jun 2002
time: 06:35
  Old Post 27-04-2004 15:07
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Put an end to popups!

Would be interresting to know.

I had a look at the file, but nothing jumping into my eye.

Unless it isn't a rounding problem somewhere.

Stankarp, do you actually have damaged units in your cities?

stankarp is offline stankarp
Prince
australia
Feb 2002
time: 05:35
  Old Post 27-04-2004 15:52
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Remove this text

Gilgamensch, thats a point. Early in the game, the code definitely works on damaged units in cities. Its hard then and you count every PW. I found I banished damaged units to the country so I could build a road.

However, later when I had a fair bit of PW I was not checking so closely but since I am at war with someone always, I assume that I had damaged units. I am trying it again so I will pay closer attention this time and report.

I wonder if Locutus could extend the code to Fortresses and watch towers because its unrealistic that units repair instantly in those tile improvements. It actually makes going to war very hard because the AI gets plenty pw so its units repair faster than yours, whereas as it stands normally, they heal at the same rate.

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:35
Post  Old Post 27-04-2004 21:49 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#9 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations: Deluxe Edition

I don't see any PW related problems, either. But I found this problem:

code:
if (IsHumanPlayer(tmpPlayer) && notEnough == 1) { // if not enough pw and player is human player[5] = tmpPlayer; Message(1, 'MM2_NotEnoughPW_M'); // give message that more pw is needed }


The meassage is always sent to player 1, not a good idea if you play Network games or if you play a scenario and you use another player then player 1, or you selected another player in our playtest built.

This code is better:

code:
if (IsHumanPlayer(tmpPlayer) && notEnough == 1) { // if not enough pw and player is human player[5] = tmpPlayer; Message(tmpPlayer, 'MM2_NotEnoughPW_M'); // give message that more pw is needed }


Another thing you could do, is to insert an player[5] = tmpPlayer; before a member of player[5] is used. The current version of CTP2 has the behaviour to forget the value of an array member if you set it yourself.

-Martin

stankarp is offline stankarp
Prince
australia
Feb 2002
time: 05:35
  Old Post 28-04-2004 03:30
Edit/Delete Message Reply w/Quote
#10 Report this post to a moderator
Put an end to popups!

Thanks Martin.

Still testing the current setup again to see if it happens again and check if I have damaged units in cities at the time.

stankarp is offline stankarp
Prince
australia
Feb 2002
time: 05:35
  Old Post 28-04-2004 09:25
Edit/Delete Message Reply w/Quote
#11 Report this post to a moderator
Support Apolyton buy from Amazon

Update.

On turn 125, I noticed I suddenly had 553 pw when I had been struggling with under 100 each turn. I had only managed to build roads to connect cities, not one mine, farm etc.

I turned off pw production, checked and found I had no damaged units in cities, ended turn and next turn I had 1411 PW. It seems like I suddenly start getting an AI's quota of pw. I had captured 3 cities, disbanded one, but hadnt captured one for 20 turns.

Mystery deepens.

stankarp is offline stankarp
Prince
australia
Feb 2002
time: 05:35
  Old Post 28-04-2004 09:59
Edit/Delete Message Reply w/Quote
#12 Report this post to a moderator
Support Apolyton buy from Amazon

I did a further check.

I commented out the repair slic file in script.slic, went back into the game, ended another turn and received another 800+ PW. I hit reload slic and ended turn and the extra pw did not happen again. I retried the exercise with and without any pw production and the results were the same. Until I reloaded slic I kept getting the extra PW. Reload slic and it stopped.

It has to be something in the repair slic code that is triggering it or establishing an association with PW_Cheat.slic.

Gilgamensch is offline Gilgamensch
King
France
Jun 2002
time: 06:35
  Old Post 28-04-2004 12:38
Edit/Delete Message Reply w/Quote
#13 Report this post to a moderator
Help yourself to an AD-FREE life

Just to recapture:

No damaged units, but PW being given.
You removed all/partial repair-slic? and it worked..... strange.......

How many units complete do you have? Maybe an overrun somewhere? Is it the only slic you are using?

stankarp is offline stankarp
Prince
australia
Feb 2002
time: 05:35
  Old Post 28-04-2004 15:12
Edit/Delete Message Reply w/Quote
#14 Report this post to a moderator
Enter the AD-FREE zone

At turn 125, I start getting 800+ pw if I am using the repair code, whether I have damaged units or not. If I hit reload slic which comments out the repair code slic file, then it stops.

I might try and just isolate the repair code into a separate file as it actually had 6 functions originally and I cut out several but there may be values, integers etc left in that are causing a problem.

I would really like to get this going ok as a lot of people, like Hex have been looking for ways to balance the game. Making war with the repair code means you commit a lot more resources or fight at a big disadvantage. Can only be good for play balance.

stankarp is offline stankarp
Prince
australia
Feb 2002
time: 05:35
  Old Post 28-04-2004 15:13
Edit/Delete Message Reply w/Quote
#15 Report this post to a moderator
Support Apolyton, buy Call to Power 2

I am using many slic files including a couple of special ones written for me by Pedrun, such as advance from city capture and a new supply unit.

stankarp is offline stankarp
Prince
australia
Feb 2002
time: 05:35
  Old Post 28-04-2004 15:15
Edit/Delete Message Reply w/Quote
#16 Report this post to a moderator
Tired of ads?

Re unit numbers, about 100 altogether but I dont think that has anything to do with it.

Gilgamensch is offline Gilgamensch
King
France
Jun 2002
time: 06:35
  Old Post 28-04-2004 15:25
Edit/Delete Message Reply w/Quote
#17 Report this post to a moderator
Support Apolyton, buy Call to Power 2

quote:
Originally posted by stankarp
At turn 125, I start getting 800+ pw if I am using the repair code, whether I have damaged units or not. If I hit reload slic which comments out the repair code slic file, then it stops.

I might try and just isolate the repair code into a separate file as it actually had 6 functions originally and I cut out several but there may be values, integers etc left in that are causing a problem.



Yep, sounds like the best idea in the moment.

quote:

I am using many slic files including a couple of special ones written for me by Pedrun, such as advance from city capture and a new supply unit.


Can you put the slic for this one in, maybe it has something to do with it.

And for the number of units: Just to see if there might have been an overrun somewhere.

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:35
  Old Post 28-04-2004 16: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
Avatar Enlargement: We've got the solution

Stankarp,

quote:
Originally posted by Locutus
If so, try disabling the SetHP lines of the SLIC code(there should be 2 of them: one following the second if statement and one as last line in the block following the elseif), see if you still get too much PW then? (The effect of this change will be that you're units are still repaired normally, but the cost is not deducted from your PW reserve.)


Have you tried this? (So JUST disabling the two SetHP lines, not the rest of the repair code.) By doing so we can establish if the extra PW you get is actually coming from the repair code or if the repair code is just interfering with some other code (e.g. the pw cheat), which I suspect.

stankarp is offline stankarp
Prince
australia
Feb 2002
time: 05:35
  Old Post 29-04-2004 02:04
Edit/Delete Message Reply w/Quote
#19 Report this post to a moderator
Got spare money?

Hi Locutus,

I havnt tried disabling HP as you suggested yet. Will try it now.

Thanks.

stankarp is offline stankarp
Prince
australia
Feb 2002
time: 05:35
  Old Post 29-04-2004 17:24
Edit/Delete Message Reply w/Quote
#20 Report this post to a moderator
Tired of ads?

OK, Firstly I tried putting the code in a separate file and started again. This time I got to turn 150 odd before it started happening. I lost a city on turn 149, retook it on 150 and got pw from the city capture code. Then next turn it started again, 500 odd pw arrived then next turn nearly 900.

I was saving every turn so I went back one turn, beefed up the city defences and it did not fall in that turn. However, the extra pw started happening on the same turn anyway. So went the theory that a city captured that gave a slab of pw triggered it happening.

I disabled the following lines;

//SetPW(tmpPlayer, (pw - pwCost));

and

//SetPW(tmpPlayer, (pw - pwCost));

relaoded slic and it stopped happening.

Theories or suggestions anyone. I really wanted this one to work, I think it really adds to the game.

Gilgamensch is offline Gilgamensch
King
France
Jun 2002
time: 06:35
  Old Post 29-04-2004 17:37
Edit/Delete Message Reply w/Quote
#21 Report this post to a moderator
Increase Your PM Length



This would mean that pw - pwcost would be negative.

For pwcost to be greater than pw

But the first problem is, if you don't have damaged units it shall not be happening.



Can you enable the first one again, which shall just get active if you have enough PW and let us know the result?

stankarp is offline stankarp
Prince
australia
Feb 2002
time: 05:35
  Old Post 30-04-2004 18:53
Edit/Delete Message Reply w/Quote
#22 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations: Deluxe Edition

I tried various things.

With both lines disabled, I got no bonus PW and full repair of units in one turn.

With the first line only disabled I got full repair and no bonus PW.

With the 2nd line only disabled, I got full repair plus bonus PW.

I tried playing with both lines open and disabling pw_Cheat.slc, the code that gives the AI pw points but I was still getting the extra pw points.

The conclusion is that something triggers the repair code to give me pw points. It works fine for 100+ turns then after that it starts. The earliest has been turn 110 and the latetst 150.

What about changing the code so that it only applies to the human player, ie, all ai units in cities heal automatically, since the ai gets lots of pw its academic anyway. I dont know enough about slic to do this yet.

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:35
Post  Old Post 01-05-2004 01:10 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#23 Report this post to a moderator
Increase Your PM Length

Maybe I should add my observations from GoodMod, I have there the city capture code in and also the pwcheat. If I play with the Barbarians capture a city then I get some of the pw of the victim that is indented, every turn this city generates pw, if I give away this city or let it capture someone else, I still get a pw bonuns even if I shouldn't get anything, I am neither an AI player (well this should be forced by the scenario editor) nor I own any single city (as Barbarian I can have zero cities). And of course this pw repair code is not in my slic database.

-Martin

stankarp is offline stankarp
Prince
australia
Feb 2002
time: 05:35
  Old Post 01-05-2004 03:42
Edit/Delete Message Reply w/Quote
#24 Report this post to a moderator
Support Apolyton buy from Amazon

Hi Martin,

I have the pw cheat and city capture code as standard but have not noticed getting that sort of pw bonus before. I am using the city capt code that does not give enslavement, only expand empire or bloodbath.

I am sure I have not been getting that large a bonus of pw before using this code. Maybe I should check, but when I comment out repair code altogether and play on for another 100 turns and monitor. I have occassionally noticed what I think is a small discrepancy in pw but I am talking 20 to 30 pw a turn, but if I turn off pw production, I dont get any pw. With repair code I am talking 800+ pw per turn wheher I produce pw or not.

Can U explain how to make repair code only work for the human player and leave out AI please?

stankarp is offline stankarp
Prince
australia
Feb 2002
time: 05:35
  Old Post 01-05-2004 03:49
Edit/Delete Message Reply w/Quote
#25 Report this post to a moderator
Support Apolyton, buy Call to Power 2

"but when I comment out repair code altogether and play on for another 100 turns and monitor"??

What I meant was comment out the repair code and play on for another 100 turns and see if the pw situation changes.

What Martin said is interesting because MEDMod does not use the PWcheat.slc or the city capture options slc. And lucutus said the pw bonus does not happen in MedMod.

stankarp is offline stankarp
Prince
australia
Feb 2002
time: 05:35
  Old Post 02-05-2004 10:52
Edit/Delete Message Reply w/Quote
#26 Report this post to a moderator
Increase Your PM Length

I commented out the repair code in script.slic and played another 70 turns. I did not get any extra pw that I am aware off so I was not getting the problem that Martin referred to.

I made two copies of the repair file, changed the handlers in the second one and inserted the line-
if(!(IsHumanPlayer(player[0])) && (player[0] != 0)) { // not human
and a }
at the end and the code works only for the ai.

I tried-

if(IsHumanPlayer(tmpPlayer)){ //ie human player only
with the extra } at the end
but it did not work for the human player.

I am hoping that if I separate the two functions the bonus PW problem might not happen.

Can anyone advise the correct peice of code to make something run only for the human player or player 1.

stankarp is offline stankarp
Prince
australia
Feb 2002
time: 05:35
  Old Post 02-05-2004 13:35
Edit/Delete Message Reply w/Quote
#27 Report this post to a moderator
Support Apolyton, buy Civilization III: Complete

For interest, I have attached the slic code for pw from pillage. I dont think any other code would affect pw except for the pw_cheat.slic code already in Cradle.

Attachment: crask_tlbonus.slc
This has been downloaded 1 time(s).

stankarp is offline stankarp
Prince
australia
Feb 2002
time: 05:35
  Old Post 04-05-2004 09:28
Edit/Delete Message Reply w/Quote
#28 Report this post to a moderator
Support Apolyton buy from Amazon

I tried to isolate the problem.

I started by going back to med mod and played for 175 turns and the pw bonus did not start.

I went back to my cradle mod and disabled every file that I found that changed pw, for ai and/or human player and replayed a turn in a game where the pw bonus started after reloading slic. While I had the repair code for the human enabled, I got the bonus pw that turn no matter what I did(changed moves, stopped the building of a wonder due that turn etc).

I re-enabled the slic codes and the repair code for the ai and disabled the repair code for the human and the bonus pw did not occur. It has something to do with setPW for the human player after a certain turn in the human version of the repair code while using cradle mod. I cant work it out.

I have attached the repair code for the human player, I am not sure it is working for only the human player. Could someone advise how to change it so it only works for the human player please.

Attachment: crask_humanrepair2.slc
This has been downloaded 0 time(s).

stankarp is offline stankarp
Prince
australia
Feb 2002
time: 05:35
  Old Post 10-05-2004 16:02
Edit/Delete Message Reply w/Quote
#29 Report this post to a moderator
Browse Apolyton AD-FREE

I have nearly solved the problem. I found I had accidentally increased the amount of pw the ai got through pwcheat.slc.

I reduced it back to thhe original amount and the problem nearly stoped. Occassionally I get a small amount of pw (5-25 points) and once every 20-40 turns seem to get a bag of up to 500 pw points, unrelated to my city cpaturing. The net effect is that the repair code is now working well enough to use.

Thanks for the help and suggestions.

stankarp is offline stankarp
Prince
australia
Feb 2002
time: 05:35
  Old Post 21-06-2004 04:19
Edit/Delete Message Reply w/Quote
#30 Report this post to a moderator
Increase Your PM Length

Update.

Regardless of what I did while I had the code in its original format, sometime after turn 100 I started to get an overflow of pw.

I sent it to Peter Triggs and he suggested removing the changes from player[0] to player[5] in the code and tidied it up a bit and it now works. I have played to turn 400 and not had any overflow problem I can detect except for possible a hand full of points occassionally (less than 20).

Thanks for Peter's help.

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:35.
Apolyton Time is 00:35.
    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.0620 seconds (91.55% PHP - 8.45% 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