Announcement

Collapse
No announcement yet.

Units don't keep their MovePath

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

  • Units don't keep their MovePath

    I am currently playing/testing my own Mod, but I am fairly sure this issue is not related to my modifications (i even disabled "clearorders.slc" to exclude the possibility of IsHumanPlayer eventually being broken -- in this case the movepath orders of 1/5 of my units would have been cleared by the SLIC each turn):

    Units (randomly as it seems) don't keep their movepath orders, and the grey line that usually displays their movepath for the next turn(s) is not displayed. Some units keep their movepath but the grey line isn't displayed either.



    P.S.: I am using E's build 557.
    The modding knowledgebase: CTP2 Bureau (with CTP2 AE Modding Wiki). Modern Times Mod (work in progress): MoT-Mod for CTP2.

  • #2
    Ok, I fixed it ! Something in militia.slc must have caused the problem. I tracked it down by including my scripts step by step. I could not figure out what's the problem since I am using an almost original version of Locutus' old militia code, which used to work with CTP2 1.11. Finally all I did with the script was cleaning up the code a bit:
    • made sure that all SLIC functions for "getting something from something else" (GetUnitFromArmy, GetCityByLocation etc.) are used in a "conditional" way (their return value is evaluated) -- like e.g.
      Code:
      if(GetUnitFromArmy(milTmpArmy1, milCountB, milTmpUnit1)) {
      instead of just writing
      Code:
      GetUnitFromArmy(milTmpArmy1, milCountB, milTmpUnit1);
    • made sure that "pre" event handlers returning
      Code:
      if(something) {
      	return STOP;
      }
      also return
      Code:
      else {
      	return CONTINUE;
      }
    • additionally I took care of using "local" variables with different names in all functions and event handlers (well at least in those which appear in a similar context like e.g. MoveOrder and MoveToOrder), which might be unnecessary but it can't hurt either.

    I don't know which one of these measures solved the problem, but it's gone.

    One issue still remains:

    Somehow the program does not recognize the militia units created and entrenched by the codelines

    Code:
    CreateUnit(milTmpPlayer, MIL_MILITIA_TYPE[milAge], milTmpLoc, 0, milTmpUnit);
    Event:EntrenchUnit(milTmpUnit);
    as a garrison: The garrison-icon next to the city does not show up (which does not hurt too much, since the units are there and entrenched and you know there is a militia unit in each city anyway). As soon as I build and entrench the first "regular" unit in a city the icon shows up as expected.

    It seems that CTP2 Apolyton Edition is a little bit more strict regarding SLIC code than it's predecessor, which is not bad at all -- I just have to read the documentation more carefully and will continue cleaning up the code .
    The modding knowledgebase: CTP2 Bureau (with CTP2 AE Modding Wiki). Modern Times Mod (work in progress): MoT-Mod for CTP2.

    Comment


    • #3
      Originally posted by BureauBert
      as a garrison: The garrison-icon next to the city does not show up (which does not hurt too much, since the units are there and entrenched and you know there is a militia unit in each city anyway). As soon as I build and entrench the first "regular" unit in a city the icon shows up as expected.
      Well so far as I know the entrench icon doesn't show up emidiately, it needs a turn.

      Originally posted by BureauBert
      It seems that CTP2 Apolyton Edition is a little bit more strict regarding SLIC code than it's predecessor, which is not bad at all -- I just have to read the documentation more carefully and will continue cleaning up the code .
      To be precise it does more what it is supposed to do.

      -Martin
      Civ2 military advisor: "No complaints, Sir!"

      Comment

      Working...
      X