Announcement

Collapse
No announcement yet.

Remove Weapons from players?

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

    Remove Weapons from players?

    If I want the player to start with no weapons, what would I do?
    (Removing weapons entirely would be fine too... just as long as when they are playing and they spawn, they are not holding a weapon.)

    I was told that it was in the PAWN script or something... but I'm not to familiar with the scripting of UT2004.

    What do I need to edit and how so that the player has no weapon?

    #2
    i think you could do this...

    Code:
    class YourMutator extends Mutator;
    
    function ModifyPlayer(Pawn Other)
    {
    	
        Pawn.Weapon.Destroy();
        
        if ( NextMutator != None )
    		NextMutator.ModifyPlayer(Other);
    
    }
    or like this... if you wanted to change it.

    Code:
    class YourMutator extends Mutator;
    
    function class<Weapon> MyDefaultWeapon()
    {
    	if ( (DefaultWeapon == None) && (DefaultWeaponName != "") )
    		DefaultWeapon = class<Weapon>(DynamicLoadObject(DefaultWeaponName, class'Class'));
    
    	return DefaultWeapon;
    }
    ...and change "return DefaultWeapon;" to "return;"

    that should start you with no weapon

    or you can change DefaultWeaponName to whatever weapon you want to start with

    Comment


      #3
      So... I put that where? In the pawn script? (if it goes in there, WHERE does it go... I spent a while looking confused at the screen when i saw the scripts and as you can tell, got no where...)

      Comment


        #4
        In a mutator class. If I have time tomorrow morning I'll write you a little mutator that will remove the weapon for you. Then you can open it up and see how it works.

        Comment


          #5
          Originally posted by CDtech026 View Post
          In a mutator class. If I have time tomorrow morning I'll write you a little mutator that will remove the weapon for you. Then you can open it up and see how it works.
          Thanks, I would very much appreciate this... as I apparently I suck at understanding UT2004 code...

          Comment


            #6
            Ok. It's done. This will start you with no weapon. But if you scroll on the mouse to change weapons it WILL flip to your shield gun, as the player still spawns with that. If you also need that removed... let me know.

            Source
            Code:
            class NoWeaponMut extends Mutator;
            
            function ModifyPlayer(Pawn Other)
            {
            
                Other.Weapon.Destroy();
            
                if ( NextMutator != None )
            		NextMutator.ModifyPlayer(Other);
            
            }
            The mutator is called NoWeapon and all you have to do is unzip it into your system directory.

            Comment


              #7
              There's a way to get the player to spawn without a shield gun?
              If that's possible it'd be greatly appreciated...

              Comment


                #8
                K. no problem.

                Code:
                class NoWeaponMut extends Mutator;
                
                function ModifyPlayer(Pawn Other)
                {
                    local Weapon W;
                
                    foreach DynamicActors(class'Weapon', W)
                    {
                        If (W.Owner == Other)
                        {
                            W.Destroy();
                        }
                    }
                
                    if ( NextMutator != None )
                		NextMutator.ModifyPlayer(Other);
                
                }
                same deal as before... extract to system folder...

                NoWeaponMut.Zip

                This starts the player with nothing... no translocator, no shield gun, and no assault rifle. Enjoy. :-)


                EDIT: Just an FYI... this will cause tons of errors in your log file because the bots also spawn with no weapons. They stop once all the bots find a weapon.

                Comment


                  #9
                  T_T link not working... stupid media fire...

                  And yes, I realize that it will cause some HUGE divide-by-zero-type-error-thingy or something when the bots have no weapon... but I don't really care cause I wasn't really planning on using the level with bots anyways...

                  Comment


                    #10
                    Link Fixed

                    I dont think its a divide-by-zero error... its more of a (bot - "OMG AN EMEMY!! FIRE! FIRE! FIRE!... wait... i have no gun! &$*%!") error...

                    something with Bot.WhatToDoNext()

                    Comment


                      #11
                      THANK YOU!!! ^_^
                      It works very well. You're good at this...

                      Comment


                        #12
                        lol thanks. i wish my own projects were as easy...

                        Comment


                          #13
                          Originally posted by pyromaster114 View Post
                          So... I put that where? In the pawn script? (if it goes in there, WHERE does it go... I spent a while looking confused at the screen when i saw the scripts and as you can tell, got no where...)
                          You can use Notepad or get ConTEXT or any good text editor. Save it as in UT2004\YourPackageName as YourClassName.uc, where YourClassName is the name of the class (first line of code) and YourPackageName is the name of the U package that will generate (should match the package name called in any classes, for example AmmoType="YourPackageName.YourClassName). Then in in UT2004\System\UT2004.ini, find the section with 'EditPackages=[i]PackageName[i]' and add to the end of the list 'EditPackages=YourPackageName. Then go into command prompt, change the directory to your UT2004\System folder (ie. "cd\UT2004\System") and type 'ucc make' to compile any packages in the list that do not currently exist. This will generate [i]YourPackageName[i].u (the package) and [i]YourPackageName[i].ucl (the classes list) in your UT2004\System folder. Now the mutator should show up in the mutators list. You have to delete the .u and .ucl files if you want to recompile to make changes, etc.

                          Comment


                            #14
                            So... any chance there's a way to make it so when you select the level, the mutator is turned on automatically? (Like some sort of thing you add to your level that says "by default these mutators are on:....(list of mutators)...")?

                            Comment


                              #15
                              that would require an embedded mutator... which i think involves editing the actual map.

                              Comment

                              Working...
                              X