Announcement

Collapse
No announcement yet.

Battles shoud destroy tile Improvments.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pedrunn
    replied
    Originally posted by Martin Gühmann

    This code should give you a change one seventh that your tile improvement will survive the battle.

    -Martin
    It just keeps getting better and better.

    Leave a comment:


  • Martin Gühmann
    replied
    Originally posted by Paulypav
    Is it possible to make it a random event as well, or is it basically the tile improvement gets destroyed when there's a battle on it. I'm guessing, based on my limited knowledge that it wouldn't be possible to make it occur randomly.
    This code should make it possible:

    Code:
    HandleEvent(BattleAftermath) 'pillage' pre {
    	int_t  i;
    	if (Random(6) > 0) {
    		for(i = 0; i < 24; i = i + 1){
    			if(TileHasImprovement(location[0], i)){
    				Event:CutImprovements(location[0]);
    			}
    		}
    	}
    }
    This code should give you a change one seventh that your tile improvement will survive the battle.

    -Martin

    Leave a comment:


  • Pedrunn
    replied
    I started the new game and i am almost at turn 100. I got some battles with the barbs and they worked fine. No crash. Although none of them were over tile imps. But they did get destroyed through the cheat mode.
    I think it is all ok now. Great Job IW.

    Leave a comment:


  • Pedrunn
    replied
    Thanks again IW i will try a new game now.
    And to think that i was going to give uo of this great idea :
    wish me good luck!

    Leave a comment:


  • Immortal Wombat
    replied
    Oops, this is the exact same problem that crashed the original natural disaster codes
    It works fine when there is a tile imp, because it can remove it. When there is not a tile imp, there is nothing to remove, and the game crashes.
    Take 2:
    Code:
    HandleEvent(BattleAftermath) 'pillage' pre {
            int_t  i;
            for(i = 0; i < 24; i = i + 1){
                   if(TileHasImprovement(location[0], i)){
                           Event:CutImprovements(location[0]);
                   }
            }
    }

    Leave a comment:


  • Pedrunn
    replied
    I have just finishing figuring up what happened.
    Since i was playing autosaved i went check to see if a battle really happened. The game crashed when it was the turn of the brown ones so they were the first checked.
    There was a battle after all. Among a barbarian Light calvary and a Brown Spearman. But surprisily there wasnt a tile not even close to the battle .
    I deleted the code and restarted the same game. I am curently at turn 70 and no sight of crashs. The Barbarians even attacked and conquered my capitol (those bastards).

    I do not get it! you make a code that work to destroy tile imps. but it crashs when a regular batle happens. Yet everything works fine through Cheat Mode.
    I did not get a good conclusion. And i hope someone did played this code. I want to know if it is just me (since my CTP2 is tottally full of others codes) or this did it happen with someone else.

    Leave a comment:


  • Paulypav
    replied
    Is it possible to make it a random event as well, or is it basically the tile improvement gets destroyed when there's a battle on it. I'm guessing, based on my limited knowledge that it wouldn't be possible to make it occur randomly.

    Even if you could make it random you would want it heavily weighted towards destroying the improvement. Leaving a percentage chance of the improvement surviving would reflect the percentage of improvements that survive overall, as partially destroying improvements would likely take way too much work.

    Leave a comment:


  • Immortal Wombat
    replied
    Uh-oh It wasn't me!

    I see no way that it can be, though the tile improvement functions are notoriously buggy...

    Sure Dave, tack it in anywhere, it has no variables, no functions, nothing.

    Leave a comment:


  • Pedrunn
    replied
    Unfornutelly since i got that code, Although it worked just fine through the cheat mode i am experiencing game crashs (3 times now) with the message the CTP2 caused an error on the CTP2.exe.
    All the crashs happen in abut turn 40-50 wich is the time barbarians ussually appears. My theory is that the AI x Barbarians combat are causing these crashs. Did someone who got this code are experiencing this problem. I will just start a game without it. And i will keep informing.

    Leave a comment:


  • hexagonian
    replied
    Can I just tack it onto the end of another one of your codes???

    Leave a comment:


  • Kull
    replied
    That is a great idea, Pedrunn. It's very realistic, and probably should be incorporated into the new mods. Perhaps a poll is in order to gauge the depth of opinion for or against?

    Wombat: Wow, talk about "Ask and ye shall receive"!

    Leave a comment:


  • Immortal Wombat
    replied
    It actually works? wow, that's surprised even me!

    Glad I could help, I had a bit of trouble posting earlier, but it seems to have come through ok.

    Leave a comment:


  • Pedrunn
    replied
    !!!!!!!

    Thanks IW.
    It is working.

    Leave a comment:


  • Immortal Wombat
    replied
    Code:
    HandleEvent(BattleAftermath) 'pillage' pre{
         Event:CutImprovements(location[0]);
    }
    Its that simlpe

    Leave a comment:


  • Pedrunn
    started a topic Battles shoud destroy tile Improvments.

    Battles shoud destroy tile Improvments.

    For the first time i lost to the AI today. I am not totally dead, but my lands become a battlefield. From that game i had an idea .
    Tile Improvments should be destroyed (pillaged) in a battle over them. That would add such a good and realistic feature. Does anyone know if that is possible?
Working...
X