Results 1 to 14 of 14

Thread: "RandomPercent" parameter

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

    Default "RandomPercent" parameter

    just a quick question, could someone explain how exactly the "RandomPercent" parameter works?

  2. #2

    Default Re: "RandomPercent" parameter

    I believe: the game uses a random-function to generate a number. Then it compares the number with the one you've given for the RandomPercent. If your number is equal or greater than the generated one, you get the effect you want.

    Norman Invasion - The fate of England lies in your hands...

    Viking Invasion II - Unite Britain in the best TW campaign ever!

    Gods and Fighting Men: Total War - Enter the Mists of Myth in Ancient Ireland

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

    Default Re: "RandomPercent" parameter

    Actually, you provide the logic token yourself. That way, RandomPercent > 99 will return True with a 1% chance, same as RandomPercent < 2 or RandomPercent <= 1.

  4. #4

    Default Re: "RandomPercent" parameter

    Yes, I thought that goes without saying, my bad. Thx Bozos! :)
    Last edited by Aradan; 12-28-2007 at 14:44.

    Norman Invasion - The fate of England lies in your hands...

    Viking Invasion II - Unite Britain in the best TW campaign ever!

    Gods and Fighting Men: Total War - Enter the Mists of Myth in Ancient Ireland

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

    Default Re: "RandomPercent" parameter

    ok, i think i understand, but let me just check to be sure.

    if a trait or ancillary trigger says:
    Code:
    ...
    Condition ...
        and RandomPercent <= 5
    ...
    Affects GoodCommander  1  Chance 10
    what exactly happens?

    (... denotes clipped text)

    similarly, if triggering an event in a script, such as this one in EB:
    Code:
    monitor_event FactionTurnStart FactionType scythia
    ...
    and I_TurnNumber > 35
    and I_TurnNumber < 210
    and RandomPercent < 5
    and I_LocalFaction scythia
    
    console_command create_building Sulek hinterland_victory
    ...
    end_monitor
    what does the RandomPercent do here?

    thanks in advance
    Last edited by tai4ji2x; 06-16-2007 at 03:28.

  6. #6

    Default Re: "RandomPercent" parameter

    If the random number generated by the game is less than 5 (and all other conditions are met), you get the victory-building in Sulek.

    Norman Invasion - The fate of England lies in your hands...

    Viking Invasion II - Unite Britain in the best TW campaign ever!

    Gods and Fighting Men: Total War - Enter the Mists of Myth in Ancient Ireland

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

    Default Re: "RandomPercent" parameter

    thanks aradan :) so RandomPercent < 99 would mean 99 times out of 100, the condition returns "true"?

    can you do...

    Code:
    and RandomPercent < 99
    and RandomPercent > 50
    ?

    or (assuming the system would even accept that) is that just a redundant way to do

    Code:
    and RandomPercent > 51
    ?

    but what about traits/ancillaries? first there is a RandomPercent, and then the usual "Chance" #

    does that mean that first it rolls dice for RandomPercent to see if it even will or will not execute yet another dice roll with the "Chance" parameter? which makes me wonder... why bother with two dice rolls?
    Last edited by tai4ji2x; 06-16-2007 at 13:54.

  8. #8

    Default Re: "RandomPercent" parameter

    Basically it will be true 98 times out of 100, since 99 isn't less than 99... In order to have a 99% chance you must have
    and RandomPercent <= 99
    Assuming that in the case you used two RandomPercent checks the game only trows the dice once, I don't think your logic is correct. Because if the RandomPercent is 51, this
    and RandomPercent < 99
    and RandomPercent > 50
    will be satisfied, while this
    and RandomPercent > 51
    will not. Or if the value is 100, then the double one won't be satisfied and the single one will.

    And there is always the chance that if you put two RandomPercent lines, the game actually throws the dice two times, in which case the final probability of your thing happening is prob1 * prob2= final_prob, which will always be less than the min{prob1, prob2} (assuming that we can't have 100% probability.

    Generally, I can see no reason to put two RandomPercent lines, even if the game accepts them. It seems redudant and rather complicated.

    The usage of both 'chance' and 'RandomPercent' is probably possible in order to allow for probabilities with up to two decimals to be used, as the engine calculates probabilities only with integers... I guess it's a valuable tool for traiters to be able to have probs like 43.76%...

    Perhaps one of the highly experienced EB traitors would be of more avail here.
    Last edited by Aradan; 06-16-2007 at 17:03.

    Norman Invasion - The fate of England lies in your hands...

    Viking Invasion II - Unite Britain in the best TW campaign ever!

    Gods and Fighting Men: Total War - Enter the Mists of Myth in Ancient Ireland

  9. #9
    Axebitten Modder Senior Member Dol Guldur's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,550

    Default Re: "RandomPercent" parameter

    I believe the term is traiters ;)

    monitor_event ForumTurnStart FactionType palantir
    ...
    and I_PostNumber > 1
    and I_PostNumber < 2
    and RandomPercent < 100
    and LocalForumBrowser noobie
    and ProblemNameExists Installation Error

    console_command create_angryPost Palantir ReadTheInstructionsProperlyFor_victory
    ...
    end_monitor
    Last edited by Dol Guldur; 06-16-2007 at 14:56.
    "One of the most sophisticated Total War mods ever developed..."

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

    Default Re: "RandomPercent" parameter

    Quote Originally Posted by Dol Guldur
    I believe the term is traiters ;)
    hyuk hyuk hyuk

    seriously though... anyone here know what the purpose is when it comes to trait/ancillaries?

  11. #11
    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.

  12. #12
    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

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

    Default Re: "RandomPercent" parameter

    Yup.

  14. #14

    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