Results 1 to 14 of 14

Thread: "RandomPercent" parameter

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    EB Traitor Member BozosLiveHere's Avatar
    Join Date
    Jan 2006
    Location
    Uqbar, Tlön
    Posts
    3,662

    Default Re: "RandomPercent" parameter

    As Aradan wrote, using RandomPercent in traits/ancillaries allows you to have non-integer probabilities for triggers, as in this piece here:

    Code:
    ;------------------------------------------
    Trigger harsh_lifestyle1
        WhenToTest CharacterTurnEnd
    
        Condition EndedInSettlement
              and RemainingMPPercentage = 100
              and SettlementBuildingExists = governors_house
              and RandomPercent > 50
    
        Affects Austere  1  Chance  2
        Affects Pragmatic  1  Chance  2
        Affects Stoic  1  Chance  1
    You can also use it to save some lines of code: suppose that you want to trigger a certain trait B whenever a character acquires another trait A. You could either write it like this:

    Code:
    Trigger acquire_A
        WhenToTest CharacterTurnEnd
    
        Condition IsGeneral
              and Trait A < 1
            
    
        Affects  A  1  Chance  20
    
    ;-----------------------------------
    Trigger acquire_B
        WhenToTest CharacterTurnEnd
        
        Condition IsGeneral
              and Trait A = 1
              and Trait B < 1
    
    
        Affects  B  1  Chance  100
    Or you can save some bytes writing it like this:

    Code:
    Trigger acquire_A_then_B
        WhenToTest CharacterTurnEnd
    
        Condition IsGeneral
              and Trait A < 1
              and RandomPercent > 80
            
    
        Affects  A  1  Chance  100
        Affects  B  1  Chance  100
    Last edited by BozosLiveHere; 06-17-2007 at 19:59.

  2. #2
    Member Member tai4ji2x's Avatar
    Join Date
    Apr 2001
    Location
    MA
    Posts
    291

    Default Re: "RandomPercent" parameter

    Quote Originally Posted by BozosLiveHere
    As Aradan wrote, using RandomPercent in traits/ancillaries allows you to have non-integer probabilities for triggers, as in this piece here:

    Code:
    ;------------------------------------------
    Trigger harsh_lifestyle1
        WhenToTest CharacterTurnEnd
    
        Condition EndedInSettlement
              and RemainingMPPercentage = 100
              and SettlementBuildingExists = governors_house
              and RandomPercent > 50
    
        Affects Austere  1  Chance  2
        Affects Pragmatic  1  Chance  2
        Affects Stoic  1  Chance  1
    ok, i think i understand the second part. and so following from the logic there, i'm assuming this means that in the above trigger, the possibility of adding one point of "stoic" is thus effectively 0.5% ?

    thanks so much, bozoslivehere

  3. #3
    EB Traitor Member BozosLiveHere's Avatar
    Join Date
    Jan 2006
    Location
    Uqbar, Tlön
    Posts
    3,662

    Default Re: "RandomPercent" parameter

    Yup.

  4. #4

    Default Re: "RandomPercent" parameter

    Sorry to resurrect an old thread, but it seemed better than starting a related new one. Can I use the RandomPercent parameter to spawn armies like this?
    Code:
    monitor_event FactionTurnStart FactionType scythia
        if RandomPercent < 3
        spawn_army
    		faction scythia
    		character Kudurmabug, general, age 30, , x XXX, y YYY
            unit		sarmatian noble cavalry				exp 0 armour 1 weapon_lvl 1
            unit		sarmatian horse archer				exp 0 armour 0 weapon_lvl 0
            unit		sarmatian horse archer				exp 0 armour 0 weapon_lvl 0
            unit		sarmatian archer			exp 0 armour 0 weapon_lvl 0
            unit		sarmatian archer					exp 0 armour 0 weapon_lvl 0
        end
        end_if
        if RandomPercent > 99   
        spawn_army
    		faction scythia
    		character Kudurmabug, general, age 30, , x XXX, y YYY
            unit		sarmatian noble cavalry				exp 0 armour 1 weapon_lvl 1
            unit		sarmatian horse archer				exp 0 armour 0 weapon_lvl 0
            unit		sarmatian horse archer				exp 0 armour 0 weapon_lvl 0
            unit		sarmatian archer			exp 0 armour 0 weapon_lvl 0
            unit		sarmatian archer					exp 0 armour 0 weapon_lvl 0
            unit		sarmatian noble cavalry				exp 0 armour 1 weapon_lvl 1
            unit		sarmatian horse archer				exp 0 armour 0 weapon_lvl 0
            unit		sarmatian horse archer				exp 0 armour 0 weapon_lvl 0
            unit		sarmatian archer			exp 0 armour 0 weapon_lvl 0
            unit		sarmatian archer					exp 0 armour 0 weapon_lvl 0
        end
        end_if
    end_monitor
        
    monitor_event FactionTurnStart FactionType scythia
        while I_TurnNumber <= 399
        end_while
        if I_TurnNumber = 400
            console_command kill_character "Kudurmabug"
        spawn_army
    		faction scythia
            character Kudurmabug, named character, command 0, influence 0, management 0, subterfuge 0, age 40, , x XXX, y YYY
            unit		barb chieftain cavalry scythian				exp 1 armour 1 weapon_lvl 1
            unit		sarmatian horse archer				exp 0 armour 0 weapon_lvl 0
            unit		sarmatian horse archer				exp 0 armour 0 weapon_lvl 0
            unit		sarmatian archer			exp 0 armour 0 weapon_lvl 0
            unit		sarmatian noble cavalry				exp 0 armour 1 weapon_lvl 1
            unit		sarmatian archer					exp 0 armour 0 weapon_lvl 0
            unit		sarmatian horse archer				exp 0 armour 0 weapon_lvl 0
            unit		sarmatian horse archer				exp 0 armour 0 weapon_lvl 0
            unit		sarmatian archer			exp 0 armour 0 weapon_lvl 0
            unit		sarmatian noble cavalry				exp 0 armour 1 weapon_lvl 1
            unit		sarmatian archer					exp 0 armour 0 weapon_lvl 0
            unit		sarmatian horse archer				exp 0 armour 0 weapon_lvl 0
            unit		sarmatian horse archer				exp 0 armour 0 weapon_lvl 0
            unit		sarmatian archer			exp 0 armour 0 weapon_lvl 0
            unit		sarmatian noble cavalry				exp 0 armour 1 weapon_lvl 1
            unit		sarmatian archer					exp 0 armour 0 weapon_lvl 0
            unit		sarmatian horse archer				exp 0 armour 0 weapon_lvl 0
            unit		sarmatian horse archer				exp 0 armour 0 weapon_lvl 0
            unit		sarmatian archer			exp 0 armour 0 weapon_lvl 0
            unit		sarmatian archer					exp 0 armour 0 weapon_lvl 0
        end
            console_command give_trait "Kurdurmabug" GoodCommander 3
        if I_TurnNumber >= 401
                terminate_monitor ; Loaded game.
        end_if
    end_monitor
    Last edited by Quinn Inuit; 03-15-2008 at 15:09.
    --
    RTR Platinum Team Apprentice, Extended Realism Mod for RTR Platinum Team Coordinator

    The ExRM forum: come for the mod, stay for the Classical History discussions. Or vice versa.

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