Okay, cool! Might not have time to look at it tomorrow, if I don't I will look at it within the next couple of days.
Announcement
Collapse
No announcement yet.
Mutator that adds custom weapon to existing UT3 maps
Collapse
X
-
No hurry. I'm just throwing out some good stuff which I actually ever wanted for years. It will be a good addition for my snippets collection:
https://github.com/RattleSN4K3/UT3-Snippets
Comment
-
Originally posted by UTCollector88 View PostOriginally posted by RattleSN4K3 View PostStill 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 PerObjectConig class could look like this:
Code:class MyWeaponLocationInfo extends Object config(MyMutatorConfig) PerbObjectConfig; var string MapName; var array<Vector> WeaponFactoryLocations;
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)
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.
Comment
-
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.
Comment
-
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).
Comment
-
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?
Comment
-
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=)
Comment
-
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
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=)
[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
Code:%userprofile%\Documents\My Games\Unreal Tournament 3\UTGame\Published\CookedPC\Script\XMutatorWeaponAdd.u
[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'
Comment
-
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.
Comment
-
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?
Comment
-
Originally posted by UTCollector88 View PostNow 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 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 PostOne other important thing I though of does this mutator work well in multiplayer mode, mainly when hosting games?
Comment
-
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.
Comment
-
You could check the code on GitHub.
Originally posted by UTCollector88 View Post1) 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.
Changes
Specific changes [1] [2]
Originally posted by UTCollector88 View Post2) Extend the code so that you can select more than just the shock rifle to be used in the XWeaponAddFactory.
Changes
Specific change
Comment
-
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'
Comment
Comment