As i understand, if RandomPercent > 50 (for example), it not to mean that something will be generated with 50%, it mean that percent will be generated from 51 to 100, and something will be generated with this generated percent, am i right?
As i understand, if RandomPercent > 50 (for example), it not to mean that something will be generated with 50%, it mean that percent will be generated from 51 to 100, and something will be generated with this generated percent, am i right?
RandomPercent generates a random number between 0 and 100 (inclusive). > 50 tests to see if that generated number is 51 or higher.
http://www.twcenter.net/forums/showt...1#post15249717
I mean that some event, if RandomPercent > 50, will have a chance > 50% (for example 60%), if RandomPercent < 50, will have a chance < 50% (for example 40%), is it right?
That's the example from script:
I can't understand why there are 2 same conditionsCode:if I_SettlementOwner Barcelona = portugaland not I_SettlementUnderSiege Barcelona and not I_CharacterExists Carlo and RandomPercent < 6 and RandomPercent < 51 and I_CompareCounter Barcelona = 0 historic_event Rebels_attack set_counter Not_two_times 1 set_counter Barcelona 1 end_if
RandomPercent is terrible, don't use it in the script (you don't have any other choice in the EDCT); generate_random_counter is better. The latter reliably self-resets, the former does not.
The latter will also create an event_counter that can be used for all sorts of things.
The problem is that i'm redacting some mod for yourself, and there are used RandomPercent, so i wanna just know, if, for example RandomPercent < 50, it means that some random percent from 0 to 49 will be generated, for example, 35%, and with this chance event may happens. Or any generated integer from 0 to 49 will give 100% result that event happens.
RandomPercent < 50 does not generate a number between 0 and 49. It generates a number between 0 and 100. Always. Whatever that number happens to be, there is a 50% chance that it is less than 50, and 50% chance that it's greater, therefore RandomPercent < 50 and RandomPercent > 50 both mean 50% chance that the event happens.
If you want something to happen only 35% of the time then use either RandomPercent < 35 or RandomPercent > 65. If you want a 10% chance then use either RandomPercent < 10 or RandomPercent > 90.
In other words, RandomPercent < 50 does not mean "generate a random number that is less than 50". It means "generate a random number (between 0 and 100) and if that number is less than 50 then this condition evaluates to TRUE".
Last edited by Withwnar; September 20, 2019 at 03:23 AM.
Ok, the question is closed, thanks Withwnar, if you may be yet look at my economy script and check it for the mistakes, i would be very appreciated for you.