Really weird upgrade bug.

Discussion in 'Modding' started by Ftoomsh, Sep 13, 2017.

  1. Ftoomsh

    Ftoomsh Active Member

    In OCMOD3 I have added Piedmont and Switzerland. Everything looks fine at a first test except for a really weird bug that I have with Switzerland's 18th C dragoon. Its attack upgrade button appears at spot 1,1 instead of at spot 5,1. This is even though the add upgrade code is correct (no mis-matches with the standard file) and even though all other generic 18th C dragoons have their attack upgrade button placed in the right place. The same code applies to all drags anyway so why would the Swiss drag come out different?

    Even more weird, the costs for the upgrade and the benefits from the upgrade for the Swiss 18th C drag derive from the upgrade costs and benefits values of the Swiss 18th C drag defense upgrades. Yet when the upgrade is run (it still runs) it applies the upgrade to the attack values of the Swiss 18th C drag!

    Has anyone seen anything this whacky when the upgrade code blocks match perfectly with vanilla? Is some other indexing code wrong somewhere else maybe? Any thoughts? I really don't know where to look for the cause of this bug.
     
  2. Bodun

    Bodun Administrator Staff Member

    Hello Ftoomsh,

    Could you, please, send a country.script in PM? Seems like a really weird problem.

    Best regards.
     
  3. Ftoomsh

    Ftoomsh Active Member

    I will do that, thanks. :)

    I will also post in this modding section a new discussion about modding about modding and modding support from admins and developers. Rest assured it will be positive and will have constructive suggestions.
     
    Last edited: Sep 14, 2017
  4. Ftoomsh

    Ftoomsh Active Member

    Bodun has replied to me in a PM and given me the fix for my bug. And he has pointed out another possible issue I need to look at. This is great support! Many thanks to Bodun for his quick and accurate reply.

    :)

    Of course, I go green with envy when a real programmer can find a fault quickly when I can't find it in an hour... and finds it when looking at my messy code. :confused:
     
  5. icosferu

    icosferu Active Member

    And what was the problem?
     
  6. Ftoomsh

    Ftoomsh Active Member

    I had missed adding the line for Swiss Jaeger upgrade. That it turn did the weird thing I mentioned to the Swiss Dragoon upgrade. I was looking in the wrong place. I hadn't done enough testing to notice my Swiss Jaeger upgrade was missing. In the code I missed it because I have added another line to give Scots the Highlander as well. This meant that block of code seemed the right size and as I passed my eye over it I did not notice the Jaeger line was missing. Also, I change parameters and that causes mismatch highlights which I then ignore because I know they are my changes. Ignoring mismatches in a block can be a trap because one of them can be a real one like this case. It was my first update after a break for two months too. I just missed it.

    I know... excuses, excuses. :)