Esempio n. 1
0
 def skill_constraints_helper(self, new_obj):
     number = 1000
     for i, constraint in enumerate(new_obj.SkillConstraints):
         if constraint.Evaluator:
             obj = constraint.Evaluator
             new_constraint = unrealsdk.ConstructObject(Class=obj.Class,
                                                        Outer=new_obj,
                                                        Name=obj.Name +
                                                        "_" + str(number),
                                                        SetFlags=0x83,
                                                        Template=obj)
             unrealsdk.KeepAlive(new_constraint)
             number += 1
             new_obj.SkillConstraints[i].Evaluator = new_constraint
             self.evaluator_expression_helper(new_constraint)
         else:
             for j, obj in enumerate(constraint.EvaluatorDefinitions):
                 new_constraint = unrealsdk.ConstructObject(
                     Class=obj.Class,
                     Outer=new_obj,
                     Name=obj.Name + "_" + str(number),
                     SetFlags=0x83,
                     Template=obj)
                 unrealsdk.KeepAlive(new_constraint)
                 number += 1
                 new_obj.SkillConstraints[i].EvaluatorDefinitions[
                     j] = new_constraint
                 self.evaluator_expression_helper(new_constraint)
Esempio n. 2
0
    def attribute_definition_helper(self, new_obj):
        if new_obj.ValueResolverChain:
            counter = 0
            temp = []
            for value in new_obj.ValueResolverChain:
                new_value = unrealsdk.ConstructObject(Class=value.Class,
                                                      Outer=new_obj,
                                                      Name=value.Name + "_" +
                                                      str(counter),
                                                      SetFlags=0x83,
                                                      Template=value)
                KeepAlive(new_value)
                temp.append(new_value)
                counter += 1
            new_obj.ValueResolverChain = temp

        if new_obj.ContextResolverChain:
            counter = 0
            temp = []
            for context in new_obj.ContextResolverChain:
                new_context = unrealsdk.ConstructObject(Class=context.Class,
                                                        Outer=new_obj,
                                                        Name=context.Name +
                                                        "_" + str(counter),
                                                        SetFlags=0x83,
                                                        Template=context)
                KeepAlive(new_context)
                temp.append(new_context)
                counter += 1
            new_obj.ContextResolverChain = temp
Esempio n. 3
0
def attribute_definition_helper(new_obj: unrealsdk.UObject) -> None:
    if new_obj.ValueResolverChain:
        counter = 0
        temp = []
        for value in new_obj.ValueResolverChain:
            new_value = unrealsdk.ConstructObject(Class=value.Class, Outer=new_obj,
                                                  Name=f"{value.Name}_{counter}",
                                                  Template=value)
            unrealsdk.KeepAlive(new_value)
            new_value.ObjectFlags.B |= 4
            temp.append(new_value)
            counter += 1
        new_obj.ValueResolverChain = temp

    if new_obj.ContextResolverChain:
        counter = 0
        temp = []
        for context in new_obj.ContextResolverChain:
            new_context = unrealsdk.ConstructObject(Class=context.Class, Outer=new_obj,
                                                    Name=f"{context.Name}_{counter}",
                                                    Template=context)
            unrealsdk.KeepAlive(new_context)
            new_context.ObjectFlags.B |= 4
            temp.append(new_context)
            counter += 1
        new_obj.ContextResolverChain = temp
Esempio n. 4
0
    def com_partlist_helper(self, obj, new_com_balance):
        """
        This Functions purpose is it to easily create New PartLists to work with.
        If one constructs a new ClassModBalanceDefinition this function gets called and constructs its new PartLists
        The new ItemPartListCollection name will be "PartList"
        The new RuntimePartListCollection name will be "ItemPartListCollectionDefinition_1000"
        """
        part_list = obj.ItemPartListCollection
        new_part_list = unrealsdk.ConstructObject(
            Class="ItemPartListCollectionDefinition",
            Outer=new_com_balance,
            Name="PartList",
            SetFlags=0x83,
            Template=part_list)
        unrealsdk.KeepAlive(new_part_list)

        runtime_part_list = obj.RuntimePartListCollection
        new_runtime_part_list = unrealsdk.ConstructObject(
            Class="ItemPartListCollectionDefinition",
            Outer=new_com_balance,
            Name="ItemPartListCollectionDefinition_1000",
            SetFlags=0x83,
            Template=runtime_part_list)
        unrealsdk.KeepAlive(new_runtime_part_list)

        new_com_balance.ItemPartListCollection = new_part_list
        new_com_balance.RuntimePartListCollection = new_runtime_part_list
Esempio n. 5
0
def evaluator_expression_helper(evaluator: unrealsdk.UObject) -> None:
    if evaluator.Expression1:
        new_expression = unrealsdk.ConstructObject(Class=evaluator.Expression1.Class, Outer=evaluator,
                                                   Name=f"{evaluator.Expression1.Name}_1",
                                                   Template=evaluator.Expression1)
        unrealsdk.KeepAlive(new_expression)
        new_expression.ObjectFlags.B |= 4
        evaluator.Expression1 = new_expression
    if evaluator.Expression2:
        new_expression = unrealsdk.ConstructObject(Class=evaluator.Expression1.Class, Outer=evaluator,
                                                   Name=f"{evaluator.Expression1.Name}_2",
                                                   Template=evaluator.Expression1)
        unrealsdk.KeepAlive(new_expression)
        new_expression.ObjectFlags.B |= 4
        evaluator.Expression1 = new_expression
Esempio n. 6
0
        def HandleVerificationReceived(caller: unrealsdk.UObject, function: unrealsdk.UFunction, params: unrealsdk.FStruct) -> bool:
            PC = unrealsdk.GetEngine().GamePlayers[0].Actor
            for i in range(self.DUMMY_AMOUNT):
                obj = unrealsdk.ConstructObject(unrealsdk.FindClass("SparkServiceConfiguration"))
                PC.ServerRCon(f"set {PC.PathName(obj)} ServiceName Dummy_{i}")

            unrealsdk.RemoveHook("GearboxFramework.SparkInitializationProcess.HandleVerificationReceived", "FixHotfixes")
            return True
Esempio n. 7
0
        def HandleVerificationReceived(caller: unrealsdk.UObject, function: unrealsdk.UFunction, params: unrealsdk.FStruct) -> bool:
            base = unrealsdk.FindAll("SparkServiceConfiguration")[-1]
            for i in range(self.DUMMY_AMOUNT):
                obj = unrealsdk.ConstructObject(Class=base.Class, Outer=base.Outer)
                obj.ServiceName = "Dummy"

            unrealsdk.RemoveHook("GearboxFramework.SparkInitializationProcess.HandleVerificationReceived", "FixHotfixes")
            return True
Esempio n. 8
0
    def CreateIcons(self) -> None:
        if self.HealthIcon is not None and self.AmmoIcon is not None:
            return
        HEALTH_NAME = "Icon_RefillHealth"
        AMMO_NAME = "Icon_RefillAmmo"

        # Incase you're re-execing the file and running a new instance
        self.HealthIcon = unrealsdk.FindObject(
            "InteractionIconDefinition",
            f"GD_InteractionIcons.Default.{HEALTH_NAME}")
        self.AmmoIcon = unrealsdk.FindObject(
            "InteractionIconDefinition",
            f"GD_InteractionIcons.Default.{AMMO_NAME}")
        baseIcon = unrealsdk.FindObject(
            "InteractionIconDefinition",
            "GD_InteractionIcons.Default.Icon_DefaultUse")
        PC = unrealsdk.GetEngine().GamePlayers[0].Actor

        if self.HealthIcon is None:
            self.HealthIcon = unrealsdk.ConstructObject(Class=baseIcon.Class,
                                                        Outer=baseIcon.Outer,
                                                        Name=HEALTH_NAME,
                                                        Template=baseIcon)
            unrealsdk.KeepAlive(self.HealthIcon)

            self.HealthIcon.Icon = 3
            # Setting values directly on the object causes a crash on quitting the game
            # Everything still works fine, not super necessary to fix, but people get paranoid
            # https://github.com/bl-sdk/PythonSDK/issues/45
            PC.ServerRCon(
                f"set {PC.PathName(self.HealthIcon)} Action UseSecondary")
            PC.ServerRCon(
                f"set {PC.PathName(self.HealthIcon)} Text REFILL HEALTH")

        if self.AmmoIcon is None:
            self.AmmoIcon = unrealsdk.ConstructObject(Class=baseIcon.Class,
                                                      Outer=baseIcon.Outer,
                                                      Name=AMMO_NAME,
                                                      Template=baseIcon)
            unrealsdk.KeepAlive(self.AmmoIcon)

            self.AmmoIcon.Icon = 7
            PC.ServerRCon(
                f"set {PC.PathName(self.AmmoIcon)} Action UseSecondary")
            PC.ServerRCon(f"set {PC.PathName(self.AmmoIcon)} Text REFILL AMMO")
Esempio n. 9
0
def bpd_copy_helper(new_obj: unrealsdk.UObject) -> None:
    if new_obj.BehaviorProviderDefinition:
        new_bpd = unrealsdk.ConstructObject(Class="BehaviorProviderDefinition", Outer=new_obj,
                                            Name=f"{new_obj.BehaviorProviderDefinition.Name}_0",
                                            Template=new_obj.BehaviorProviderDefinition)
        unrealsdk.KeepAlive(new_bpd)
        new_bpd.ObjectFlags.B |= 4
        new_obj.BehaviorProviderDefinition = new_bpd
        bpd_helper(new_bpd)
Esempio n. 10
0
 def evaluator_expression_helper(self, evaluator):
     if evaluator.Expression1:
         new_expression = unrealsdk.ConstructObject(
             Class=evaluator.Expression1.Class,
             Outer=evaluator,
             Name=evaluator.Expression1.Name + "_1",
             SetFlags=0x83,
             Template=evaluator.Expression1)
         KeepAlive(new_expression)
         evaluator.Expression1 = new_expression
     if evaluator.Expression2:
         new_expression = unrealsdk.ConstructObject(
             Class=evaluator.Expression1.Class,
             Outer=evaluator,
             Name=evaluator.Expression1.Name + "_2",
             SetFlags=0x83,
             Template=evaluator.Expression1)
         KeepAlive(new_expression)
         evaluator.Expression1 = new_expression
Esempio n. 11
0
def skill_presentation_helper(cloned_obj: unrealsdk.UObject, new_obj: unrealsdk.UObject) -> None:
    new_custom_presentations = []
    for number, Presentation in enumerate(cloned_obj.SkillEffectPresentations):
        new_presentation = unrealsdk.ConstructObject(Class="AttributePresentationDefinition", Outer=new_obj,
                                                     Name=f"AttributePresentationDefinition_{1000 + number}",
                                                     Template=Presentation)
        unrealsdk.KeepAlive(new_presentation)
        new_presentation.ObjectFlags.B |= 4
        new_custom_presentations.append(new_presentation)
    new_obj.SkillEffectPresentations = new_custom_presentations
Esempio n. 12
0
 def bpd_copy_helper(self, newObj):
     if newObj.BehaviorProviderDefinition:
         new_BPD = unrealsdk.ConstructObject(
             Class="BehaviorProviderDefinition",
             Outer=newObj,
             Name=newObj.BehaviorProviderDefinition.Name + "_0",
             SetFlags=0x83,
             Template=newObj.BehaviorProviderDefinition)
         KeepAlive(new_BPD)
         newObj.BehaviorProviderDefinition = new_BPD
         self.bpd_helper(new_BPD)
Esempio n. 13
0
def behavior_attribute_effect_helper(new_obj: unrealsdk.UObject) -> None:
    if new_obj.AttributeEffect:
        new_effect = unrealsdk.ConstructObject(Class=new_obj.AttributeEffect.Class, Outer=new_obj,
                                               Name=f"{new_obj.AttributeEffect.Name}_1",
                                               Template=new_obj.AttributeEffect)
        unrealsdk.KeepAlive(new_effect)
        new_effect.ObjectFlags.B |= 4
        new_obj.AttributeEffect = new_effect
        if new_effect == unrealsdk.FindClass("SkillDefinition"):
            bpd_copy_helper(new_effect)
            skill_constraints_helper(new_effect)
Esempio n. 14
0
 def inv_partlist_helper(self, obj, newBalance):
     if obj.PartListCollection:
         part_list = obj.PartListCollection
         new_part_list = unrealsdk.ConstructObject(
             Class="ItemPartListCollectionDefinition",
             Outer=part_list.Outer,
             Name=newBalance.Name,
             SetFlags=0x83,
             Template=part_list)
         KeepAlive(new_part_list)
         newBalance.PartListCollection = new_part_list
Esempio n. 15
0
def behavior_activate_skill_helper(new_obj: unrealsdk.UObject) -> None:
    if new_obj.SkillToActivate:
        name = bl2tools.get_obj_path_name(new_obj)
        new_name = f'{name.split(":")[0].split("_")[-1]}_Skill_{name.split("_")[-1]}'
        new_skill = unrealsdk.ConstructObject(Class=new_obj.SkillToActivate.Class,
                                              Outer=new_obj.SkillToActivate.Outer,
                                              Name=new_name,
                                              Template=new_obj.SkillToActivate)
        unrealsdk.KeepAlive(new_skill)
        new_skill.ObjectFlags.B |= 4
        new_obj.SkillToActivate = new_skill
        bpd_copy_helper(new_skill)
Esempio n. 16
0
def skill_constraints_helper(new_obj: unrealsdk.UObject) -> None:
    number = 1000
    for i, constraint in enumerate(new_obj.SkillConstraints):
        if constraint.Evaluator:
            obj = constraint.Evaluator
            new_constraint = unrealsdk.ConstructObject(Class=obj.Class, Outer=new_obj,
                                                       Name=f"{obj.Name}_{number}",
                                                       Template=obj)
            unrealsdk.KeepAlive(new_constraint)
            new_constraint.ObjectFlags.B |= 4
            new_obj.SkillConstraints[i].Evaluator = new_constraint
            evaluator_expression_helper(new_constraint)
        else:
            for j, obj in enumerate(constraint.EvaluatorDefinitions):
                new_constraint = unrealsdk.ConstructObject(Class=obj.Class, Outer=new_obj,
                                                           Name=f"{obj.Name}_{number}",
                                                           Template=obj)
                unrealsdk.KeepAlive(new_constraint)
                new_constraint.ObjectFlags.B |= 4
                new_obj.SkillConstraints[i].EvaluatorDefinitions[j] = new_constraint
                evaluator_expression_helper(new_constraint)
        number += 1
Esempio n. 17
0
 def behavior_attribute_effect_helper(self, new_obj):
     if new_obj.AttributeEffect:
         new_effect = unrealsdk.ConstructObject(
             Class=new_obj.AttributeEffect.Class,
             Outer=new_obj,
             Name=new_obj.AttributeEffect.Name + "_1",
             SetFlags=0x83,
             Template=new_obj.AttributeEffect)
         KeepAlive(new_effect)
         new_obj.AttributeEffect = new_effect
         if new_effect == FindClass("SkillDefinition"):
             self.bpd_copy_helper(new_effect)
             self.skill_constraints_helper(new_effect)
Esempio n. 18
0
def inv_partlist_helper(obj: unrealsdk.UObject, new_balance: unrealsdk.UObject) -> None:
    if obj.PartListCollection:
        part_list = obj.PartListCollection
        if obj.PathName(part_list).rsplit(".", 1)[0] == obj.PathName(obj).rsplit(".", 1)[0]:
            new_name = f"Parts_{new_balance.Name}"
        else:
            new_name = new_balance.Name
        new_part_list = unrealsdk.ConstructObject(Class="ItemPartListCollectionDefinition",
                                                  Outer=part_list.Outer,
                                                  Name=new_name, Template=part_list)
        unrealsdk.KeepAlive(new_part_list)
        new_part_list.ObjectFlags.B |= 4
        new_balance.PartListCollection = new_part_list
Esempio n. 19
0
    def CreateIcons(self) -> None:
        if self.HealthIcon is not None and self.AmmoIcon is not None:
            return
        HEALTH_NAME = "Icon_RefillHealth"
        AMMO_NAME = "Icon_RefillAmmo"

        # Incase you're re-execing the file and running a new instance
        self.HealthIcon = unrealsdk.FindObject(
            "InteractionIconDefinition",
            f"GD_InteractionIcons.Default.{HEALTH_NAME}")
        self.AmmoIcon = unrealsdk.FindObject(
            "InteractionIconDefinition",
            f"GD_InteractionIcons.Default.{AMMO_NAME}")
        baseIcon = unrealsdk.FindObject(
            "InteractionIconDefinition",
            "GD_InteractionIcons.Default.Icon_DefaultUse")

        if self.HealthIcon is None:
            self.HealthIcon = unrealsdk.ConstructObject(Class=baseIcon.Class,
                                                        Outer=baseIcon.Outer,
                                                        Name=HEALTH_NAME,
                                                        Template=baseIcon)
            unrealsdk.KeepAlive(self.HealthIcon)

            self.HealthIcon.Icon = 3
            self.HealthIcon.Action = "UseSecondary"
            self.HealthIcon.Text = "REFILL HEALTH"

        if self.AmmoIcon is None:
            self.AmmoIcon = unrealsdk.ConstructObject(Class=baseIcon.Class,
                                                      Outer=baseIcon.Outer,
                                                      Name=AMMO_NAME,
                                                      Template=baseIcon)
            unrealsdk.KeepAlive(self.AmmoIcon)

            self.AmmoIcon.Icon = 7
            self.AmmoIcon.Action = "UseSecondary"
            self.AmmoIcon.Text = "REFILL AMMO"
Esempio n. 20
0
def population_definition_helper(new_obj: unrealsdk.UObject, template_obj: unrealsdk.UObject) -> None:
    counter = 1000
    spawn_factories = []
    for l in template_obj.ActorArchetypeList:
        factory = l.SpawnFactory
        new = unrealsdk.ConstructObject(Class=factory.Class, Outer=new_obj, Name=f"{new_obj.name}_{counter}",
                                        Template=template_obj)
        counter += 1
        unrealsdk.KeepAlive(new)
        new.ObjectFlags.B |= 4
        spawn_factories.append(new)

    new_obj.ActorArchetypeList = [(x, (1, None, None, 1), (0, None, None, 0), False, False) for x in
                                  spawn_factories]
Esempio n. 21
0
def custom_presentation_helper(obj: unrealsdk.UObject, new_name_part: unrealsdk.UObject) -> None:
    """
    This function tries to copy the CustomPresentations from the old template
     object to the new constructed "WeaponNamePartDefinition".
    """
    new_custom_presentations = []
    for number, Presentation in enumerate(obj.CustomPresentations):
        new_presentation = unrealsdk.ConstructObject(Class="AttributePresentationDefinition", Outer=new_name_part,
                                                     Name=f"AttributePresentationDefinition_{1000 + number}",
                                                     Template=Presentation)
        unrealsdk.KeepAlive(new_presentation)
        new_presentation.ObjectFlags.B |= 4
        new_custom_presentations.append(new_presentation)
    new_name_part.CustomPresentations = new_custom_presentations
Esempio n. 22
0
def weapon_partlist_helper(obj: unrealsdk.UObject, new_wpn_balance: unrealsdk.UObject) -> None:
    """
    This Functions purpose is it to easily create New PartLists to work with.
    If one constructs a new WeaponBalanceDefinition this function gets called and constructs its new PartLists
    The new WeaponPartListCollection name will be "PartList"
    The new RuntimePartListCollection name will be "WeaponPartListCollectionDefinition_1000"
    """
    part_list = obj.WeaponPartListCollection
    new_part_list = unrealsdk.ConstructObject(Class="WeaponPartListCollectionDefinition", Outer=new_wpn_balance,
                                              Name="PartList", Template=part_list)
    unrealsdk.KeepAlive(new_part_list)
    new_part_list.ObjectFlags.B |= 4

    runtime_part_list = obj.RuntimePartListCollection
    new_runtime_part_list = unrealsdk.ConstructObject(Class="WeaponPartListCollectionDefinition",
                                                      Outer=new_wpn_balance,
                                                      Name="WeaponPartListCollectionDefinition_1000",
                                                      Template=runtime_part_list)
    unrealsdk.KeepAlive(new_runtime_part_list)
    new_runtime_part_list.ObjectFlags.B |= 4

    new_wpn_balance.WeaponPartListCollection = new_part_list
    new_wpn_balance.RuntimePartListCollection = new_runtime_part_list
Esempio n. 23
0
 def behavior_activate_skill_helper(self, new_obj):
     if new_obj.SkillToActivate:
         name = self.get_full_name(new_obj)
         new_name = name.split(":")[0].split(
             "_")[-1] + "_Skill_" + name.split("_")[-1]
         new_skill = unrealsdk.ConstructObject(
             Class=new_obj.SkillToActivate.Class,
             Outer=new_obj.SkillToActivate.Outer,
             Name=new_name,
             SetFlags=0x83,
             Template=new_obj.SkillToActivate)
         KeepAlive(new_skill)
         new_obj.SkillToActivate = new_skill
         self.bpd_copy_helper(new_skill)
Esempio n. 24
0
 def skill_presentation_helper(self, cloned_obj, new_obj):
     new_custom_presentations = []
     number = 0
     for Presentation in cloned_obj.SkillEffectPresentations:
         new_presentation = unrealsdk.ConstructObject(
             Class="AttributePresentationDefinition",
             Outer=new_obj,
             Name="AttributePresentationDefinition_100" + str(number),
             SetFlags=0x83,
             Template=Presentation)
         unrealsdk.KeepAlive(new_presentation)
         number += 1
         new_custom_presentations.append(new_presentation)
     new_obj.SkillEffectPresentations = new_custom_presentations
Esempio n. 25
0
def on_any_impact_helper(new_obj: unrealsdk.UObject) -> None:
    if new_obj.OnAnyImpact:
        new_on_any_impact = []
        counter = 0
        for behavior in new_obj.OnAnyImpact:
            new_behavior = unrealsdk.ConstructObject(Class=behavior.Class, Outer=new_obj,
                                                     Name=f"{behavior.Name}_{counter}",
                                                     Template=behavior)
            counter += 1
            unrealsdk.KeepAlive(new_behavior)
            new_behavior.ObjectFlags.B |= 4
            new_on_any_impact.append(new_behavior)
            if behavior.Class == unrealsdk.FindClass("Behavior_AttributeEffect"):
                behavior_attribute_effect_helper(new_behavior)
        new_obj.OnAnyImpact = new_on_any_impact
Esempio n. 26
0
def _create_data_provider(name: str) -> unrealsdk.UObject:
    """
    Helper function that creates a new data provider and adds it to the stack.

    Args:
        name: The menu name to give the new data provider.
    Returns:
        The data provider.
    """
    provider = unrealsdk.ConstructObject(Class=unrealsdk.FindClass(
        "WillowScrollingListDataProviderOptionsBase"))
    # See issue #45
    unrealsdk.GetEngine().GamePlayers[0].Actor.ServerRCon(
        f"set {provider.PathName(provider)} MenuDisplayName {name}")
    _modded_data_provider_stack.append(provider)
    return provider
Esempio n. 27
0
def bpd_helper(new_bpd: unrealsdk.UObject) -> None:
    counter = 0
    for Sequence in new_bpd.BehaviorSequences:
        for Data in Sequence.BehaviorData2:
            if Data.Behavior:
                new_behavior = unrealsdk.ConstructObject(Class=Data.Behavior.Class, Outer=new_bpd,
                                                         Name=f"{Data.Behavior.Name}_{counter}",
                                                         Template=Data.Behavior)
                unrealsdk.KeepAlive(new_behavior)
                new_behavior.ObjectFlags.B |= 4
                Data.Behavior = new_behavior
                counter += 1
                if Data.Behavior.Class == unrealsdk.FindClass("Behavior_AttributeEffect"):
                    behavior_attribute_effect_helper(new_behavior)
                elif Data.Behavior.Class == unrealsdk.FindClass("Behavior_ActivateSkill"):
                    behavior_activate_skill_helper(new_behavior)
Esempio n. 28
0
 def inv_partlist_helper(self, obj, newBalance):
     if obj.PartListCollection:
         part_list = obj.PartListCollection
         if obj.PathName(part_list).rsplit(
                 ".", 1)[0] == obj.PathName(obj).rsplit(".", 1)[0]:
             new_name = f"Parts_{newBalance.Name}"
         else:
             new_name = newBalance.Name
         new_part_list = unrealsdk.ConstructObject(
             Class="ItemPartListCollectionDefinition",
             Outer=part_list.Outer,
             Name=new_name,
             SetFlags=0x83,
             Template=part_list)
         KeepAlive(new_part_list)
         newBalance.PartListCollection = new_part_list
Esempio n. 29
0
def projectile_body_composition_helper(template_obj: unrealsdk.UObject, new_obj: unrealsdk.UObject) -> None:
    for i, data_union in enumerate(template_obj.BodyComposition.Attachments):
        if data_union.Data.ComponentData.Component:
            template = data_union.Data.ComponentData.Component
            new_comp = unrealsdk.ConstructObject(Class=template.Class, Outer=new_obj,
                                                 Name=f"{template.Name}_{i}", Template=template)
            unrealsdk.Log(bl2tools.get_obj_path_name(new_comp))
            unrealsdk.KeepAlive(new_comp)
            if new_comp:
                new_comp.ObjectFlags.B |= 4
                try:
                    unrealsdk.Log(new_obj.BodyComposition.Attachments)
                    new_obj.BodyComposition.Attachments[i].Data.ComponentData.Component = new_comp
                    unrealsdk.Log("works")
                except Exception as e:
                    unrealsdk.Log(f"Exception: {repr(e)}")
                    unrealsdk.Log(e)
Esempio n. 30
0
 def on_any_impact_helper(self, newObj):
     if newObj.OnAnyImpact:
         new_on_any_impact = []
         counter = 0
         for behavior in newObj.OnAnyImpact:
             new_behavior = unrealsdk.ConstructObject(Class=behavior.Class,
                                                      Outer=newObj,
                                                      Name=behavior.Name +
                                                      "_" + str(counter),
                                                      SetFlags=0x83,
                                                      Template=behavior)
             counter += 1
             KeepAlive(new_behavior)
             new_on_any_impact.append(new_behavior)
             if behavior.Class == FindClass("Behavior_AttributeEffect"):
                 self.behavior_attribute_effect_helper(new_behavior)
         newObj.OnAnyImpact = new_on_any_impact