Crazy's Mod still in development
0 Members and 162 Guests are viewing this topic.
Weight choice, when the more the weight, the more the chance to select the element. An example from one websiteAs you can see, weights are 100% in total.
Yeah, I want to use skills values (which are unlimited) as weights. So I wonder if weight sum should be 1 in total, like in every python example about the weighted choice, or I can use raw skill values and the function will figure it out.
5000. That's lower than I thought
https://lemmasoft.renai.us/forums/viewtopic.php?f=4&t=26531#p323010
skills = ["sex", "oral", "anal"] if not(ct("Virgin")) or check_lovers(hero, char) or char.disposition >= 750: skills.extend(["vaginal"]) skills_values=[] for t in skills: skills_values.append([t, char.get_skill(t)]) total = sum([t[1] for t in skills_values]) import random r = random.uniform(0, total) s = 0.0 for k, w in skills_values: s += w if r < s: return k return k
Yeah, it works. But it cannot handle cases when all weights are 0, in which case it probably should return None (fixed it).
Shooting range? Like, for BEs?
Lol. And I once had to rewrite coordinates because at first I wrote them while launching the game in non native window mode, ie after changing window size manually with mouse, which totally messes up them