Announcement

Collapse
No announcement yet.

Any1 know how to enable health packs to collect over 199 limit?

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

    Any1 know how to enable health packs to collect over 199 limit?

    Hi,

    Any1 know how to enable health packs to collect over 199 limit?
    Can this be achieved by altering script in the file TournamentHealth.uc file?
    If so please explain how and what I need to change.

    Thanks

    Chris

    #2
    First find where the 199 limit is enforced. I'm not sure honestly, it could be part of the player, or the health items themselves could make the check. Once you find where the limit is enforced, create a subclass and override any functions/variables that enforce the rule, removing the restriction.

    Comment


      #3
      From Pawn.uc:

      Code:
      var float           HealthMax;
      var float           SuperHealthMax;
      var travel int      Health;         // Health: 100 = normal maximum
      Healthmax is the limit set when trying to pick up health packs (+ looking ones). SuperHealth is when picking up kegs and vials, and using booster. Health is probably the health you start with.

      It would be pretty easy to make a mutator to ModifyPlayer() and change these default properties. Remember, even though the code's in pawn it's also in xPawn due to inheritence.

      Comment


        #4
        as above, in pawn.uc, you could just extend pawn and set up:

        defaultproperties

        {
        SuperHealthMax=600.000000
        }

        im thinking that should work

        Comment


          #5
          Or, to avoid having to implement a new pawn, just use the ModifyPlayer function in your Mutator.

          class myHealthMutator extends Mutator

          function ModifyPlayer( Pawn P )
          {
          Super.ModifyPlayer(P);
          P.default.SuperHealthMax=600;
          P.default.HealthMax=600; // for normal health packs
          P.default.Health=200; // start with 200 health
          }



          The default HealthMax is 100 and the default SuperHealthMax is 199. So, if you want the big keg o' health to put you above 199, just adjust SuperHealthMax. If you want normal health packs to put you above 100, adjust HealthMax.

          Comment


            #6
            Excellent job MCN! 1 question though. Using your code, when you 1st spawn into a server, you start off with 100 health. If you die, you start with 200. Anyway to fix that?

            Comment


              #7
              woops yeah... try adding this into the ModifyPlayer as well:

              P.Health=200;


              I'm hoping this will set the actual value of the health, while the other settings will set the defaults, in case they're used anywhere else. I can't guarantee this will work because I'm not at home to try it, but I've modified shield strength using this same method in the past, so it should.

              [EDIT] You might also have to set the actual values of the other two properties in there, as setting their default may not necessarily change their current values. In fact, it might work without setting the defaults at all, since this is going to run each time a player spawns.[/EDIT]

              Comment


                #8
                To expand on my last post here, you might want to try this instead, because if it works it makes more sense to do it this way.

                class myHealthMutator extends Mutator

                function ModifyPlayer( Pawn P )
                {
                Super.ModifyPlayer(P);
                P.SuperHealthMax=600;
                P.HealthMax=600; // for normal health packs
                P.Health=200; // start with 200 health
                }


                Let me know if it works.

                Comment


                  #9
                  Hey... I think I just figured out a better solution that will make much more efficient code, someone try it and let me know if it works!

                  class myHealthMutator extends Mutator

                  function Initialize()
                  {
                  local class<Pawn> GamePawn;
                  GamePawn = class<Pawn>(DynamicLoadObject(Level.Game.DefaultPl ayerClassName,class'Class'));
                  GamePawn.default.SuperHealthMax=600;
                  GamePawn.default.HealthMax=600; // for normal health packs
                  GamePawn.default.Health=200; // start with 200 health
                  }


                  Ideally, this should set every player pawn to spawn with 200 health, and the maximums should be used too.

                  If you try this, take out the ModifyPlayer section.


                  [EDIT] The reason I say this is much more efficient is that it will only run when the mutator loads, not every time a player or bot spawns. Setting the defaults should hopefully take care of everything. Sorry about giving you so many different answers, I'm just learning too! [/EDIT]

                  Comment


                    #10
                    function ModifyPlayer( Pawn P )
                    {
                    P.Health=200;
                    P.HealthMax=600;
                    P.SuperHealthMax=600;
                    Super.ModifyPlayer(P);
                    }


                    Indeed, this does work. GJ!

                    EDIT: Ill try out your new code and see what happens. It's kinda over my head now, though. Im still learning too.

                    EDIT2: It didnt work. No errors in showlog. Everyone had 100 health including me, and my max was 199.

                    Comment


                      #11
                      Cool, give my latest suggestion a try, because that one you said works will run each time a player pawn is created. The latest one should only run once and should do the same thing. Much more efficient that way.

                      [EDIT] Alright, no go, oh well. I think there's probably a way to do it similarly to what I have in there. Maybe put a log call in there to log what the DefaultPlayerClassName is.
                      Log(Level.Game.DefaultPlayerClassName);
                      See what prints out in the log file. If nothing prints, then the reason it's not working is because Initialize isn't running.[/EDIT]

                      Comment


                        #12
                        When you get home, see if you can perfect this. Id be interested so see what the correct code looks like.

                        Comment


                          #13
                          Sure thing. I'll take a look as soon as I can.

                          It's possible that just putting it in the PreBeginGame function rather than Initialize could be what we need to do. I'm sure somebody out there knows exactly how to do this in the best way, maybe they'll notice us and post here!

                          [EDIT] I tried to get this to work, and it's just no good. I must be missing something. For now, I guess you can just use the suggestion that worked. [/EDIT]

                          Comment


                            #14
                            Any luck? I still havent figured it out =/

                            Comment


                              #15
                              This works for me...

                              ====begin code====
                              class mutBigHealth extends Mutator;


                              function ModifyPlayer(Pawn Other)
                              {
                              Other.Health=200;
                              Other.HealthMax=600;
                              Other.SuperHealthMax=600;
                              Super.ModifyPlayer(Other);
                              }


                              defaultproperties
                              {
                              GroupName="Groupname Here"
                              FriendlyName="Friendly Name Here"
                              Description="Description here"
                              }
                              ====end code====

                              I don't see why yours doesn't, only thing is the Pawn P being Pawn Other in mine. Maybe I'm missing something, but I spawn with 200, and can pick up Healths and mini Healths and add to that, presumably to 600, though I didn't run around and find out. It was in Instant Action, but this should work just fine in any mode.

                              Dicky B, don't forget to activate your mutator, though. I forgot like twice.

                              [edit] the .int file would look something like this:

                              [Public]
                              Object=(Class=Class,MetaClass=Engine.Mutator,Name= YourPackage.mutBigHealth,Description="Mo Health Mo Health Mo Health.")

                              Comment

                              Working...
                              X