Results 1 to 9 of 9
  1. #1

    Default Help creating new weapons

    Hello everyone,

    I've been messing with the UDK for some days, watching tutorials and stuff, but I'm stuck when trying to create a new weapon.

    I reckon it must be so easy no one ever writes about it. I've stumbled onto weapon tutorials, but some are confusing and other lack information. For the time being, I just wanted to know how creating weapons work in UDK.

    By the way, I'm a programmer myself, so I'm familiar with object-oriented languages and stuff. So probably I'm not seeing something right beneath my eyes, so I'm here asking for help.

    How could I just instantiate a new pickup and weapon extending an UT weapon(like link gun, rocket launcher), using their same meshes, so I can play with their variables a bit? So far I can create an extended class, but it spawns with no mesh.

    I'm programming with Visual Studio with nFringe plug-in, and when creating an UT Mod Weapon, it creates 3 files, the uc, an ini and a int. I can't find the same files for existing weapons, are they necessary, how they work?

    Thanks for any help =) I pretend to make a proper tutorial covering each and every step needed after learning how to do it.

  2. #2
    MSgt. Shooter Person
    Join Date
    Aug 2006
    Posts
    104

    Default

    Preamble: I will probably restate some things you already know, but I'm trying to be more or less complete. Note that I have nFringe, but have not tried creating a 'project' as you described; I make script files and stuff manually.

    First, see http://udn.epicgames.com/Three/Weapo...icalGuide.html for some information on what happens behind-the-scenes with weapons, and where stuff goes in the code and how it is called.

    The three example weapons supplied in the UDK are good for learning, and at the same time not, because they all include fancy new things that change how the weapon works. The rocket launcher has a fairly complex alternate-fire mode, the link gun is capable of latching onto friendly teammates and vehicles, and the shock rifle introduces an effect when you shoot a shock ball with a beam. For purposes of learning and messing around with weapons in general, I would recommend modifying the shock rifle.

    The thing about the UDK is that, different from UT3, it does not have automatic localization and configuration files created when you make a new gametype, weapon, or mutator, so you have to create them manually. Without these files, the game lacks the information used to display stuff to the user, such as a mutator or weapon name, along with some other stuff that integrates it with the Unreal system.

    For an example mod MyMod, create a weapon UTWeap_UberRifle that extends UTWeap_ShockRifle, and in defaultproperties set FireInterval(0)=0.1. Save that as a .uc in the MyMod\Classes folder and compile.

    Then, in [UDK]\UTGame\Localization\INT\ create a file MyMod.int, and inside put the following:
    Code:
    [UTWeap_UberRifle]
    ItemName="Uber Rifle"
    PickupMessage="Uber Rifle"
    
    [UTWeap_UberRifle UTUIDataProvider_Weapon]
    FriendlyName="Uber Rifle"
    Description="And a partridge in a pear tree."
    The first section gives the game information that the weapon itself uses (namely, what to display when the player equips or picks up a weapon, respectively). The second section gives the game itself information on the weapon, so for example configurable mutators that let you select weapons (UTMutator_WeaponReplacement) will know the data on the weapon so it knows what to call it. This information can vary from language to language, so it is kept in a localization file (INT corresponds to International; English).

    Then in [UDK]\UTGame\Configuration\ create MyMod.ini, and put the following in it:
    Code:
    [UTWeap_UberRifle UTUIDataProvider_Weapon]
    ClassName=MyMod.UTWeap_UberRifle
    AmmoClassPath=UTGame.UTAmmo_ShockRifle
    This is some of the stuff that helps integrate the weapon with the system. I'm not positive on exactly what these lines in particular do or why they're there, but it's necessary, and it doesn't vary with language, so it is kept in the configuration file.

    With these three files, you should have a completed weapon. For quick testing, I recommend opening up the UDK Game and starting up a Deathmatch game with the Weapon Replacement mutator enabled and configured to replace everything (or just shock rifles) with our Uber Rifle. You could also make a level in the UDK Editor with a pickup base (if you know how to do that) in it that spawns your weapon.

    A note: unlike UT2004, in UT3 and the UDK weapons do not have their own pickup classes; one pickup class handles all of them. For a complete weapon, you generally would only need three files: one for the weapon, one for its ammo, one for its attachment (handles what the weapon looks like in the third-person view of the character. Using those is beyond the scope of this guide.

    Hm... Well, for not knowing much about all this, I seem to know a good deal about it. Please do make a tutorial on this and post it somewhere nice.

    To figure out what to do with the INI and INT files, I looked at UTGame.ini and UTGame.int and did a search for "Shock Rifle" and copied the format over to my own files. If you like, you can do the same thing with mutators to find out how those can be added to the UDK (it is a similar process to that of weapons, just different information put into the INI and INT files).

    Good luck.

  3. #3

    Default

    Thank you very much for all the advice, Kohan =)

    I guess it was kind of easy to figure that out, but I though UTGame was there as a guidance, as I saw some guide teaching to remove all UT content, making a 'UDK vanilla'.

    From now on, I'm taking a closer look at the UTGame folders and contents.

    Thanks again, I'll try to understand everything better and write about it =)

  4. #4
    MSgt. Shooter Person
    Join Date
    Aug 2006
    Posts
    104

    Default

    Good show.

    Yes, UTGame is there for guidance. It is basically a UT3 demo that includes most of the info necessary to build the entire game from scratch if you wanted. It shows how to use modularity, how to change things to behave the way you want, and so forth.

  5. #5

    Default

    hey guys, i had a crack at the setups Kohan described. is it possible to test this via the editor, creating a new weapon pickup and selecting the class?

    because it just came up with the 3 default weapons.. i think i might have gotten the .uc code wrong... what should be in the code?

    cheers
    Last edited by udk_nooby; 01-21-2011 at 02:12 AM.

  6. #6
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,986

    Default

    Sure, use notepad, or some other ASCII text editor.
    http://www.ericbla.de http://www.dungeondefenders.com http://en.wikipedia.org/wiki/Warm_Gun http://www.rekoil.com http://www.groundbranch.com

    - Please don't send me private messages asking programming questions, those would be better asked on the Programming forum here. Thanks

  7. #7

    Default Modify physics gun

    Hello Everyone,
    Along the same thought process here, I am interested in modifying the physics gun. I have duplicated the physics gun class and have added it to my own custom game folder as well as made the necessary changes to the class. Although everything is compiling correctly, I am not sure how to add the gun to the game. Previously to use the Physics Gun I added "bGivePhysicsGun=true;" to my MyGameInfo.uc file. Any suggestions to help me out would be greatly appreciated.

    Is it good form to modify the physicsGun class directly instead of duplicating it?
    Last edited by robodragon; 03-31-2011 at 02:32 AM.

  8. #8

    Default

    Never-mind, I seem to have solve my own problem. The answer is DefaultInventory(0)=class'Weap_MYPhysicsGun'

  9. #9

    Default

    Why dont you just extend UTWeap_ShockRifle and a UtProjectile (shockrifle or rocket)? Just change the particle systems for changing the visual and override the projectile class fucntions to modify the behaviour. The in your main weapon class (extende from UTWeap_Shockrifle), set this new Projectile class as projectile.
    (sorry I don't have UDK in my computer now. So i cannot give the exact class names to
    extend).

    To use this new weapon, set-up a pickup and set pickup factory to this new weapon class.

    There is a video tutorial at Eat 3D 'Unrealscript: Introduction and Application'. it explain how to easily modify an existing weapon.

    And here is another tutorial: http://udkc.info/index.php?title=Tut...eapon/Ranged/4
    Last edited by athmystikal; 06-03-2011 at 09:13 AM. Reason: Addional info


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.