Results 1 to 14 of 14

Thread: rebellion script

Hybrid View

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

    Default rebellion script

    Does anyone have a short code snipet that demonstrates a basic field army rebellion that occurs based upon the settlement order level?

    Cheers
    "I don't want to sit around Windsor because ermm .. I just generally don't like England that much" - Prince Harry, 3rd in Line for the British Thrown



    For King or Country - The English civil wars.

  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: rebellion script

    Are you asking for a command to force a unit to rebel? Because I've looked in all of the command areas and through all of the console commands before and haven't found anything which seems to indicate it can make a unit rebel. There's the "provoke_rebellion" command but that seems to only work for settlements. And of course there's the workaround of killing the units and re-spawning them, though I can't say I've tried this before, there do seem to be commands which can query the units for this sort of thing.

    Or do you mean just a script for increasing the chance of a field army rebelling and not literally forcing it?

    Cheers.,
    Augustus

  3. #3

    Default Re: rebellion script

    Sorry I should of made my request clearer.

    I'm actually talking about the rebel faction. I want to spawn a rebel army, in a region with a low level of order.

    Cheers
    "I don't want to sit around Windsor because ermm .. I just generally don't like England that much" - Prince Harry, 3rd in Line for the British Thrown



    For King or Country - The English civil wars.

  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: rebellion script

    Ah, well there's a few ways to do that, I haven't made any scripts for it so I'm running on my index and such, but it seems like this one is the best:

    Code:
    Identifier:              SettlementLoyaltyLevel
    Trigger requirements:    settlement
    Parameters:              logic token, value (loyalty_revolting, loyalty_rioting, loyalty_disillusioned, loyalty_content, loyalty_happy)
    Sample use:              SettlementLoyaltyLevel > loyalty_rioting
    Description:             How loyal is the settlement?
    Battle or Strat:         Either
    Class:                   SETTLEMENT_LOYALTY_LEVEL
    Implemented:             Yes
    Author:                  Guy
    So then something like:

    monitor_event SettlementTurnEnd SettlementLoyaltyLevel <= loyalty_rioting
    and IsRegionOneOf London_Province
    and RegionIsLocal
    and FactionType Parliamentarians
    and I_EventCounter time_since_rebellion = 0

    set_event_counter rebellion 1

    if I_EventCounter rebellion = 1
    spawn_army
    faction slave
    character Guy McGuyguy, named character, age 24, x 0, y 0
    traits SuperAwesomeCool 1
    unit etc. etc. etc. for army information

    set_event_counter time_since_rebellion 10
    end_if

    monitor_event FactionTurnEnd FactionIsLocal
    and I_EventCounter time_since_rebellion >= 1

    inc_event_counter time_since_rebellion -1
    end_monitor

    ----------------------------------------------

    Something like that would work. Obviously you'd want to do it per province, this increases your control over the army which is spawned and where. You can also use successive rebellions with the if statements, and mess with the time_since_rebellion counter, which is essentially there to prevent it from rebelling every subsequent turn. The best method would have a counter for each region as well, so that you can have rebellions spaced 10 turns per province but not impossible in separate regions. Oh and the character info and x y are obviously just placeholders.

    Is that what you were looking for?

    Cheers,
    Augustus
    Last edited by Augustus Lucifer; September 25, 2008 at 01:53 AM.

  5. #5

    Default Re: rebellion script

    In my Recruitment limitations script i have a section that spawns a few rebel units if a settlement has over drafted. (drafting is another part of the script). basically what it does is spawns a rebel army in the province based on a random number which is determined dependant on how often the player has drafted. Honestly ity is a constant work in progress as i am always updating it... but i think the general idea behind it may be what your looking for... this is just a snipet form the script...
    Spoiler Alert, click show to read: 


    Code:
     
    if I_CompareCounter drafted >= 3
    and RandomPercent > 65
    add_settlement_turmoil Nottingham 15
    freeze_recruit_pool Nottingham_Province true
    console_command add_population Nottingham -100
    spawn_army
    faction slave
    character random_name, general, age 20, x 73, y 224
    unit Peasants exp 0 armour 0 weapon_lvl 0
    unit Peasants exp 0 armour 0 weapon_lvl 0
    unit Peasants exp 0 armour 0 weapon_lvl 0
    unit Peasant Archers exp 0 armour 0 weapon_lvl 0
    unit Peasant Archers exp 0 armour 0 weapon_lvl 0
    end
    historic_event draft_rebels
    end_if
    end_monitor

    You could use a condition that simply tracks settlement order. somthing like,

    Code:
    and SettlementLoyaltyLevel <= loyalty_disillusioned
    Then base the spawn off of that. Using a percentage or however else you intend to spawn the army...

    Hope that was useful...
    ...longbows, in skilled hands, could reach further than trebuchets...

  6. #6

    Default Re: rebellion script

    looks like i was beaten to it
    ...longbows, in skilled hands, could reach further than trebuchets...

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

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

    Default Re: rebellion script

    That's an interesting script though nonetheless. I imagine the rest of it checks for unit recruitment to increase the draft counter and such within a certain timeframe. Just out of curiosity, how is the RandomPercent condition working for you? Randomness is the ultimate equalizer, but it of course also means things are harder to test. Does the condition alone work and the condition produces a random number 1-100, or is it a command? Because I only was aware of the random number and random counter commands, unless the percent is a console command or is dictated through the condition.

    Cheers,
    Augustus

  8. #8

    Default Re: rebellion script

    Yeah the general idea of the entire script is to limit recruitment based on population levels, reducing population in a settlement when you recruit and increasing it when you disband. there are a few factors i have thrown in, migration, draft etc. All adding to the script. The part above is tied directly to the draft script, if a player drafts too often then there is an increasing chance with each draft that the population in a given settlement will cease all unit recruiotment and a small rebel army will spawn, only peasants. And the settlement loses a small amount of population as well...

    The RandomPercent seems to work fine for this situation, but i have found that depending on the situation you might be better off using the generate random number, which is alot more controlled. I use that in the garrison script for SS6 to determine the average capability of a given AI settlement at any time. I originally used the random percent for that, but it wasnt efficient enough.

    If you mean how did i arrive at the random value, the script just checks for certain conditions and i manually chose the percentages that eventually take effect. as in 1 draft there is only 5% chance, 2 - 15% and 3 or more 35%. Conditions in other monitors determine which percentage has a chance of firing true
    ...longbows, in skilled hands, could reach further than trebuchets...

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

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

    Default Re: rebellion script

    Quote Originally Posted by Tsarsies View Post
    Yeah the general idea of the entire script is to limit recruitment based on population levels, reducing population in a settlement when you recruit and increasing it when you disband. there are a few factors i have thrown in, migration, draft etc. All adding to the script. The part above is tied directly to the draft script, if a player drafts too often then there is an increasing chance with each draft that the population in a given settlement will cease all unit recruiotment and a small rebel army will spawn, only peasants. And the settlement loses a small amount of population as well...

    The RandomPercent seems to work fine for this situation, but i have found that depending on the situation you might be better off using the generate random number, which is alot more controlled. I use that in the garrison script for SS6 to determine the average capability of a given AI settlement at any time. I originally used the random percent for that, but it wasnt efficient enough.

    If you mean how did i arrive at the random value, the script just checks for certain conditions and i manually chose the percentages that eventually take effect. as in 1 draft there is only 5% chance, 2 - 15% and 3 or more 35%. Conditions in other monitors determine which percentage has a chance of firing true

    Ah, makes sense. I was actually reading the percent file as backwards. Rather than considering it a random chance over 65%, I somehow had it in my head it was rolling a number randomly which, if over 65/100 would come back as true. Makes more sense the way you explained it.

    Cheers,
    Augustus

  10. #10

    Default Re: rebellion script

    Thanks a lot gentlemen. I'll have a crack at implementing this over the weekend.

    Tsarsies,

    The recruitment limitation script sounds pretty damn interesting. I also have a system of conscription implemented through a building, I wonder if you would be interested in helping to link your scripting system into For King or Country?

    Cheers
    "I don't want to sit around Windsor because ermm .. I just generally don't like England that much" - Prince Harry, 3rd in Line for the British Thrown



    For King or Country - The English civil wars.

  11. #11

    Default Re: rebellion script

    I heard provoke_rebellion does not work to well maybe this where referenced by TheGrnEyedDvl or Alpaca.

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

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

    Default Re: rebellion script

    Quote Originally Posted by krycek View Post
    I heard provoke_rebellion does not work to well maybe this where referenced by TheGrnEyedDvl or Alpaca.
    Well, provoke_rebellion only works on a city, and only can give the city to the Slave faction. This is why it can be considered to not work very well, since it would be nice if it could give the city to another faction or even a shadow faction, but it can't seemingly. So it does work as CA intended, just not in place of another command they failed to provide us with for changing hands of cities.

    Cheers,
    Augustus

  13. #13
    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: rebellion script

    Quote Originally Posted by krycek View Post
    I heard provoke_rebellion does not work to well maybe this where referenced by TheGrnEyedDvl or Alpaca.
    Correct. Neither I nor Alpaca ever got it to actually work.

  14. #14

    Default Re: rebellion script

    @AlphaDelta
    I'd be happy to help out, just message me with any details and i'll do what i can
    ...longbows, in skilled hands, could reach further than trebuchets...

Posting Permissions

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