Results 1 to 11 of 11

Thread: Adding requirements for recruiting units.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    ^Mr.S's Avatar Foederatus
    Join Date
    Jun 2007
    Location
    Too far south in the US.
    Posts
    45

    Default Adding requirements for recruiting units.

    Hello, I was wondering if someone would know how to add a requirement to recruiting a unit (like the line after Conquistadores, "and hidden_resource america") Specifically I am trying to make it so that I'd have to build the appropriate smith building to recruit a unit that has a base armour level of what that smith building supplies (i.e. having to build the "Heavy Armourer" building in order to recruit Dismounted Feudal Knights.) I tried adding the line "and building blacksmith" after Mailed Knights but the game crashed. I don't have any other ideas and any help is appreciated.

  2. #2
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,725

    Default Re: Adding requirements for recruiting units.

    This line is used in some of the buildings:

    Code:
            docklands city requires factions { northern_european, middle_eastern, eastern_european, greek, southern_european, }  and building_present_min_level port port
    .
    .
    All of the EDB should work the same, since you can use hidden_resource and event_counter in both unit and building within the EDB. Then again, stranger things have been possible and simpler things have been impossible. But I'd try using that after the unit. The first one is the building tree and the second is the level of the building.

    Alternatively if that doesn't work, you need to set up a long script for every settlement or for specific regions which makes an event_counter trigger. Like:

    Code:
    monitor_event SettlementTurnEnd SettlementIsLocal
                and IsRegionOneOf 1
                and SettlementBuildingExists > armory
    set_event_counter armory_X(settlement name) 1
    end_monitor
    Didn't check all of that for accuracy, but you get the general idea.

    I intend to use a similar effect to circumvent the need for a castle and city version of recruitment structures by just checking for if there is a castle or city in the settlement, thus eliminating a building tree wasted.
    Last edited by Augustus Lucifer; October 24, 2008 at 07:29 PM.

  3. #3
    ^Mr.S's Avatar Foederatus
    Join Date
    Jun 2007
    Location
    Too far south in the US.
    Posts
    45

    Default Re: Adding requirements for recruiting units.

    Thanks a lot for replying! I tried adding the line to EDB, but it crashed whenever I tried to start a campaign. I first noticed I was using the city smith on a castle unit, so I changed that but it still crashed. I understand the second concept (with the script) but I don't know where to write the event_counter trigger. So basically, what file to I add that to? I tried snooping around but I can't find any place that seems appropriate.

  4. #4

    Default Re: Adding requirements for recruiting units.

    Events are in descr_events under the imperial campaign folder. What I always forget is where the optional events go such as the Kalmar Union in Teutonic.

    Edit:Testing it out, but I can't get it to work either and I've used event and hidden resources triggers before so I know how the basic thing works.
    Last edited by SSJPabs; October 24, 2008 at 09:41 PM.

  5. #5
    ^Mr.S's Avatar Foederatus
    Join Date
    Jun 2007
    Location
    Too far south in the US.
    Posts
    45

    Default Re: Adding requirements for recruiting units.

    I tried it and couldn't get it to work, either. I'm fairly sure this has been done in a mod before, so I think it can be done.

  6. #6

    Default Re: Adding requirements for recruiting units.

    You have to state the building line as well as the building level. For more on the EDB file and specifics, check out this article - http://medieval2.heavengames.com/m2t...de/index.shtml

    Coder on Dark Ages: Roman Revival, the alternate history mod for BI.

    Under the Patronage of Augustus Lucifer, member of the House of Ward.

  7. #7
    ^Mr.S's Avatar Foederatus
    Join Date
    Jun 2007
    Location
    Too far south in the US.
    Posts
    45

    Default Re: Adding requirements for recruiting units.

    " and building_present_min_level castle_smith c_blacksmith" is the line I added after the Mailed Knights line in the "Castle" building. Is that incorrect?

  8. #8

    Default Re: Adding requirements for recruiting units.

    That should do the trick.

    Coder on Dark Ages: Roman Revival, the alternate history mod for BI.

    Under the Patronage of Augustus Lucifer, member of the House of Ward.

  9. #9
    ^Mr.S's Avatar Foederatus
    Join Date
    Jun 2007
    Location
    Too far south in the US.
    Posts
    45

    Default Re: Adding requirements for recruiting units.

    As much as I would like it to be the trick, it's not. It still crashes when I try to start a campaign. I can't understand why it would do this, and the system.log even just says "unspecified error." Hmph.

  10. #10
    Kundich's Avatar Ordinarius
    Join Date
    May 2007
    Location
    Knoxville, TN
    Posts
    742

    Default Re: Adding requirements for recruiting units.

    If it was working prior to your small modifications, it seems likely that you've developed a syntax error in the EDB, as a campaign_script error won't throw at unspecified error. Check your error log for errors. It will likely point you directly to the parsing error. It will occur perhaps many lines above where the crash is reported.


    Thanks,
    ADM

  11. #11
    ^Mr.S's Avatar Foederatus
    Join Date
    Jun 2007
    Location
    Too far south in the US.
    Posts
    45

    Default Re: Adding requirements for recruiting units.

    I checked the log for errors, and it found about a dozen in EDB, but none of them had to do with what I modified (I made the errors nearly a year ago, and the game ran fine with these errors.) Maybe it'll work, however. I'll test it later when I have time.
    It still doesn't work. Here is the exact line.
    14:24:13.218 [system.rpt] [error] Medieval 2: Total War encountered an unspecified error and will now exit.
    Last edited by ^Mr.S; October 28, 2008 at 01:23 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •