modding rifles???

Search, find and discuss about Mutators!
*/)nT...
Novice
Posts: 10
Joined: Mon Apr 21, 2008 10:20 am

modding rifles???

Post by */)nT... »

Hi all does anyone know of a good (simple :) Tutorial for modding rifles? I have tried wot greal a little but I am absolutely lost here I also have umake which I believe will compile when I am ready lol any help much appreciated!!!
{UTM}Warrior
Novice
Posts: 17
Joined: Mon Apr 21, 2008 12:39 pm
Personal rank: UT Master

Re: modding rifles???

Post by {UTM}Warrior »

Yea that would be great.

I would like to creat a rifle when while your standing still or crouched you'll shoot fast. I thought that they use the name 'crossfire' for it.

Hopefully someone can help us out ;)

:help:
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: modding rifles???

Post by Feralidragon »

@ */)nT... : To build a simple rifle, I have to know how to build a basic weapon first :wink:

Here's a link to a good tutorial: Unreal Wiki

@ {UTM}Warrior : That's very simple too (and a good ideia, congratulations :tu: ).
Let's think the sniper rifle for example:
1) Create a new subclass of SniperRifle (and save on you own package or in MyLevel);
2) Then just put this code on:
simulated function PlayFiring()
{
local int r;

PlayOwnedSound(FireSound, SLOT_None, Pawn(Owner).SoundDampening*3.0);

If (Pawn(Owner).bDuck == 0)
PlayAnim(FireAnims[Rand(5)],0.5 + 0.5 * FireAdjust, 0.05);
Else
PlayAnim(FireAnims[Rand(5)],(0.5 + 0.5 * FireAdjust) * 2, 0.05);

if ( (PlayerPawn(Owner) != None)
&& (PlayerPawn(Owner).DesiredFOV == PlayerPawn(Owner).DefaultFOV) )
bMuzzleFlash++;
}
This piece of code might work, and the result is double firing rate of sniper rifle when you are crouched.
And if this piece of coding (that I made in about a minute) doesn't work, well I am noob programmer so you have to ask another programmer. :wink:
{UTM}Warrior
Novice
Posts: 17
Joined: Mon Apr 21, 2008 12:39 pm
Personal rank: UT Master

Re: modding rifles???

Post by {UTM}Warrior »

{UTM}Warrior wrote:Yea that would be great.

I would like to creat a rifle when while your standing still or crouched you'll shoot fast. I thought that they use the name 'crossfire' for it.

Hopefully someone can help us out ;)

:help:
First of all thanks for your great help m8 ;)

Would you like to add me for helping me out via msn or something?
I really appreciate that.

My msn is: m.schuiling@hotmail.com

Greets,
*/)nT...
Novice
Posts: 10
Joined: Mon Apr 21, 2008 10:20 am

Re: modding rifles???

Post by */)nT... »

Thanks for ya help there mate :tu: I am receiveing this error message when compiling my project :NormalFire overrides version in parent class :confused2: :noidea :noidea :loool: its a longshot but does anyone have any idea what I have done wrong ??? Once Again any :help: much apreciated!!!
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: modding rifles???

Post by Feralidragon »

*/)nT... wrote:Thanks for ya help there mate :tu: I am receiveing this error message when compiling my project :NormalFire overrides version in parent class :confused2: :noidea :noidea :loool: its a longshot but does anyone have any idea what I have done wrong ??? Once Again any :help: much apreciated!!!
Strange...

First off, which version of UT are you running (v432 or v436 or another one), and which version of Ued (1.0 or 2.0)?

Second, post here your code to see what the problem might be. :wink:
*/)nT...
Novice
Posts: 10
Joined: Mon Apr 21, 2008 10:20 am

Re: modding rifles???

Post by */)nT... »

Hi version 451 and unreal ed 2.0 (which fails to open with general protection fault) Ive been wondering if that would cause the problem lol
Here is my code :
unction Fire (float Value)
{
if ( (AmmoType == None) && (AmmoName != None) )
{
GiveAmmo(Pawn(Owner));
}
if ( AmmoType.UseAmmo(1) )
{
GotoState('NormalFire');
bPointing=True;
bCanClientFire=True;
ClientFire(Value);
TraceFire(0.00);
}
}

state NormalFire extends NormalFire
{
function EndState ()
{
Super.EndState();
OldFlashCount=FlashCount;
}

Begin:
FlashCount++;
}

function Timer ()
{
Thanks for your help mate much appreciated :tu:
Last edited by */)nT... on Tue Apr 22, 2008 6:18 pm, edited 1 time in total.
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: modding rifles???

Post by Feralidragon »

First off, v451 of UT crashes Ued2.0 for sure, that's the main problem of your editor. You have to Downgrade your UT version to v440 or v436 (i have 436 with no problems at all), because v451 has that "bug" wich crash Ued2.0.

Second, yep, you made a mistake when you were writing your code, so this is the problem:

1) You only use "extends" or "expands" on the definition of the subclass, like:
Class YourClass extends ParentClass

And in your code this is already there:
class CcKrifle extends TournamentWeapon;
So you don't have to use this anymore in the rest of your code, you have to use this only on the first line of your code :wink:

2) As writed above, then this you coded is wrong:
state NormalFire extends NormalFire
To override the state NormalFire on your parent class, you don't need and can't extend it, so the right form is:
state NormalFire

So delete the "extends NormalFire" and the problem is solved :tu:

The same apllies to all "states" that you have badly placed "extends whatever"


I hope this solves your problem :wink:
*/)nT...
Novice
Posts: 10
Joined: Mon Apr 21, 2008 10:20 am

Re: modding rifles???

Post by */)nT... »

:tu: :tu: Hi thanks mate sorted that part now its failing on this lol
type mismatch in =.

Failing here : X=AdjustedAim;


here is the part of the code :
PawnOwner=Pawn(Owner);
Owner.MakeNoise(PawnOwner.SoundDampening);
GetAxes(PawnOwner.ViewRotation,X,Y,Z);
StartTrace=Owner.Location + PawnOwner.EyeHeight * Z;
AdjustedAim=PawnOwner.AdjustAim(1000000.00,StartTrace,2 * aimerror,False,False);
EndTrace=StartTrace + Accuracy * (FRand() - 0.50) * Y * 1000 + Accuracy * (FRand() - 0.50) * Z * 1000;
X=AdjustedAim;
EndTrace += 100000 * X;
Other=PawnOwner.TraceShot(HitLocation,HitNormal,EndTrace,StartTrace);
ProcessTraceHit(Other,HitLocation,HitNormal,X,Y,Z);

is that enough of the code ?

Once again thanks for your much appreciated help :D
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: modding rifles???

Post by Feralidragon »

Well, the problem when that error ocurrs is when you type:

Variable A = Variable B

but the variable type A is different from type B, which means that if you have, for example, Variable A as a String and Variable B as a Integer, of course you can't equal Characters to Numbers, do you understand?

So, your problem here is exactly this: you can't have X = AdjustedAim, because:
X is a Vector variable
and
AdjustedAim is a Rotator variable

which means that X represents a point at 3D space, and AdjustedAim represents an orthogonal rotation at 3D space, so you can't equal a Vector to a Rotator. :wink:

You have to find another way to build that part of code, if it's really needed to.
*/)nT...
Novice
Posts: 10
Joined: Mon Apr 21, 2008 10:20 am

Re: modding rifles???

Post by */)nT... »

Hi mate im really getting confused now as i am new to this (very)lol ive tried decompiling different guns and recompiling them straight back up and they seem to fail on similar things but they havnt even been modified? yet they all work fine before this proccess are there any tutorials on doing this as i carnt find one anywhere :confused2:
it seems the code that my rifle is failing to compile with is the same as a few others :confused2: :confused2: yet they work fine before being decompiled :lol:
Thanks for your help mate Its just a pity im too noobish at this to understand fully lol
Im just about ready to give up on the idea lol
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: modding rifles???

Post by Feralidragon »

Well, decompiling weapons sometimes give you errors when you compile them again, without modifying nothing, for example, the Guided Redeemer gives you an error about a texture when you recompile it. LOL

Just coment that line, like:
X=AdjustedAim

now replace by:
//X=AdjustedAim

to convert that code line to a comment

then recompile and if it doesn't give you any errors at all, then try your weapon and see where it fails in game.

Then tell here where it fails :wink:
*/)nT...
Novice
Posts: 10
Joined: Mon Apr 21, 2008 10:20 am

Re: modding rifles???

Post by */)nT... »

Hi once again thankyou :tu: :tu:
it now fails here lol

FireDir=P.ViewRotation;

Type missmatch in =.

lol
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: modding rifles???

Post by Feralidragon »

Well, exactly the same story I told you previously :wink:

FireDir=P.ViewRotation

FireDir is a Vector
ViewRotation is a Rotator


Then, do the same thing I told you previously:
Replace that line with:
//FireDir=P.ViewRotation

To make it a comment, then recompile a see what happens

P.S.: I think I will write a simple tutorial on how to do a simple rifle, this weekend :wink: , because your doubt is maybe the doubt of many more starting UnrealScript coders :roll:
*/)nT...
Novice
Posts: 10
Joined: Mon Apr 21, 2008 10:20 am

Re: modding rifles???

Post by */)nT... »

Hi I changed the line to a comment and it failed again somewhere else lol


a simple tutorial would be great help as I would really like to learn then I can maintain and change rifles ect if I choose :D
that would be very much appreciated and useful!!

:tu: :tu: :tu:
Thanks for your help :tu:
Post Reply