What I want to do:Some custom weapons integrated in maps (for example "MH-RuinsOfHarobed][+.Lminigun") should be changed before mapstart to tournament weapons in hope that NaliWeapons3 will change them to a NaliWeapon3 afterwards.For this in the ini file of my monsterhunt mod I store the class name of the weapon to change and the class name of the destination weapon. Same for Ammo.

I have no clue where I should start at. I looked into Stuffswapper mutator code and Nali Weapons 3 code (class NWReplacer) but it seems much too complicated for me. Is there an easy way to do this?

What I have done before was using the NW3 Replacer mutator. This worked fine for me, it changed many weapons and ammo with custom classes. But then I noticed that my weapon priority list stored in User.ini constantly was messed up when using the NW3 Replacer for more weapons than could be stored in User.ini. User.ini stores 50 weapons but I need more weapon replacements, so I use the NW3 Replacer now only for Tournament and UnrealShare weapons. I think my additional wanted weapon changes should not effect the weapon priority list.

Perhaps some source code for this is flying around and can be adapted? Perhaps it is much easier as I think?

Last edited by Aldebaran on Sun May 06, 2018 7:35 pm, edited 1 time in total.

My first assumption if there is not such a configurable option in NW any, it would be nice to make a mutator to solve this problem by loading it with a high priority, I mean to be the first in chain. Why ? Because if I'm thinking at my mods, the mutator for preventing craps at teleporter is one of the latest in chain leaving those "big guys" to attack teleporter first - let's say that I need to move them when things are ugly in original placement, and then Teleporter bugger actor will need to spawn after Move and not earlier. I think this is available for other replacements as well. Let the "bad-ass" to work before finishing replacements with others, unless NW is not getting into top by itself (I don't know that structure because I'm not using it) and then if this is what it does you have to delay that action by loading it in other way - using an actor helper which will wait 100 ms until to load NW stuff.

As a sample, in my gaming environment, NavAdder is on top followed by NsUTw3 and some Map-Vote which are placed in Run-Line for capturing the Level before others. Things like NsSpawpoint2 and Teleporter-Bugger (or such) and things like Weapon-Loaders are the last ones mentioned in Map-Vote chain - loaded logically after Map-Vote's great entrance. If some Bot problems are happening these are mainly very last things in chain, Bot is not a priority, it shows up after at least 1 second which is more than enough for various brain injections - if are needed.

Another key for your doorUsually game-type running there with its BaseMutator aka MutatorClass are first things which are started. There you can configure a class (or more) to be loaded in their PreBeginPlay() (not sure if before will help being to early for relevance checks) but if you load the custom thing like that probably will react faster than NW - you have to prepare your mod for that task (like XC_Monsterhunt). In XC_MonsterHunt is possible to load 3 things before even BaseMutator, There you can do replacements without even to use CheckReplacement default solution, you can manually replace some Items but... a lot of testing is required in order to not fail with relevance.

Master-CardXCGE can load whatever XC specific Actor which can be a real bad-ass thing if you need early tweaks.

To check:A ServerActor specific tweak - I did not use this way nowhere but as I know so far, that is one of first operations when server is initialized happening before to see other things working. Just made a blind actor with a log in PreBeginPlay and see when actor starts writing log file. I'm guessing it happens enough faster...

Karma: PatienceJust wait... a lot... for NW's action using a delayed mutator/actor for doing what wants to do. If something is not replaced, trigger an inventory looping for new replacements, probably NW will capture new tournament types occurred later, if not, use some stuff based on a list - Higor's MH has such a deal which I rented because it's awesome - there you can dictate replacements, if something is bugged you can switch to another thing.

Thank you very much for this detailed description how I could realize the tournament weapon to Nali Weapon 3 swap, sektor2111.Another problem for me is how can I swap the custom map weapon/ammo to the tournament weapon/ammo first. I need some code for this, perhaps with a DynamicLoadObject function?

It's been a long time since I looked into my own code concerning this, but upon a brief check on NWReplacer, it has a built-in "feature" of sorting out the weapon priorities in your User.ini file.I believe I added this in the final version of the mod when there was a fair number of reports stating how their standard UT weapon priorities would be messed up whenever they entered a NW3 server, mostly NW3 MH servers.

If I recall, the reason was exactly the fact that there were a lot more weapons than the User.ini could store: there are the UT weapons, then a lot of NW3 weapons, and also some extra custom weapons these servers have due to the maps used with custom content.So what I did was to build a functionality within the NWReplacer to automatically fix the weapon priorities list, but setting specific priorities for UT weapons first, and everything else second, and it seems to have solved the issue, and from there no one else had any problems when leaving a NW3 MH server for another one.

