Announcement

Collapse
No announcement yet.

SLIC problem

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

  • SLIC problem

    Ok here's a little problem for everyone. Basically when the code below runs the game stops/slows down for a couple of minutes and then returns to normal.

    HandleEvent(CreateCity) 'HomeCity' post {
    city_t tmpCity;
    unit_t tmpUnit;
    location_t cityloc;
    tmpCity = city[0];
    int_t homecity[];
    int_t tmpPlayer;
    tmpPlayer = player[0];
    cityloc = location[0];
    CreateUnit(player[0], UnitDB(UNIT_WAR_CHIEF), cityloc, 0);
    homecity[tmpUnit] = tmpCity.name;
    message(tmpPlayer, 'five');
    }
    Basically what I want the SLIC to do is when a city is built, for my War Chief unit to be built with it and for the city the unit is built in to be stored so that I can find out the units home city in the future.

    The line that is messing things up is:

    homecity[tmpUnit] = tmpCity.name;
    I don't think this part even works so what am doing wrong? (I haven't been using SLIC very long if you haven't already guessed)

    All I want to be able to do is get the home city of the unit when I want.

    I hope some of that made sense .
    Shores Of Valinor.com - The Premier Tolkien Community -

  • #2
    tmpCity.name is a string.
    homecity[tmpUnit] is an integer.
    The one cannot be stored in the other.

    If you are doing what I think, that is, assign the unit's home city to the homecity[] array, then you need homecity[] to be a city_t array.

    You also need to change
    Code:
    homecity[tmpUnit] = tmpCity.name;
    to
    Code:
    homecity[tmpUnit] = tmpCity;
    And that should sort it.

    Its great to see you SLICing Turambar
    Concrete, Abstract, or Squoingy?
    "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

    Comment


    • #3
      Why would you want homecity[tmpUnit] to equal tmpCity.name ?

      If it is for the message. just write {tmpCity.name} or {city[0].name}in the message it will read as the city name. It does not have to be in the code so delete this part.
      "Kill a man and you are a murder.
      Kill thousands and you are a conquer.
      Kill all and you are a God!"
      -Jean Rostand

      Comment


      • #4
        IW:

        Just the programming coming out of me, but why store the entire city (and filling a lot of RAM if you have MANY units) if you can just store the city location? A lot less RAM hungry. Just a thought. Another benefit is if you want your unit to go home, just pass homecity[tmpUnit] into it's movement path.

        Comment


        • #5
          Yeah, I guess. Depends why Turambar's doing it I guess.
          Concrete, Abstract, or Squoingy?
          "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

          Comment


          • #6
            Thanks for the responses I'll try them out soon.

            The idea behind this is:

            A War Chief unit (these upgrade the more they win) is created in each city and I want to store where it comes from so that, for example if another civ takes London then the war chief from there who may be in a 12 stack army (being the leader of it) might (I'm going to give them personalities) then disobey your orders (if you order him not to retake the city) and go and try to retake his home city.

            Also if he dies then a replacement can be built in that city.

            I'll also want to use it in messages.

            I've a few other half developed ideas in addition to this too.

            More questions to follow .
            Shores Of Valinor.com - The Premier Tolkien Community -

            Comment


            • #7
              Hi, all
              Does anybody know what mean BombRounds and BombardRange strings in Units.txt? Is it active or disabled?

              Is it possible to write SLIC's for Civ-specific units and Run after bombard (if Unit have enough move point after bombard action)?

              Regards.

              Comment

              Working...
              X