Announcement

Collapse
No announcement yet.

Mutator that adds custom weapon to existing UT3 maps

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

  • replied
    Okay, I get it now. The red lines are from the older file and should be deleted. That is why they have a minus next to them. The green lines are new lines of code which I need to add to the file to update it.

    I fixed up the WeaponAddLocationInfo.uc file and modified it accordingly and recompiled everything again. No compiling script errors. I opened up the editor and put 2 XWeaponAddFactories in the Biohazard map. One with the shock rifle and the other with a custom weapon the Ripper and pressed the editor saver button. I tested the mutator in game again and the two pickup factories were there with the correct weapons assigned. Success!

    There is one other thing I wanted to do I just remembered, I wanted to be able to store custom ammo pickups the same way. I will have a look at decompiled uc file again to see if it already has a function for that. I can't remember.

    Leave a comment:


  • replied
    As said before, the red lines in the GitHub changes view are the ones from the older version of the file (which got removed/changed). The greeon ones are from the newer version.

    You don't need to clear the default weapon. But you can. As long as you specifiy your desired weapon in a placed weapon factory, the default WeaponPickupClass isn't used in any way.

    Leave a comment:


  • replied
    I decided to go to method 2. I have added the necessary code to the WeaponAddLocationInfo.uc file. By the way what is the difference between the green lines of code and the pink/red lines of code in github? I also assume you need to change the XWeaponAddFactory.uc file as well to add more WeaponPickupClasses.

    In Default Properties{} Where:

    WeaponPickupClass=class'UTWeap_ShockRifle'

    Leave a comment:


  • replied
    You could check the code on GitHub.

    Originally posted by UTCollector88 View Post
    1) Leave the XWeaponAddFactory as is and create separate custom pickup weapon factories for each weapon or custom weapon I want to add and link them to the mutator.
    "FactorySubclasses" branch on Github
    Changes
    Specific changes [1] [2]


    Originally posted by UTCollector88 View Post
    2) Extend the code so that you can select more than just the shock rifle to be used in the XWeaponAddFactory.
    "MultipleWeapons" branch on Github
    Changes
    Specific change

    Leave a comment:


  • replied
    If I modified the code for the custom pickup factory to be able to use more than just the shock rifle will the mutator be able to store the weapon I select the custom pickup factory to use in the editor using the saver button? I am thinking of doing it either two ways:

    1) Leave the XWeaponAddFactory as is and create separate custom pickup weapon factories for each weapon or custom weapon I want to add and link them to the mutator.
    2) Extend the code so that you can select more than just the shock rifle to be used in the XWeaponAddFactory.

    Leave a comment:


  • replied
    Originally posted by UTCollector88 View Post
    Now that the mutator is working, I wanted to ask can you set the custom pickup factory to use more than just the shock rifle and be able to choose diff weapons in the custom pickup factory like you can with normal placed weapon pickup factories in the editor? Do I need to add to the code and re-compile for this?
    You would need to extend the code. And also re-compile that. The example code should be used as template or source to implement your own mutator.

    You can check the branch "MultipleWeapons" on Github how such extension could work.
    https://github.com/RattleSN4K3/UT3-S...commit/f6158d0

    Originally posted by UTCollector88 View Post
    One other important thing I though of does this mutator work well in multiplayer mode, mainly when hosting games?
    It works well. I tested it during the development. Keep in mind, that bot support is not given for mutliplayer session or singleplayer games. Navigation needs to be calcluated in the editor for a map and UT3 doesn't support dynamic navigation in that sense that you're able to place a nav point and rebuilt the nav data. I couldn't find any way to support that.

    Leave a comment:


  • replied
    Now that the mutator is working, I wanted to ask can you set the custom pickup factory to use more than just the shock rifle and be able to choose diff weapons in the custom pickup factory like you can with normal placed weapon pickup factories in the editor? Do I need to add to the code and re-compile for this?

    One other important thing I though of does this mutator work well in multiplayer mode, mainly when hosting games?

    Leave a comment:


  • replied
    It was the script file that was the problem. I had it in %userprofile%\Documents\My Games\Unreal Tournament 3\UTGame\Published\Script\

    instead of:

    %userprofile%\Documents\My Games\Unreal Tournament 3\UTGame\Published\CookedPC\Script

    I think I should get rid of the other folder. Can't remember how it got there.

    Leave a comment:


  • replied
    Possible missing steps:
    - Adding mutator
    - Copying mutator script to Published\CookedPC\Script folder




    If you compile the source code, it should print a log like this (compiling with debug):
    Code:
    Init: Version: 3809
    Init: Epic Internal: 0
    Init: Compiled: Mar 26 2009 01:14:17
    Init: Command line:  -debug
    Init: Base directory: C:\Progam Files (x86)\Unreal Tournament 3\Binaries\
    Init: Character set: Unicode
    Log: Executing Class Editor.MakeCommandlet
    --------------------Core - Debug--------------------
    --------------------Engine - Debug--------------------
    --------------------GameFramework - Debug--------------------
    --------------------Editor - Debug--------------------
    --------------------UnrealEd - Debug--------------------
    --------------------UnrealScriptTest - Debug--------------------
    --------------------IpDrv - Debug--------------------
    --------------------OnlineSubsystemGameSpy - Debug--------------------
    --------------------UWeb - Debug--------------------
    --------------------UTGame - Debug--------------------
    --------------------UTEditor - Debug--------------------
    --------------------UTGameContent - Debug--------------------
    --------------------UT3Gold - Debug--------------------
    --------------------UT3GoldGame - Debug--------------------
    --------------------WebAdmin - Debug--------------------
    --------------------XMutatorWeaponAdd - Debug--------------------
    Analyzing...
    Parsing XWeaponAddFactory
    Parsing XWeaponAddLocationInfo
    Parsing XWeaponAddMutator
    Compiling XWeaponAddFactory
    Compiling XWeaponAddLocationInfo
    Compiling XWeaponAddMutator
    Importing Defaults for XWeaponAddFactory
    Importing Defaults for XWeaponAddLocationInfo
    Importing Defaults for XWeaponAddMutator
    Scripts successfully compiled - saving package 'C:\Users\RattleSN4K3\Documents\My Games\Unreal Tournament 3\Binaries\..\UTGame\Unpublished\CookedPC\Script\XMuta
    torWeaponAdd.u'
    --------------------XMutatorWeaponAddEditor - Debug--------------------
    Analyzing...
    Parsing XWeaponAddEditorLoader
    Parsing XWeaponAddEditorMutator
    Parsing XWeaponAddEditorSaver
    Compiling XWeaponAddEditorLoader
    Compiling XWeaponAddEditorMutator
    Compiling XWeaponAddEditorSaver
    Importing Defaults for XWeaponAddEditorLoader
    Importing Defaults for XWeaponAddEditorMutator
    Importing Defaults for XWeaponAddEditorSaver
    Scripts successfully compiled - saving package 'C:\Users\RattleSN4K3\Documents\My Games\Unreal Tournament 3\Binaries\..\UTGame\Unpublished\CookedPC\Script\XMuta
    torWeaponAddEditor.u'
    
    Success - 0 error(s), 0 warning(s)
    
    Execution of commandlet took:  7.69 seconds
    Afterwards - as the editor package also got compiled - you can open the editor and have the Loader and Saver button available. You can place your special factory (in this case: XWeaponAddFactory). Save the profile with the Saver button.

    I previously copied your example entry into the config file:
    Code:
    [DM-Biohazard XWeaponAddLocationInfo]
    MapName=DM-Biohazard
    Factories=(Name="XWeaponAddFactory_0",Location=(X=2.000000,Y=432.000000,Z=237.000000),Rotation=(Pitch=0,Yaw=0,Roll=0),Scale=1.000000,Scale3D=(X=1.000000,Y=1.000000,Z=1.000000),Base=)
    I loaded that.
    [ATTACH=CONFIG]17643[/ATTACH]

    After that, closing the editor and starting the game. Only the mutator has to be added addiotionally:
    [ATTACH=CONFIG]17644[/ATTACH]

    Note: If you are running the game without the special switch (-useunpublished), you have to copy the script files from the unpublished folder to the published folder.
    From:
    Code:
    %userprofile%\Documents\My Games\Unreal Tournament 3\UTGame\Unpublished\CookedPC\Script\XMutatorWeaponAdd.u
    to
    Code:
    %userprofile%\Documents\My Games\Unreal Tournament 3\UTGame\Published\CookedPC\Script\XMutatorWeaponAdd.u
    It will look like this if everything worked out correctly:
    [ATTACH=CONFIG]17645[/ATTACH]

    PS: Check your log file for something like this to see if you need to copy the script file to a proper path:
    Code:
    Warning: Failed to load 'Class XMutatorWeaponAdd.XWeaponAddMutator': Failed to find object 'Class XMutatorWeaponAdd.XWeaponAddMutator'

    Leave a comment:


  • replied
    My UTXMutatorWeaponAdd.ini entry for DM-Biohazard

    [DM-Biohazard XWeaponAddLocationInfo]
    MapName=DM-Biohazard
    Factories=(Name="XWeaponAddFactory_0",Location=(X= 2.000000,Y=432.000000,Z=237.000000),Rotation=(Pitc h=0,Yaw=0,Roll=0),Scale=1.000000,Scale3D=(X=1.0000 00,Y=1.000000,Z=1.000000),Base=)

    Leave a comment:


  • replied
    I tried it out but it seems not to be working. XWeaponAddFactory is nowhere to be found on the map I put it in. I do not know if I am missing something. This is what I did:

    Opened map DM-Biohazard in the editor

    Place XWeaponAddFactory at any locations in that map via
    Actor > NavigationPoint > PickupFactory > UTPickupFactory > UTWeaponPickupFactory > XWeaponAddFactory

    Use the XMutatorWeaponAdd Saver button at the left toolbar to save locations into a map profile of the current opened map


    I need more help?

    Leave a comment:


  • replied
    Added code annotations. Might help to understand some specific code.

    Leave a comment:


  • replied
    The "commit" view only shows the changes that were made to the specific files. It depends on the actualy view (unified or split) how changes are represented. In unified view, each file is listed as a single one where red lines indicate removed lines and green would be added ones. In split view, there are actually two columns where the old code is on the left side and the changes on the right. Only changes are shown.

    The evolution of the code is not that important but could be interesting and helpful. Mainly, you can use the last source code and check its workflow. There isn't that much code so you probably won't have to look at a ton of code. But if have some questions, feel free to ask.

    An important note which I forgot adding to the readme: The editor part is split from the core mutator as if they are in the same package, multiplayer won't work. A client crashes if they are trying to load editor code in an online game (that's what the package is doing if it is initialized). The editor package is only required for creating profiles. If you want to share such mutator (for a runtime version for instance), you only need to share the specific core mutator package and not such editor code (but you can; as stated in the readme).

    Leave a comment:


  • replied
    I downloaded and installed and compiled the mutator package. No issues with compiling which is good. I will test the adding custom factory in editor method later on. I looked at the source code and how the mutator evolved and got a basic overall understanding. There are still some bits of code which I am not exactly sure what they do in themselves, plus there are little things in how github presents the code which I don't understand.

    Leave a comment:


  • replied
    Originally posted by UTCollector88 View Post
    Originally posted by RattleSN4K3 View Post
    Still not sure what you want to do.
    • Adding weapons to existing maps where any other pickup isn't located
    • Adding weapon existing weapon factories (which is replacing)
    • Exchanging the existing weapon factories with a custom one (which isn't required if the factory doesn't do any fancy stuff)
    The first point is the one I wanted to do.
    The provided source would be suited for that. However, you should think about how to support different maps. Basically you can use PerObjectConfig to store the configuration for each map name under the specific config file. Or hard-code everything into the mutator class.

    The PerObjectConig class could look like this:
    Code:
    class MyWeaponLocationInfo extends Object
        config(MyMutatorConfig)
        PerbObjectConfig;
    
    var string MapName;
    var array<Vector> WeaponFactoryLocations;
    A config entry would look like this (named just like the map name):
    Code:
    [DM-Deck MyWeaponLocationInfo]
    MapName=DM-Deck
    WeaponFactoryLocations=(X=0,Y=1,Z=2)
    WeaponFactoryLocations=(X=1,Y=2,Z=3)
    
    [DM-Defiance MyWeaponLocationInfo]
    MapName=DM-Defiance
    WeaponFactoryLocations=(X=3,Y=2,Z=1)
    You can retrieve the per-object configs by using Object::GetPerObjectConfigSections.

    Based on this idea, I created a working example. This mutator can be found here:
    https://github.com/RattleSN4K3/UT3-S...Weapons-AddNew

    Check how the mutator evolved. This might help to understand the steps I did (and why).
    https://github.com/RattleSN4K3/UT3-S...commits/master

    Hopefully this will help you for your specific mutator to add custom weapon to existing maps.

    Leave a comment:

Working...
X