![]() |
|
|
#1 |
|
OK, I'm making a mutator much like the HE chaingun tut does in the Wiki:
http://wiki.beyondunreal.com/wiki/We...tator_Tutorial basically, what I want to do is cause a redeemer explosion when an assaultrifle grenade is supposed to explode. I sublcassed the assaultriflegrenade class to change the projectile to a redeemer projectile and I also spawned a redeemer projectile (did this after just changing the default properties to redeemer projectile didn't work) instead of the grenade in the spawn function of the assaultriflegrenade class. I know all the subclassing in the world won't make the code run in the game, so I followed the tutorial's way of making the mutator to replace the weapon in the game. Everything compiled except the mutator subclass I made b/c it had a problem with the 'config(user);' part. I took it out, then compiled fine, but, no redeemer explosion in the game. I think this is the root of the problem, but I don't know how else to replace the weapon w/ the new weaponsubclass I made. here is the code that I have for what I'm trying to do (for some its easier than my long ass description): Code:
class AssaultRifleN extends AssaultRifle;
defaultproperties
{
FireModeClass(1)=Class'assaultrifleN.AssaultGrenadeN'
PickupClass=Class'assaultrifleN.AssaultRiflePickupN'
}
Code:
class AssaultRiflePickupN extends AssaultRiflePickup;
defaultproperties
{
InventoryType=class'assaultrifleN.AssaultRifleN'
PickupMessage="You have some good ****"
}
Code:
class AssaultGrenadeN extends AssaultGrenade;
function projectile SpawnProjectile(Vector Start, Rotator Dir)
{
local RedeemerProjectile g;
local vector X, Y, Z;
local float pawnSpeed;
g = Spawn(class'RedeemerProjectile', self,, Start, Dir);
if (g != None)
{
Weapon.GetViewAxes(X,Y,Z);
pawnSpeed = X dot Instigator.Velocity;
if ( Bot(Instigator.Controller) != None )
g.Speed = mHoldSpeedMax;
else
g.Speed = mHoldSpeedMin + HoldTime*mHoldSpeedGainPerSec;
g.Speed = FClamp(g.Speed, mHoldSpeedMin, mHoldSpeedMax);
g.Speed = pawnSpeed + g.Speed;
//g.Speed = FClamp(g.Speed, mSpeedMin, mSpeedMax);
g.Velocity = g.Speed * Vector(Dir);
g.Damage *= DamageAtten;
}
return g;
}
defaultproperties
{
ProjectileClass=Class'XWeapons.RedeemerProjectile'
}
Code:
class grenadearena extends Mutator
config(user);
function bool CheckReplacement( Actor Other, out byte bSuperRelevant )
{
bSuperRelevant = 0;
if ( xWeaponBase(Other) != None )
{
if ( xWeaponBase(Other).WeaponType == class'AssaultRifle' )
xWeaponBase(Other).WeaponType = class'AssaultRifleN';
else
return true;
}
else if ( WeaponPickup(Other) != None )
{
if ( string(Other.Class) ~= "xWeapons.AssaultRiflePickup" )
ReplaceWith( Other, "assaultrifleN.AssaultRiflePickupN");
else
return true;
}
else
return true;
return false;
}
defaultproperties
{
GroupName="grenadearena"
FriendlyName="grenadearena"
Description="you got some good ****"
}
Last edited by Undertaker989; 15th Aug 2003 at 02:24 PM. Reason: added [code] tags |
|
|
|
|
|
|
#2 |
|
Please use [code] tags when posting code here.
Add some logging to your classes to make sure they are actually used. (also see UnrealWiki: Debugging Techniques) My suggestion would be thinking about what your mutator class actually does. It replaces Assault Rifle pickups with your own pickups. This won't have any effect in most, if not all maps simply because there are no Assault Rifle pickups, you start with the Assault Rifle in your inventory.
__________________
Wormbo's UT/UT2004/UT3 mods | YouTube channel | PlanetJailbreak | Unreal Wiki | Liandri Archives Everything you ever wanted to know about replication | UnrealScript security considerations <elmuerte> you shouldn't do all-nighters, it's a waste of time and effort <TNSe> nono <TNSe> its always funny to find code a week later you dont even remember writing <Pfhoenix> what's worse is when you have a Star Wars moment <Pfhoenix> "Luke! I am your code!" "No! Impossible! It can't be!" |
|
|
|
|
|
|
#3 |
|
A few suggestions on debugging weapon mutes:
1) Make sure you update the ItemName of the weapon class. You need to that anyway, which I don't think the MiniHE tute mentions, because it's written kinda poorly. 2) Add a weapon entry to your mutator's package INT file. You can use xWeapons.int as an example if need be. You need to do this as well, because it's the only way to get non-specific code to recognize your weapons, and the MiniHE tute should mention this as well. 3) With the above two things done you *should* be able to put your weapon into the game using normal arena mutators like, well, arena or WORM or SwitchArsenal or InstantWeapon. It will show up on the list with your new ItemName. This way you can test your weapon seperate from your arena mute. 4) The class detection code in the MiniHE tute and the xpak code in general has been deemed, well, messy. There are better, more reliable methods. 5) As Wormbo said - AR is a special case. Look at the Assault Rifle Magnum code in the xpaks (there is a link to the code off the MiniHE tute I think) - what you need to change is the default weapon instead.
__________________
_____________________________ I remember old school. Champion of Glaucoma Inducing Radiation Everywhere |
|
|
|
|
|
|
#4 |
|
Wormbo: sorry about the lack of tags man... I'll sure use them in the future as they come in handy.
I've decided I got sloppy w/ my class names and that it was something I was overlooking concerning the assault rifle seeing it is the initial weapon. I think it is that I didn't change the default weapon as RegularX said. I decided to start over from scratch and to change the rocket launcher into a grenade launcher that has a modified redeemer explosion. SUCCESS!! I made sure I tweaked the functions in the classes as opposed to just changing the default properties. I know that changing just the default properties won't do squat in most cases, and must seem retarded, but I'm just making these weapon mutators to learn Uscript/get back into the swing of programming. It has been about 2 years since my C++ class. Learning is my main purpose for making these weapon mutators basically... Soooo here is a .zip of my weapon mutator so you guys can enjoy/critique if you desire. http://www.members.cox.net/bsimeon1/Bweapons.zip have fun! |
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|