Results 1 to 4 of 4

Thread: Religion Points Script

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

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

    Default Religion Points Script

    This script is supposed to check for a building being created or destroyed in a settlement of religious nature, then add to a counter depending on which faction is controlling it and which building it is. Should also account for the counter being reduced when a building is destroyed, by the number it increases the counter plus its predecessors. This counter is then used to create/destroy buildings that can impact religious conversion to a particular religion, since the 7 buildable ones have no religious association.

    Looking for other ways to do this than the current method, since unless I calculated wrong it would take well millions of lines of code to complete the script in current form.

    Code:
    ;Check Lin-an
    monitor_event BuildingCompleted SettlementBuildingFinished = religious_A1
    		and SettlementName Lin-an
    		and I_SettlementOwner Lin-an song
    
    		inc_counter settlement_religion_daoxue_Lin-an 1
    
    end_monitor
    
    ;Fix counter if a building is destroyed
    monitor_event BuildingDestroyed BuildingName = religious_A1
    		and SettlementName Lin-an
    		and I_SettlementOwner Lin-an song
    
    		inc_counter settlement_religion_daoxue_Lin-an -1
    
    end_monitor
    A sample of the current code for one building for one faction for one city. In current form it would need to be replicated:

    Lines of Code x Factions x Cities x Buildings

    So:

    10 x 15 x 190 x 63

    AKA 1.8 million lines of code....(that doesn't even count the create/destroy code)

    Sooooo, that obviously isn't the best option. Need to find some other way of doing this.

    Might be able to cut out the faction-specific part if I associate each tree to a counter for a faction. Like:

    religious_A_is_daoxue
    religious_A_is_mahayana

    etc.

    Then could use if statements and wouldn't have to include faction since that would be determined elsewhere. This would eliminate the factions replication, and make the lines of code needed ~48 more. That would end up being:

    58 x 190 x 63

    ~700,000 lines of code. Not a hell of a lot better, but better.

    I can't cut any of the other 3 parts that factor into the total amount. I could possibly use Plug-Ins to determine the region, and then use that inside more if statements, but nested if statements have never been that nice to me, and I'm not sure if it would even marginalize the total lines required.
    Last edited by Augustus Lucifer; February 13, 2009 at 12:21 AM.

  2. #2
    S-te-Fan's Avatar Primicerius
    Join Date
    Jun 2008
    Location
    Diessen, The Netherlands, Near the belgium border.
    Posts
    3,905

    Default Re: Religion Points Script

    ghe ghe... 2.3 million of code. Good luck with finding something else .

  3. #3
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Religion Points Script

    hmmmm

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

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

    Default Re: Religion Points Script

    Revisiting this, taking a different approach. It's obvious that the building-related religious conversion methods are useful but faulty. Doing this by building conversion buildings would be hell, so going to attempt to do it using script commands. It's still pretty restrictive but I can see it working better.

    This is a very small code snippet:
    Code:
    ;**********Script 1H-2. Religion Conversion**********
    ;|Author| Augustus Lucifer
    ;|Purpose| Lets the player set conversion policies.
    ;|Changelog|
    ; o Script Created 7-09-09
    
    monitor_event FactionTurnEnd FactionIsLocal
    		and FactionReligion daoxue
    if I_LocalFaction song
    	if I_EventCounter religious_tolerance == 1
    		change_population_religion song daoxue 1 islam
    		change_population_religion song daoxue 1 mahayana
    		change_population_religion song daoxue 1 theravada
    		change_population_religion song daoxue 1 tengriism
    		change_population_religion song daoxue 1 vajrayana
    		change_population_religion song daoxue 1 heretic
    	end_if
    	if I_EventCounter religious_sponsorship == 1
    		change_population_religion song daoxue 2 islam
    		change_population_religion song daoxue 2 mahayana
    		change_population_religion song daoxue 2 theravada
    		change_population_religion song daoxue 2 tengriism
    		change_population_religion song daoxue 2 vajrayana
    		change_population_religion song daoxue 2 heretic
    	end_if
    	if I_EventCounter religious_persecution == 1
    		change_population_religion song daoxue 3 islam
    		change_population_religion song daoxue 3 mahayana
    		change_population_religion song daoxue 3 theravada
    		change_population_religion song daoxue 3 tengriism
    		change_population_religion song daoxue 3 vajrayana
    		change_population_religion song daoxue 3 heretic
    	end_if
    end_if
    end_monitor
    So far all it does is check player faction, check current religion, and then check an event counter to determine how much to convert. There's a lot of things it doesn't do. Things which need to be added still:

    - System for player setting policy: Tolerance, Sponsorship, Persecution
    Possibly base it on advice request of some religious-related scroll or a priest selection or something of that nature.
    - Random chance to convert so it isn't converting all the time
    - Random chance modified by "likeness" of target religion to state religion
    - Random chance modified by cultural policy
    - Could also modify by buildings but this would be much harder and likely make a much longer script

    This is tied in with lack of religious association for religious structures, and a lowered religious unrest modifier in the mechanics file, as well as a system by which the player can change state religion.

    All of these need to be counterbalanced by a cost, and should be tied in with religious uprisings.

Posting Permissions

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