Results 1 to 30 of 102

Thread: A Beginner's Guide to Scripting & Scripting "How To"s

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    I seem to have a wierd problem with the following code:

    Code:
    declare_counter aedui_age
    set_counter aedui_age 11
    
    ;AI - console_command date -300 (BC)
    monitor_event FactionTurnStart Factiontype gauls
    and not I_LocalFaction gauls
    and I_CompareCounter aedui_age >= 10
    and I_TurnNumber > 1
    	set_counter aedui_age 12
    terminate_monitor
    end_monitor
    
    monitor_event SettlementTurnStart SettlementName Burdigala
    and I_SettlementOwner Burdigala = gauls
    and I_CompareCounter aedui_age = 12
    and not SettlementBuildingExists = agee2
    	console_command set_building_health Burdigala agee 0
    	console_command create_building Burdigala "agee2"
    end_monitor
    When I am using the faction gauls, the building will be created properly in the settlement.
    The problem only occurs when I am not using the faction gauls, whereby the game will always crash when the turn for the AI faction gauls start after clicking the end turn.
    I initially thought that it may not be possible to create buildings for AI factions... but the code below worked, in which the building agee1 is lower in the hierarchy than agee2 in EDB. So I'm not really sure why the code causes the game to crash and not work as expected.

    Code:
    declare_counter aedui_age
    set_counter aedui_age 11
    
    ;AI - console_command date -300 (BC)
    monitor_event FactionTurnStart Factiontype gauls
    and not I_LocalFaction gauls
    and I_CompareCounter aedui_age >= 10
    and I_TurnNumber > 1
    	set_counter aedui_age 11
    terminate_monitor
    end_monitor
    
    monitor_event SettlementTurnStart SettlementName Burdigala
    and I_SettlementOwner Burdigala = gauls
    and I_CompareCounter aedui_age = 11
    and not SettlementBuildingExists = agee1
    	console_command set_building_health Burdigala agee 0
    	console_command create_building Burdigala "agee1"
    end_monitor
    Next, I tried working around the crash by inserting one additional line to building creation code as shown below. The game did not crash like before, but the building agee2 failed to be created. Then I tested it out with agee6 and it worked only for a certain settlement, i.e. rest of the settlements do not have the building agee6 created despite the code being executed.

    Code:
    monitor_event SettlementTurnStart SettlementName Burdigala
    and I_SettlementOwner Burdigala = gauls
    and I_CompareCounter aedui_age = 12
    and not SettlementBuildingExists = agee2
    	console_command set_building_health Burdigala agee 0
    	console_command create_building Burdigala "agee1"
    	console_command create_building Burdigala "agee2"
    end_monitor
    The building levels are as follows:
    building agee
    {
    levels agee1 agee2 agee3 agee4 agee5 agee6 agee7 agee8
    {
    ...
    Last edited by lim_lucky; 12-31-2009 at 23:26.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO