Announcement

Collapse
No announcement yet.

Replace double damage with jetpack

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Replace double damage with jetpack

    Hello, can anyone make a mutator that replace UTPickupFactory_UDamage with jetpack from this mod - https://forums.epicgames.com/threads...etpack-for-UT3.

    This code can help you, i think.

    function bool CheckReplacement(Actor Other)
    {
    if (Other.IsA('UTPickupFactory_UDamage'))
    {
    ReplaceWith(Other, ">>>>TYPE HERE CLASS OF JETPACK<<<<");
    return false;
    }

    return true;
    }
    Can anyone make a mutator and share it here? Thanks anyway.


    Regard. A.G.

    #2
    There is no need for a additional mutator as SuperDuperPickupSwitcher by NickG can be used. There is only one problem, the latest version is not online anymore. I already wrote a private message.
    The latest online version is this one:
    https://forums.epicgames.com/threads...1#post30377193

    By using Jetpack 1.2 (!!!), you would need to replaced the UTDamage factory with the Jetpack one:
    Code:
    Jetpack.Jetpack_PickupFactory

    PS: Welcome to the forums.

    Comment


      #3
      Thank you, found this mut after openning thread.


      this>>>
      Jetpack.Jetpack_PickupFactory
      really helps.

      Regard.

      Comment


        #4
        re-uploaded the latest build of my replacer mutator and added a new link on the old thread: https://forums.epicgames.com/threads...1#post31918492

        Comment


          #5
          Originally posted by RattleSN4K3 View Post
          There is no need for a additional mutator as [URL="https://forums.epicgames.com/threads/906567-Pickup-Replacer"]
          Code:
          Jetpack.Jetpack_PickupFactory

          That's doesn't work, maybe I do somthk wrong? I put UTSuperDuperPickupSwitcher.ini to \Unreal Tournament 3 Black Edition\UTGame\Config

          SuperDuperPickupSwitcher.u to \Unreal Tournament 3 Black Edition\UTGame\Published\CookedPC\Script

          and folders \SuperDuperPickupSwitcher\Classes\ to \My Games\Unreal Tournament 3\UTGame\Src

          Try to replace Udamage with Armor and this works, but when i'm replacing uarmor with Jetpack.Jetpack_PickupFactory -

          ReplaceThisStuff=(OldClassName="UTPickupFactory_UD amage",NewClassPath="Jetpack.Jetpack_PickupFactory ")

          that doesn't work, why can be so?


          regard.

          Comment


            #6
            Download new version of mut, will try this.

            Comment


              #7
              Same thing

              ReplaceThisStuff=(RetimedSpawn=30,OldClassName="UT PickupFactory_UDamage",NewClassPath="Jetpack.Jetpa ck_PickupFactory")

              Comment


                #8
                Maybe that helps? Jetpack.u content this >>> Jetpack_PickupFactory extends UTItemPickupFactory;

                UTItemPickupFactory.Jetpack_PickupFactory don't work too(((

                Maybe Default__Jetpack_PickupFactory?

                regard.

                Comment


                  #9
                  Hmm. Looks like the old and new version does not work for custom stuff like this because of restriction in UnrealScript. I though NickG had implemented a proper way in his new version. So hopefully he's reading this post and able to fix that. Otherwise, you can check his source from the initial version (or the one you got) and replace the the Inventory class with the Jetpack inventory.

                  Or use this one (and extend to your needs). Note: There might be a typo or the code isn't working at all as I didn't check it, by basically it should work.
                  Code:
                  class MyMutator extends UTMutator
                      config(MyMutator);
                  
                  var config string InventoryClassString;
                  var class<Inventory> InventoryClass;
                  
                  event PostBeginPlay()
                  {
                      super.PostBeginPlay();
                  
                      InventoryClass = class<Inventory>(DynamicLoadObject(InventoryClassString, class'class'));
                      if (InventoryClass == none) Destroy;
                  }
                  
                  // Returns true to keep this actor
                  function bool CheckReplacement(Actor Other)
                  {
                      if (UTPickupFactory_UDamage(Other) != none)
                      {
                          UTPickupFactory_UDamage(Other).InventoryType = InventoryClass;
                          UTPickupFactory_UDamage(Other).InitializePickup();
                      }
                      return true;
                  }
                  
                  defaultproperties
                  {
                      InventoryClassString="Jetpack.Jetpack_Inventory"
                  }

                  Comment


                    #10
                    I make my first mut with your code, this replaced Udamage with jetppack, but after getting jetpack the PickupFactory removing from the game.

                    https://drive.google.com/file/d/0B7F...ew?usp=sharing

                    Comment


                      #11
                      Maybe here is the problem >>> if (InventoryClass == none) Destroy; ????

                      Comment


                        #12
                        The problem with that is not because of the code. It is basically the Jetpack inventory which hasn't got a respawn time. Not sure if the custom pickupfactory handles it correctly but the default pickup factories (which the code is using to replace the inventory class of) is disabling itself after the pickup is taken and the RespawnTime is 0. The factory assumes that it is an one-time item and disables itself. There is no proper way to fix that as it would either be hacky, needs subclassing of the Jetpack class or is less reliable. However, let's go with the last method. I don't cover why it needs that code but it is working.

                        Code:
                        class ReplaceUDamageWithJetpack extends UTMutator
                            config(MyMutator);
                        
                        var config string InventoryClassString;
                        var config float InventoryRespawnTime;
                        var class<Inventory> InventoryClass;
                        var array<Inventory> SpawnedInventories;
                        
                        // Returns true to keep this actor
                        function bool CheckReplacement(Actor Other)
                        {
                            if (UTPickupFactory_UDamage(Other) != none)
                            {
                                UTPickupFactory_UDamage(Other).InventoryType = InventoryClass;
                                UTPickupFactory_UDamage(Other).InitializePickup();
                            }
                            else if (Other.IsA(InventoryClass.Name))
                            {
                                SpawnedInventories.AddItem(Inventory(Other));
                                if (!IsTimerActive('FixRespawn'))
                                {
                                    // fix timer in the next tick
                                    SetTimer(0.0001, false, 'FixRespawn');
                                }
                            }
                            return true;
                        }
                        
                        function FixRespawn()
                        {
                            local Inventory Inv;
                            local PickupFactory PF;
                        
                            // remove empty entries
                            SpawnedInventories.RemoveItem(none);
                        
                            foreach SpawnedInventories(Inv)
                            {
                                if (Pawn(Inv.Owner) != none)
                                {
                                    foreach WorldInfo.RadiusNavigationPoints(class'PickupFactory', PF, Inv.Owner.Location, Pawn(Inv.Owner).GetCollisionRadius())
                                    {
                                        if (PF.IsInState('Disabled') || PF.bHidden || (UTPickupFactory(PF) != none && UTPickupFactory(PF).bIsDisabled))
                                        {
                                            if (PF.InventoryType == InventoryClass && InventoryClass.default.RespawnTime <= 0.0)
                                            {
                                                PF.SetHidden(false);
                                                PF.SetCollision(PF.default.bCollideActors, PF.default.bBlockActors);
                                                PF.SetPickupHidden();
                        
                                                if (UTPickupFactory(PF) != none)
                                                {
                                                    UTPickupFactory(PF).bIsDisabled = false;
                                                }
                                                PF.GotoState('');
                                                PF.RespawnEffectTime = -InventoryRespawnTime;
                                                PF.GotoState('Sleeping');
                                            }
                                        }
                                    }
                                }
                            }
                        
                            // clear
                            SpawnedInventories.Length = 0;
                        }
                        
                        DefaultProperties
                        {
                            InventoryClassString="Jetpack.Jetpack_Inventory"
                            InventoryRespawnTime=10.0
                        }
                        Btw. you should rename the mutator package and also the mutator name.
                        Code:
                        [MyMutator UTUIDataProvider_Mutator]
                        ClassName=ReplaceUDamageWithJetpack.ReplaceUDamageWithJetpack
                        FriendlyName=ReplaceUDamageWithJetpack
                        Description=Replace UDamages with jetpack
                        GroupNames=
                        UIConfigScene=
                        bStandaloneOnly=False
                        BitValue=0
                        bRemoveOn360=False
                        bRemoveOnPC=False
                        bRemoveOnPS3=False
                        PS: I noticed several bugs with the mutator when you die.

                        Comment


                          #13
                          Something i'm doing is wrong, but what?

                          1.
                          UTEditor.ini
                          [ModPackages]
                          ModPackages=MyMutator

                          2.
                          make file "My Games\Unreal Tournament 3\UTGame\Src\MyMutator\Classes\ReplaceUDamageWithJ etpack.uc"
                          is
                          Code:
                          class ReplaceUDamageWithJetpack extends UTMutator
                              config(MyMutator);
                          
                          var config string InventoryClassString;
                          var config float InventoryRespawnTime;
                          var class<Inventory> InventoryClass;
                          var array<Inventory> SpawnedInventories;
                          
                          // Returns true to keep this actor
                          function bool CheckReplacement(Actor Other)
                          {
                              if (UTPickupFactory_UDamage(Other) != none)
                              {
                                  UTPickupFactory_UDamage(Other).InventoryType = InventoryClass;
                                  UTPickupFactory_UDamage(Other).InitializePickup();
                              }
                              else if (Other.IsA(InventoryClass.Name))
                              {
                                  SpawnedInventories.AddItem(Inventory(Other));
                                  if (!IsTimerActive('FixRespawn'))
                                  {
                                      // fix timer in the next tick
                                      SetTimer(0.0001, false, 'FixRespawn');
                                  }
                              }
                              return true;
                          }
                          
                          function FixRespawn()
                          {
                              local Inventory Inv;
                              local PickupFactory PF;
                          
                              // remove empty entries
                              SpawnedInventories.RemoveItem(none);
                          
                              foreach SpawnedInventories(Inv)
                              {
                                  if (Pawn(Inv.Owner) != none)
                                  {
                                      foreach WorldInfo.RadiusNavigationPoints(class'PickupFactory', PF, Inv.Owner.Location, Pawn(Inv.Owner).GetCollisionRadius())
                                      {
                                          if (PF.IsInState('Disabled') || PF.bHidden || (UTPickupFactory(PF) != none && UTPickupFactory(PF).bIsDisabled))
                                          {
                                              if (PF.InventoryType == InventoryClass && InventoryClass.default.RespawnTime <= 0.0)
                                              {
                                                  PF.SetHidden(false);
                                                  PF.SetCollision(PF.default.bCollideActors, PF.default.bBlockActors);
                                                  PF.SetPickupHidden();
                          
                                                  if (UTPickupFactory(PF) != none)
                                                  {
                                                      UTPickupFactory(PF).bIsDisabled = false;
                                                  }
                                                  PF.GotoState('');
                                                  PF.RespawnEffectTime = -InventoryRespawnTime;
                                                  PF.GotoState('Sleeping');
                                              }
                                          }
                                      }
                                  }
                              }
                          
                              // clear
                              SpawnedInventories.Length = 0;
                          }
                          
                          DefaultProperties
                          {
                              InventoryClassString="Jetpack.Jetpack_Inventory"
                              InventoryRespawnTime=10.0
                          }
                          3.
                          "ut3.exe make"
                          4.
                          Move maked UTMyMutator.ini to Unreal 3\UTGame\Config

                          Move \My Games\Unreal Tournament 3\UTGame\Unpublished\CookedPC\Script\MyMutator.u to Unreal3\UTGame\Published\CookedPC\Script\

                          MyMutator.u should have same name as in UTMyMutator.ini ClassName=ReplaceUDamageWithJetpack.ReplaceUDamageWithJetpack ???

                          Comment


                            #14
                            This is maked by "ut3.exe make" UTMyMutator.ini

                            [ReplaceUDamageWithJetpack UTUIDataProvider_Mutator]
                            ClassName=MyMutator.ReplaceUDamageWithJetpack
                            FriendlyName=ReplaceUDamageWithJetpack
                            Description=
                            GroupNames=
                            UIConfigScene=
                            bStandaloneOnly=False
                            BitValue=0
                            bRemoveOn360=False
                            bRemoveOnPC=False
                            bRemoveOnPS3=False

                            Comment


                              #15
                              Why do you copy the code 1:1 into your post? No need for that.

                              As said, you should rename your package. Avoid generic names like MyMutator. Use the package name of ReplaceUDamageWithJetpack. The classname for the mutator will also be generated (by default) if you haven't created the ini file yet.

                              That said, I made a mistake with the config specifier in the code above. Instead of:
                              Code:
                              class ReplaceUDamageWithJetpack extends UTMutator
                                  config(MyMutator);
                              it should have been:
                              Code:
                              class ReplaceUDamageWithJetpack extends UTMutator
                                  config(ReplaceUDamageWithJetpack);
                              ... assuming the package is called ReplaceUDamageWithJetpack (the mutator class has the same name in this case which might be confusing).


                              Other than that, your steps are correct.


                              Edit:
                              Yes. That ini file works (should). But you should rename the package name as said before.

                              Comment

                              Working...
                              X