Results 1 to 15 of 15

Thread: No building costs for the ai - possible? (PROBLEM SOLVED)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Artifex
    Join Date
    Mar 2010
    Location
    Sweden
    Posts
    1,314

    Default No building costs for the ai - possible? (PROBLEM SOLVED)

    Hello, I would like to make buildings free for the ai, or maybe cheaper for the ai than the player. Is that possible to do using the EDB only? I was thinking of something like this;

    cost 800

    changed to:

    cost 800 requires not event_counter is_the_ai 1

    Would that do the trick, or is there some other thing you have to do?
    Last edited by Maltacus; January 28, 2011 at 06:06 PM.

  2. #2
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: No building costs for the ai - possible?

    If you checked that and found it wasn't working (there will be an error in the log if it's not allowed).

    You can duplicate all buildings that you want to be free for the AI, and use that 'is_the_ai' event counter requirement to restrict the entire building.
    Last edited by Taiji; January 26, 2011 at 04:53 PM.

  3. #3
    Artifex
    Join Date
    Mar 2010
    Location
    Sweden
    Posts
    1,314

    Default Re: No building costs for the ai - possible?

    Good idea, but will the ai build its "own" buildings or stick with the shared ones, or a mix?

  4. #4

    Default Re: No building costs for the ai - possible?

    You create two same buildings having 2 counters, one that enables them only for the player other will be for AI only.

  5. #5
    Artifex
    Join Date
    Mar 2010
    Location
    Sweden
    Posts
    1,314

    Default Re: No building costs for the ai - possible?

    Are "player only" counters mod-specific or general? And how do such a counter look? I am playing with a version of Stainless Steel RR/RC, which doesn't use any such counter in the EDB afaik.

  6. #6
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: No building costs for the ai - possible?

    Quote Originally Posted by Maltacus View Post
    Are "player only" counters mod-specific or general? And how do such a counter look? I am playing with a version of Stainless Steel RR/RC, which doesn't use any such counter in the EDB afaik.
    They're mod-specific.

    Maybe you can negate the condition, or use 0 instead of 1, I wouldn't assume that you couldn't. Different parts of EDB work in different ways and I have not tested building requirement counters like I have capabilities.

    If what you really want is to avoid the problem of the AI not building certain buildings then personally I'd just script creation of the buildings that you want.
    Last edited by Taiji; January 27, 2011 at 08:24 AM.

  7. #7
    Artifex
    Join Date
    Mar 2010
    Location
    Sweden
    Posts
    1,314

    Default Re: No building costs for the ai - possible?

    OK. thanks. I'll ask around at the mod forum a bit, or think of something else. The problem is really that the ai overspends on units and lack buildings and therefore technology later in the game.

  8. #8
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: No building costs for the ai - possible?

    If the AI has overspent on units then you will have to kill them to see anything new even if they have the correct buildings. Either that or you wind up facing the immensely boring 'endless stacks of doom' grind. In other words if they are already unable to purchase buildings then only too much money will allow them to produce more units.
    Last edited by Taiji; January 27, 2011 at 11:10 AM.

  9. #9
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,751
    Blog Entries
    3

    Default Re: No building costs for the ai - possible?

    Rather than spending valuable building slots duplicating building why not just create a script that fires on the BuildingCompleted event?

    Code:
    monitor_event BuildingCompleted not FactionIsLocal
        if FactionType == X
            if SettlementBuildingFinished = governors_house
                console_command add_money x cost_of_governors_house
            end_if
            . . . ;add if statement for each building
        end_if
        ;add if for each faction like above
    end_monitor
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  10. #10

    Icon1 Re: No building costs for the ai - possible?

    Quote Originally Posted by Sqυιd View Post
    Rather than spending valuable building slots duplicating building why not just create a script that fires on the BuildingCompleted event?

    Code:
    monitor_event BuildingCompleted not FactionIsLocal
        if FactionType == X
            if SettlementBuildingFinished = governors_house
                console_command add_money x cost_of_governors_house
            end_if
            . . . ;add if statement for each building
        end_if
        ;add if for each faction like above
    end_monitor
    Sqυιd: Good idea but it maybe easier to make all buildings free, and then do this:
    Spoiler Alert, click show to read: 
    Code:
    	monitor_event BuildingCompleted SettlementIsLocal
    		and SettlementBuildingFinished = town_watch
    		if I_LocalFaction sicily
    		add_money sicily -1200
    	end_if
    		if I_LocalFaction milan
    		add_money milan -1200
    	end_if
    		if I_LocalFaction scotland
    		add_money scotland -1200
    	end_if
    		if I_LocalFaction moors
    		add_money moors -1200
    	end_if
    		if I_LocalFaction turks
    		add_money turks -1200
    	end_if
    		if I_LocalFaction egypt
    		add_money egypt -1200
    	end_if
    		if I_LocalFaction mongols
    		add_money mongols -1200
    	end_if
    		if I_LocalFaction england
    		add_money england -1200
    	end_if
    		if I_LocalFaction france
    		add_money france -1200
    	end_if
    		if I_LocalFaction hre
    		add_money hre -1200
    	end_if
    		if I_LocalFaction portugal
    		add_money portugal -1200
    	end_if
    		if I_LocalFaction spain
    		add_money spain -1200
    	end_if
    		if I_LocalFaction venice
    		add_money venice -1200
    	end_if
    	end_monitor
    
    	monitor_event BuildingCompleted SettlementIsLocal
    		and SettlementBuildingFinished = town_guard
    		if I_LocalFaction sicily
    		add_money sicily -1600
    	end_if
    		if I_LocalFaction milan
    		add_money milan -1600
    	end_if
    		if I_LocalFaction scotland
    		add_money scotland -1600
    	end_if
    		if I_LocalFaction moors
    		add_money moors -1600
    	end_if
    		if I_LocalFaction turks
    		add_money turks -1600
    	end_if
    		if I_LocalFaction egypt
    		add_money egypt -1600
    	end_if
    		if I_LocalFaction mongols
    		add_money mongols -1600
    	end_if
    		if I_LocalFaction england
    		add_money england -1600
    	end_if
    		if I_LocalFaction france
    		add_money france -1600
    	end_if
    		if I_LocalFaction hre
    		add_money hre -1600
    	end_if
    		if I_LocalFaction portugal
    		add_money portugal -1600
    	end_if
    		if I_LocalFaction spain
    		add_money spain -1600
    	end_if
    		if I_LocalFaction venice
    		add_money venice -1600
    	end_if
    	end_monitor
    
    	monitor_event BuildingCompleted SettlementIsLocal
    		and SettlementBuildingFinished = city_watch
    		if I_LocalFaction sicily
    		add_money sicily -2800
    	end_if
    		if I_LocalFaction milan
    		add_money milan -2800
    	end_if
    		if I_LocalFaction scotland
    		add_money scotland -2800
    	end_if
    		if I_LocalFaction moors
    		add_money moors -2800
    	end_if
    		if I_LocalFaction turks
    		add_money turks -2800
    	end_if
    		if I_LocalFaction egypt
    		add_money egypt -2800
    	end_if
    		if I_LocalFaction mongols
    		add_money mongols -2800
    	end_if
    		if I_LocalFaction england
    		add_money england -2800
    	end_if
    		if I_LocalFaction france
    		add_money france -2800
    	end_if
    		if I_LocalFaction hre
    		add_money hre -2800
    	end_if
    		if I_LocalFaction portugal
    		add_money portugal -2800
    	end_if
    		if I_LocalFaction spain
    		add_money spain -2800
    	end_if
    		if I_LocalFaction venice
    		add_money venice -2800
    	end_if
    	end_monitor
    
    	monitor_event BuildingCompleted SettlementIsLocal
    		and SettlementBuildingFinished = militia_drill_square
    		if I_LocalFaction sicily
    		add_money sicily -4500
    	end_if
    		if I_LocalFaction milan
    		add_money milan -4500
    	end_if
    		if I_LocalFaction scotland
    		add_money scotland -4500
    	end_if
    		if I_LocalFaction moors
    		add_money moors -4500
    	end_if
    		if I_LocalFaction turks
    		add_money turks -4500
    	end_if
    		if I_LocalFaction egypt
    		add_money egypt -4500
    	end_if
    		if I_LocalFaction mongols
    		add_money mongols -4500
    	end_if
    		if I_LocalFaction england
    		add_money england -4500
    	end_if
    		if I_LocalFaction france
    		add_money france -4500
    	end_if
    		if I_LocalFaction hre
    		add_money hre -4500
    	end_if
    		if I_LocalFaction portugal
    		add_money portugal -4500
    	end_if
    		if I_LocalFaction spain
    		add_money spain -4500
    	end_if
    		if I_LocalFaction venice
    		add_money venice -4500
    	end_if
    	end_monitor
    
    	monitor_event BuildingCompleted SettlementIsLocal
    		and SettlementBuildingFinished = militia_barracks
    		if I_LocalFaction sicily
    		add_money sicily -8200
    	end_if
    		if I_LocalFaction milan
    		add_money milan -8200
    	end_if
    		if I_LocalFaction scotland
    		add_money scotland -8200
    	end_if
    		if I_LocalFaction moors
    		add_money moors -8200
    	end_if
    		if I_LocalFaction turks
    		add_money turks -8200
    	end_if
    		if I_LocalFaction egypt
    		add_money egypt -8200
    	end_if
    		if I_LocalFaction mongols
    		add_money mongols -8200
    	end_if
    		if I_LocalFaction england
    		add_money england -8200
    	end_if
    		if I_LocalFaction france
    		add_money france -8200
    	end_if
    		if I_LocalFaction hre
    		add_money hre -8200
    	end_if
    		if I_LocalFaction portugal
    		add_money portugal -8200
    	end_if
    		if I_LocalFaction spain
    		add_money spain -8200
    	end_if
    		if I_LocalFaction venice
    		add_money venice -8200
    	end_if
    	end_monitor

  11. #11
    gracul's Avatar 404 Not Found
    Artifex

    Join Date
    Dec 2007
    Location
    Poland
    Posts
    2,009

    Default Re: No building costs for the ai - possible?

    SS uses such system, i dunno if RR\RC does.
    Basically you add this to the EDB for every core_settlement and core_castle_settlement:
    Code:
    construction_cost_bonus_stone bonus 90 requires event_counter is_the_ai 1
    construction_cost_bonus_wooden bonus 90 requires event_counter is_the_ai 1
    I haven't tested trying 100, but its easy to check.
    In the campaign script you need to add:
    Code:
    ;===================== Is the AI? =======================
    monitor_event PreFactionTurnStart FactionIsLocal
        set_event_counter is_the_ai 0
    end_monitor
    
    monitor_event PreFactionTurnStart not FactionIsLocal
        set_event_counter is_the_ai 1
    end_monitor
    But that should already be inside RR\RC.

    @Squid
    FactionType requires an event which exports a faction, so you can't use it in an if, same for SettlementBuildingFinished which requires a settlement.

  12. #12
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,751
    Blog Entries
    3

    Default Re: No building costs for the ai - possible?

    Quote Originally Posted by gracul View Post
    @Squid
    FactionType requires an event which exports a faction, so you can't use it in an if, same for SettlementBuildingFinished which requires a settlement.
    I thought RS2 was using something like what I suggested, but I tested it and it isn't working, but even if it did you solution is more elegant and requires less code than mine would have.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  13. #13
    Germanicu5's Avatar Will buy spare time...
    Join Date
    Feb 2009
    Location
    Not Zee Germany
    Posts
    2,101

    Default Re: No building costs for the ai - possible?

    @gracul

    I tested 100% discount over >80 turns when I first wrote economy modification code intended for RC\RR (back when you, me and Roz had a discussion on it), it seemed to work correctly, just as any of other several settings I tried.

    PB never included it in RC\RR, he wasn't a fan of this solution (as opposed to us ).

    Regards
    I have no memory of this place.

  14. #14
    gracul's Avatar 404 Not Found
    Artifex

    Join Date
    Dec 2007
    Location
    Poland
    Posts
    2,009

    Default Re: No building costs for the ai - possible?

    i'd love to see how AI 'prioritorizes' buildings by setting overall bonus to 50%, but wall bonus to 100% (construction_cost_bonus_defensive).
    BTW, anyone tested how construction time bonuses affect the AI? (construction_time_bonus_xxx)

  15. #15
    Artifex
    Join Date
    Mar 2010
    Location
    Sweden
    Posts
    1,314

    Default Re: No building costs for the ai - possible?

    Thanks for the help everyone .

Posting Permissions

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