- Jul 17, 2019
- 2,295
- 964
earliestbird555: I would suggest something like that, just in an init block. The sanity checking should make it work with multiple girls sharing the same code, too.
Edit: Also, __neronero's example uses direct iteration over all traits instead of
Code:
init python:
mindbroken_blade_trait = Trait("MindBroken Blade", verb = "be a", effects=[Effect("change", "defense", 10)], base_description = "Once a warrior with a broken blade, Riven now devotes her body to the cultivation of her master's virile seed.")
if not mindbroken_blade_trait.name in trait_dict.keys():
trait_dict[trait.name] = mindbroken_blade_trait
if not mindbroken_blade_trait.name in gold_trait_dict.keys(): # replace with pos_traits or neg_traits as appropriate
gold_trait_dict[trait.name] = mindbroken_blade_trait
if not mindbroken_blade_trait.name in [tr.name for tr in gold_traits]:
gold_traits.append(mindbroken_blade_trait )
This has no sanity checking for accidentally adding the trait twice. Something likeAnd when I want to add the trait at the end of an event, I add this code:
Code:if girl.flags["pregtrait"] == 0: $ renpy.say("", event_color["special"] % ("She gained a special trait: MindBroken Blade!")) $ girl.add_trait() $ girl.flags["pregtrait"] = 1 return
if not girl.has_trait(mindbroken_blade_trait.name)
would work, since pretty much all of BK assumes there are never two different traits (as objects) that share the same name.I thought the snake used to be a perk? In any case, AFAIK Fran is a much more complex example.Take a look at basic Boa Hancock .rpy file, there's the snake trait which is implemented there
Edit: Also, __neronero's example uses direct iteration over all traits instead of
girl.has_trait()
, which is more convenient and ignores issues like "AIDS" vs "AiDS". There is only one kind of AIDS in Zan!