While in the base class this functionality is disabled by default, the actual NW3 mutator that replaces every weapon is NWMainReplacer, which extends from NWReplacer, and enables it by default, and it has the follow priorities set (in the defaultproperties block):

If you don't want the weapon priorities to be recalculated, it would seem that it would be as simple as setting enableWeaponPrioritiesProcessor to False, however such is not the case because this is a client-only setting (and it was meant to be that way), meaning that it's set in such a way that only players get to decide whether to disable this or not.Incidentally, UTWeaponPriorities are also client-only, for the same reason.

So, the only way to effectively disable it would be to subclass the NWMainReplacer and set enableWeaponPrioritiesProcessor to False in the defaultproperties, and use that one as the main mutator to replace the weapons.Either that, or subclass it and set up the UTWeaponPriorities in a way they work out for you, which is also an option and should work fine as well.

However, keep in mind that the weapon priorities may still get messed up due to the limit of 50 weapons, which is way too low and I wonder why Epic set such an obviously low number.

As for anything else concerning NWReplacer, this base mutator is really meant to do things a different way, in a way that actually works unlike most replacement mutators.The usual way of replacing weapons is extremely unstable from the engine side, I had all sorts of weird bugs popping up and even stupid engine crashes, besides limiting what I could replace (like the weapons from Skaarj troopers for example, which would be always bugged), so I do things a lot differently in this mutator, by actually allowing the weapon to be fully spawned and then take unto myself (my mutator) to do the replacement by actually spawning another weapon and destroying that one.

It's not nearly as clean, but it's reliable and bug free most of the time, and allowed me to include much more powerful functionality in it that most of the community isn't remotely aware about (although it's documented). I would even go a step further and say that it's still the most powerful weapon/inventory replacer mutator there is in UT99 on its own (although I could be wrong), but it doesn't have menus to set it all up, it's all done through the .ini files or through extending the class (the NWCoreVIII package alone was also meant to be used as a small SDK, and it's also documented as such).

So, probably everything you want to do you can actually do with a NWReplacer, or by just adding entries to the NWConfig.ini file, I just need to understand exactly what you want to do in order to help you figuring it out (concrete examples would help).

Hello Feralidragon, thank you for your help. It's some months ago I tried the not correct working NW3 configuration, so I hope I can reconstruct the main problem. Fortunately I have found the old config file

First of all I want to say, that I am using the Final version of NaliWeapons3.

In this NWConfig.ini I have used under section [NWCoreVIII.NWMainReplacer] all 64 WeaponItem slots for: Tournament Weapons, UnrealShare Weapons and other custom weapons. Also I have defined good UTWeaponPriorities I would like to have, but they are ignored in this case because I have set enableWeaponPrioritiesProcessor=False.

Anyway after playing a match my complete weapons priorities list in User.ini is messed up. They got wrong order but primarily there are entries of classes they aren't weapons. An Example of this list in User.ini after playing one match:

Here it is now the class (or variable?) msgBoxHeight, every time I play a match and close my UT another random class/variable is stored there. This also happens if I set enableWeaponPrioritiesProcessor=True.

I remember that I investigated this, where these random classnames come from. But I forgot it. I tried many different settings but none worked for me. As far as I remember, only if I don't use custom weapons with the NW3 Replacer I got a fine priorities list in User.ini, so thats the reason I am only using Tournament and UnrealShare Weapons with the NW3 Replacer right now.

Another thing I miss here are more WeaponItem/AmmoItem slots for the NW3 Replacer. 64 weapons inclusive the Tournament Weapons are not enough in my case, 128 would be better

But if I don't understand you wrong, it is not that easy to write an own good working weapon replacer function/mutator. In that case I will let the situation as it is and won't touch the custom weapons.

If you are agree I will point some snippets which I used and rented from Higor. WeaponPriority for player and what server is replacing are two different things. If server doesn't have that replacement probably you can bind priorities until next year and weapon from map will stay. Without to check what NW can do or not do I'll show you a simplified snippet from XC_MonsterHunt - more exactly BaseMutator which that game uses:

Little explanations.These replacements as you can see are configurable, NOT hard-coded, and they are using names/strings - text type format so they don't use any other files as dependencies because don't have classes referenced but blind text, code can be compiled without more pain in whatever mutator.As result if you set as Name "LMinigun" and as replacement string "BotPack.minigun2" for sure that whatever Lminigun will be a normal "minigun2" which will be replaced, and then you can proceed the same with ammo. Aside, at end of array, if still exist a weapon not replaced, do another configurable common replacement for other items unknown and then leave NW to continue the task.Now you can check where has to be placed this thing: Before or After NW in chain.

Oh I saw a similar routine in MH2Gold where UnrealShare Weapons can be swapped. Perhaps I should try this way. The reason I thought that this is not so perfect is, you can have two different weapons with the same class name.For example: olweapons.olquadshot and mhmonsters.olquadshot. Using your method both weapons will be swapped even only one of them should receive attention. Same with ammo, for example: utmhpack.olshells and mhmonsters.olshells.I will report later...

Last edited by Aldebaran on Mon May 07, 2018 10:52 am, edited 1 time in total.

Aldebaran wrote:The reason I thought that this is not so perfect is, you can have two different weapons with the same class name.

Because code is mainly copied and not that fixed so it's nothing lost. Want a sample ? OLAutomag. Do you know by chance a fixed one ? Me personally I worked harder a few years ago to find a common replacement. It did not work due to classes conflicts but using text methods all craps are outta Level because all those OL things are far from my needs.I assure you that those weapons have flaws and excuses were like "nobody is using Bots in Single Player" because of... Bot code itself. But... smarts have forgot about monsters. A rammed weapon can lock a monster and sometimes this is heading to a server stuck, I'm not kidding here. If you want to replace every single weapon with NW it's probably a good point, else you really don't want OL OS and other buggers from ice age.

More funky "not a problem stuff"OLEightball and other OLEightball - tick is original and if that doesn't means nothing Let's say that you cannot hear grenade explosion ON-Line as good as they are. To not forget OLStiger and what does in certain conditions - the same Accessed Nones. OLDPistol was fascinating, and stupid me I did not tested well that MH504 and neither others which I asked - all versions definitely have problems in RateSelf - old debates.OLFlakCannon quote at a genius "flak ammo is bugged" . A zero code actor has bugs you have to be on drugs with such affirmation. Probably that "OLFlakCannon" is crapped up because if you get the code from UT_FlakCannon and you are adapting animations suddenly Flakammo it's no longer bugged.Not going to debate un-existent Amplifier and WeaponPoweUp stuff left outside for no reason. None of those OLASMD weapons don't work correctly with those items.

To summarize, the problems which you are concerned about "names" for sure doesn't exist, all those things are bad, then, conforming them in a better stuff will probably do more mess than expected. I could play some Liandri Map and when I saw all weapons properly replaced I could not stop laughing .

Good to know, however by reading entire "problem", you should pay attention at details speaking about this MH stuff, weapons, ammo and... content generally... (WC content) taking also in account the title of this topic.

Aldebaran wrote:For example: olweapons.olquadshot and mhmonsters.olquadshot. Using your method both weapons will be swapped even only one of them should receive attention. Same with ammo, for example: utmhpack.olshells and mhmonsters.olshells.

The way in how others are working in MonsterHunt is hilarious and these methods for me have no place in my servers regarding to map aspect. I'll throw in toilette any retarded thing like that. Master package is always called and that new one it's just another duplicate loaded and we can respect Engine if it's not crashing at such a miserable way of doing. That's why any content from UTMHpack and MHMonsters will have the same replacement because... it's the same guy with a different name... like some people over here...This is one of reasons why I'm groaning at these MH "modders". They were ruining MonsterHunt since forever with their dumb works. Imagine that public repositories are fine thanks because nobody seems to be willing to clean all trash except that "map" WierdOrWonderful which I was looking around for it (patch testing purposes) and it do seems to be vanished (no PlayerStart actors keeping servers empty). At least they do seems to learn the lesson in hard way...

I looked only for an example for what I want to say. Perhaps I have choosen a very bad one... After finishing my weapon swapper this thing seems not to be such a problem, most weapon classes I see have different names.I have edited my previous post, because I was wrong that weapons classes to swap to have to be known by the compiler. But they must exist in ServerPackages or be downloaded with the map as far as I can see, so nothing special here.

I see that you have sorted out your issues and got things working, so I will just reply to your latest post to me.

While NWReplacer is indeed limited to 64 slots, NWReplacer is just an abstract base class to be extended from to actually have working replacer mutators.So, if you need 128 slots, you can subclass the NWReplacer into another mutator class very easily, and then you can have the NWMainReplacer and your own both active at the same time, and it just works, because NWReplacer mutators can be safely stacked together for replacement purposes, so in practice this means that you're never limited to 64 slots, you can in fact create as many slots as you need by just subclassing this mutator.(all of them except for one should have the weapon priorities stuff disabled though)

An example of this is the NWMHOldReplacer class, which extends the NWReplacer just like the NWMainReplacer, but it's set exclusively to replace the old Unreal weapons by the NW3 counterparts.And it's loaded by the NWMainReplacer itself depending on a specific setting (enableOldWeaponsReplace, which is False by default, but you can enable it in the ini), meaning that you can have different mutators set with different sets of weapons to be replaced by mod type for example, and probably the setup you did with the NWMainReplacer already exists in NWMHOldReplacer, which means you can free up those slots if you want.

As for the actual difficulty in having a good replacement mutator working, it's indeed harder than it should be.Theoretically, what almost all mutators do (if not all besides my own to be honest), is to follow the same recipe of using CheckReplacement and AlwaysKeep to replace, keep or set up the weapons.And while it tends to work fine for most things, it goes awfully wrong sometimes, and even weirdly so in a few cases.

For example: I vaguely remember that replacing the minigun ammo in the "usual" way has led weapons to "shoot" the replaced ammo instead of consuming the ammo and do the trace they should make.It was probably something to do with the weapon itself spawning the ammo itself when it was needed in order to use it, but then since these methods do not really know or care how the ammo is going to be bound to either a weapon or a pawn, things go awfully wrong in these cases as they get replaced.

Spawning a weapon to give to a pawn directly also goes completely wrong, and this is why Skaarj troopers don't get their weapons replaced (besides other game breaking bugs), as well why the "loaded" command will give you normal weapons instead of the ones from whichever weapon mod you're using at that moment, and if I recall correctly even the LMS gametype generally does not work either with custom weapon mods (although I am not entirely sure).The ReplaceWith is a complete mess and does all the wrong assumptions too.

Therefore, the main thing the NWReplacer does is to not replace the weapon and other things right away during these checks.Instead, I mark the weapon with another class of my own for replacement, and I only process the replacement in the following tick, and this is to allow the game and whichever mods do what they want to do with the weapon (spawn it in a map, give it to a pawn, etc), and then after they are done my class just comes in and checks it and replaces it properly.

This is why the NWReplacer works virtually in every situation, including the "loaded" command, LMS, skaarj troopers, any code that uses the GiveWeapon method, etc (in NW3 MH servers you will see skaarj troopers with BoltRifles, IRPRs, and other weapons, sometimes even with nukes and other stuff when they are assigned a Redeemer by the original mapper).And this is also why I was able to add more features, such as playing with both normal weapons and NW3 at the same time in the same match, dynamically tweak some properties in the replaced weapon from the ini alone, and overall having much more control over the replacements than any other mutator is able to provide at the moment.

And while if I did it again I would probably do things a lot better and a lot more efficiently, the usual recipe of replacing things is still bound to lead to all sorts of problems, and for me the NWReplacer seems to be the best class to use, since it's quite battle tested by all sorts of servers by now.

This doesn't mean you shouldn't do your own, but you should know where you're getting yourself into, before I did NW3 I actually had no clue how much of a science a "simple" replacement mutator would become.

Aldebaran wrote:What does DoRuin(Other)? I let this passage away and have no problem right now.

I did something there in my own way, no one was doing that before and I was intended to develop that way, something to prevent whatever custom CreatureFactory to spawn items that will be replaced causing recursive loads. Simply there is an item, bring the replacement but do not destroy the old, maybe you want to revert them back after ending game (I had plans in that time until I quit them because doesn't worth, thanks to new maps crapping MH at full power).That function spawns an assistant actor waiting a bit and then is disabling it (in human terms item is fucked properly until it goes to hospital, for no longer be a problem). The deal was that if some mutator does need old original stuff at something that one exist in Level but unseen and it can be recovered (until it comes out cured from hospital).You can use default format of replacements but I don't advice you at that like Ferali said.Aside I was thinking that destruction is not that healthy all time - depends on instance.XC_MonsterHunt if I'm not mistaking has source-code and you can look for it somewhere in XCGE section (finally done). There you can figure what borks I might did, and... for sure that thing has "gates" for recovery if something is evil in structures is not such a bad-ass restricted in functionality.Last time -- a dude here had some problems with whatever Horseflies. Seriously ? Remove them with other mutator loaded properly - switch carcasses... What's the problem after all ?- problems with some mutator, player having no weapon. Seriously ? Just claim who is that default weapon and I'll bet that everyone has weapons - like FF mod which initially was spreading borks. If mods are incomplete and primitive, result can be seen in this MH as long as I do not have any chainsaw here as you might be expecting;- problems that monsters are aggressive in my mods. Seriously ? By looking in dictionaries I see that monster has nothing in common with a pet or a lamb or such. I think THESE aren't bugs are just zero skilled players around, because my monsters are very monsters as they are, are monsters after all.They could be more aggressive but UE1 can damage even multi-core systems if I'm pushing limits making action nasty, because getting rid of iterations limits is doable in a nice state code but I assure all of you that you don't have machines for what monsters I can do - STOCK monsters so to speak.

Thank you all for your comments, I think I have understood most of it. I had some issues with SkaarjTrooper (or SkaarjSniper?) too, they got the NWTheMinerVIII.TheMiner but they didn't shoot with it, they were harmless

Perhaps sometime I will do more attempts to get NWReplacer run here without User.ini issues.Or I will be able to code a building up mutator on this.