Really weird upgrade bug.

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

  1. Ftoomsh

    Ftoomsh Well-Known 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 Well-Known 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 Well-Known 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 Well-Known 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. :)
  7. Wralth

    Wralth Active Member

    Ive encountered this bug previously. As far as i can tell there is some really nasty voodoo crap going on behind the scenes of the upgrade code. I remember fixing it once by adding an invisible upgradepath for some unit that didnt even exist in the country so then that path would be bugged instead.

    Part of the reason i completely forewent unit upgrades to instead upgrade damage and armor types for each nation.
  8. Ftoomsh

    Ftoomsh Well-Known Member

    Even in the scripts, I can see the upgrade code is a tangle with those additional upgrades added in a strange manner. Luckily, I don't try to do anything too clever with unit upgrades. I simply change their costs to suit OCMOD3 design. Or you can reduce the number of unit upgrades easily enough. I tried that but discovered many players love the multiple upgrades... so I re-instated them.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice