View Full Version : Editing Weapon Stats Through Mutator
warlord57
12-22-2007, 10:36 PM
I am trying to edit variables of weapons and projectiles through a mutator without extending classes of weapons and projectiles. I can't seem to figure out how to edit a variable in a different class without getting an error.
Here is the code I am using but reports an error saying AmmoCount is not a recognized member of Class.
function InitMutator(string Options, out string ErrorMessage)
{
class'UTWeap_ShockRifle'.AmmoCount = 50;
Super.InitMutator(Options, ErrorMessage);
}
I tried using CheckReplacement and it worked for weapon variable editing but not Projectile variable editing.
What is the correct code and where would it go to work on editing variables in other classes.
Thanks in Advance.
Solid Snake
12-22-2007, 11:21 PM
When I release UT Mechanic, you can attempt to adopt it for weapons. It does a similar thing but for vehicles.
warlord57
12-23-2007, 12:24 AM
when will that be? why couldn't you just post how to do it instead of saying to wait for you to release your mutator? wouldn't it be easier and faster to just say how to do it?
EntropicLqd
12-23-2007, 03:55 AM
For projectile values I think you will have to use the default values of the class.
If I remember correctly there is code in UTWeapon that references the projectile speeds and such like.
e.g. class'MyProjectileClass'.default.Acceleration (or whatever the attribute is).
warlord57
12-24-2007, 12:01 AM
For projectile values I think you will have to use the default values of the class.
If I remember correctly there is code in UTWeapon that references the projectile speeds and such like.
e.g. class'MyProjectileClass'.default.Acceleration (or whatever the attribute is).
I see where you got that in that class. However that is just accessing the variable from that class. You can not edit the default variables in a class unless they are a config variable.
I can't figure out how to get it to work.
Wormbo
12-24-2007, 04:59 AM
You should modify the actual instances of the weapon and ammo pickups instead of messing with default values, because the former will only affect the match in which the mutator is active, while the latter may actually persist even in later matches when the mutator was disabled.
Solid Snake
12-24-2007, 08:05 AM
when will that be? why couldn't you just post how to do it instead of saying to wait for you to release your mutator? wouldn't it be easier and faster to just say how to do it?
Soonish, hopefully in the next one to two days. I didn't full explain it because the implementation itself is some what complex for me to simply describe it without making a lot of sense. And it's always much easier when the source code is available to pick apart.
I'll explain it in short. Essentially the mutator runs at a tiered level. The structure of it is simply:
Mutator -> Config -> Implementation or
UI -> Config -> Implementation
The reason why I have done it this way is simply because it is very extensible and supports custom vehicles easily. All I or the vehicle's author would need to do is write the implementation subclass (it also supports custom variables and structs, so if they used a complex config setup my mutator would also handle it).
First of all, the config class, is simply more or less a config class. It stores data and that's about it. The implementation class is where most of the work is actually done. Anyways, the mutator within CheckReplacement scans the config object list to see what config needs to be applied. When it finds the appropriate config object, it then asks the config object to configure the vehicle. The config object statically asks the implementation class to apply the config values.
I suppose it is possible that I could have eliminated the use of config -> implementation but I felt it was necessary as I could then secure the actual configuration actions and totally abstract away the work that the mutator does. This allows for a rather transparent way of doing things.
Anyways that's the gist of how the mutator functions.
warlord57
12-24-2007, 10:16 AM
You should modify the actual instances of the weapon and ammo pickups instead of messing with default values, because the former will only affect the match in which the mutator is active, while the latter may actually persist even in later matches when the mutator was disabled.
I know to just modify the actual instances but I can't seem to edit the values of the variables. I have only been able to edit the weapon itself and not the projectiles using CheckReplacement. Other than that it has came up with an error almost every time or did nothing.
marilol
12-24-2007, 11:03 AM
Why not use the mutator Newtators 1.1
That has a weapon edit and you could probably look at it then build another one for projectiles.
warlord57
12-24-2007, 09:45 PM
Why not use the mutator Newtators 1.1
That has a weapon edit and you could probably look at it then build another one for projectiles.
thanks for the idea, hopefully i can adapt it to projectiles.
Edit: which mutator in Newtators 1.1 has that kind of editing? only 2 I see would be dual enforcer and the fast weapon switching and that uses modifyplayer and checkreplacement and I have tried that for projectiles but checkreplacement does not seem to check for projectiles.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.