Xero Mata
05-03-2005, 04:50 AM
I wish to make a bfg for ut like in doom (not doom 3), yet i have no idea how to code. just looking at coding confuses to no end. anyone willing help?
Scourgem
05-03-2005, 05:22 AM
http://wiki.beyondunreal.com/wiki/UnrealScript_Lessons
Professor
05-03-2005, 05:40 AM
Yes the link that Scourgem posted is a great one, but if you go poking around the wiki trying to learn, be prepared because a lot of it is geared towards UT2003. However the script is all the same in *most* instances. You'll be able to spot obvious differences like when it talks about "adreneline" or "emitters" or something that UT doesn't have.
You can also search the wiki using specific keywords if there is something specific you want to know about. :)
I'm not volunteering to do this but I will *try* to help if you get completely stuck. I would like for you to at least try to learn UScript first because it's really not that hard to do. :D But I also understand that it is not everyone's cup of tea. :( The biggest problem you'll probably face is learning how to use UCC.exe to compile a .u file especially if you have no prior experience using DOS or Disk Operated System programming.
Cheerz
Xero Mata
05-04-2005, 02:37 AM
i keep getting an error no matter what i try
Error: D:\UNREAL TOURNAMENT\BFG8k\Classes\BFG8k.uc(111) : Error, Bad or missing expression after '*'
here is the code ( some of it is borrowed from the BFG20k in U4eT)
//=============================================================================
// BFG8k.
//=============================================================================
class BFG8k expands TournamentWeapon;
var BFGLightning BFGL;
var vector start,X,Y,Z;
var int rollme;
var int count;
function float RateSelf( out int bUseAltMode )
{
local float EnemyDist;
local bool bRetreating;
local vector EnemyDir;
if ( AmmoType.AmmoAmount <=0 )
return -2;
bUseAltMode = 0;
if ( Pawn(Owner).Enemy == None )
return AIRating;
EnemyDir = Pawn(Owner).Enemy.Location - Owner.Location;
EnemyDist = VSize(EnemyDir);
if (( EnemyDist < 750 ) || (AmmoType.AmmoAmount < 50))
{
bUseAltMode = 0;
return AIRating;
}
else
{
bUseAltMode = 1;
return 2*AIRating;
}
}
// return delta to combat style
function float SuggestAttackStyle()
{
local float EnemyDist;
EnemyDist = VSize(Pawn(Owner).Enemy.Location - Owner.Location);
if (EnemyDist < 300)
return -0.5;
else
return -0.2;
}
function SetWeaponStay()
{
if(!class'TournamentWeapon'.default.bOverkillNeverStay) Super.SetWeaponStay();
else bWeaponStay = false; // Overkill weapons never stays
}
function Fire( float Value )
{
skin=texture'Belt_fx.Damage.Pulsehit';
if(AmmoType.UseAmmo(50))
{
PlayFiring();
GotoState('Firing');
}
else GotoState('DownWeapon');
}
simulated function PlayFiring()
{
PlayAnim('BigFire',0.40*SpeedMod,0.01);
PlayOwnedSound(FireSound, SLOT_None,Pawn(Owner).SoundDampening*4.0);
if ( PlayerPawn(Owner) != None )
PlayerPawn(Owner).ShakeView(1.3, ShakeMag, ShakeVert);
}
state Firing
{
ignores Fire,AltFire;
function tick(float DeltaTime)
{
local rotator newrot;
if(BFGL!=None)
{
GetAxes(Pawn(owner).ViewRotation,X,Y,Z);
Start = Owner.Location + CalcDrawOffset() + (29-8) * X + FireOffset.Y * Y + FireOffset.Z * Z;
BFGL.DrawScale+=(DeltaTime*0.05);
BFGL.SetLocation(Start);
newrot=rotator(X);
rollme+=500*(Deltatime*100);
newrot.roll=rollme;
BFGL.SetRotation(newrot);
}
}
function timer()
{
ProjectileFire(class'BFGparticlesIn', 0, false);
count++;
SetTimer((7-count)*0.048,false);
}
function BeginState()
{
count=0;
SetTimer((7-count)*0.048,false);
rollme=0;
Owner.MakeNoise(Pawn(Owner).SoundDampening);
GetAxes(Pawn(owner).ViewRotation,X,Y,Z);
Start = Owner.Location + CalcDrawOffset() + 29 * X + FireOffset.Y * Y + FireOffset.Z * Z;
BFGL=Spawn(class'BFGLightning',,,Start);
BFGL.LifeSpan=(BFGL.LifeSpan/SpeedMod);
}
simulated function AnimEnd()
{
if(AnimSequence!='KickFire')
PlayAnim('KickFire',0.5*SpeedMod,0.01);
else Finish();
}
Begin:
sleep(1.3);
sleep(0.2/SpeedMod);
PlaySound(Misc2Sound, SLOT_None,Pawn(Owner).SoundDampening*4.0);
if ( PlayerPawn(Owner) != None )
PlayerPawn(Owner).ShakeView(2.5*ShakeTime, 5*ShakeMag, 5*ShakeVert);
if ( Owner.IsA('PlayerPawn') )
PlayerPawn(Owner).ClientInstantFlash( -0.4, vect( 370, 580, 190));
bPointing=True;
ProjectileFire(ProjectileClass, ProjectileSpeed, bWarnTarget);
if ( Owner.bHidden )
CheckVisibility();
BFGL.Destroy();
FinishAnim();
PlayAnim('Idle',1,0.01);
Finish();
}
defaultproperties
{
AmmoName=Class'BFG8k.BFGCore'
PickupAmmoCount=50
FireOffset=(X=25.000000,Y=-2.500000,Z=-2.000000)
ProjectileClass=Class'BFG8k.BFGBall'
AIRating=0.750000
DeathMessage="%o vaporizes in %k's BFG inferno."
AutoSwitchPriority=13
InventoryGroup=10
PickupMessage="You got the BFG20000"
ItemName="BFG20000"
RespawnTime=45.000000
PlayerViewOffset=(X=2.600000,Y=-1.500000,Z=-2.000000)
}
Professor
05-04-2005, 06:01 AM
i keep getting an error no matter what i try
Error: D:\UNREAL TOURNAMENT\BFG8k\Classes\BFG8k.uc(111) : Error, Bad or missing expression after '*'
here is the code ( some of it is borrowed from the BFG20k in U4eT)
Ah Ha! Okay now we're getting somewhere!!! :D See this line?
Error: D:\UNREAL TOURNAMENT\BFG8k\Classes\BFG8k.uc(111): Error, Bad or missing expression after '*'
The big red letters indicate that in the class file BFG8k.uc at line number 111 there is an expression that also has a '*' in it and it is after this '*' where the error lies. Okay this is another really GREAT reason to get a text editor that also has line numbering capabilities so that when the compiler gives you a line number you can go straight to the problem and start to figure it out instead of having to actually count the lines yourself. I would like to recommend UltraEdit as a great text editor but it costs $35. :( If you look in that link to the wiki about UScript lessons you'll see some links to some different free text editors that also have line numbering capabilities. At least I think there is one that is free that will do this.
Okay now back on track. Line number 111 is this next line.
PlayAnim('KickFire',0.5*SpeedMod,0.01);
There! do you see the '*'? and where it says "SpeedMod"? A "Bad or missing expression" compiler error *usually* means you have not declared a variable that you've used in the script. I looked for SpeedMod and could not find where it has been "declared" in your script. What you'll have to do is go back to the original class and do a text search for "SpeedMod" to find out what kind of variable it is and how it modifies this variable to be used in line number 111 in your script. Now SpeedMod could be a float or an Integer(declared as Int). Floats are declared as "float" and integers are declared as "int". For example, if I wanted to declare a float for SpeedMod I'd do it like so at the top of the script or at the top of the function *if* it is a local variable. If it is not a local variable then it *has* to be declared at the top of the script like so.
var float SpeedMod;
Now *every* variable that is declared within a function *has* to be declared as a "local" variable always like so.
local float SpeedMod;
The difference between a local variable and a class scope variable is that a local variable can *only* be used by the function that it is declared in and no where else in the script so it just depends on how you need to use the variable that will determine if using a local in a function is acceptable or not. Since you only have one function called "RateSelf" in your script and I have only found instances of SpeedMod in the RateSelf function it *may* be okay to declare the SpeedMod variable as a local variable inside the RateSelf function but that would depend on the class that you borrowed the code from. If that class also uses SpeedMod in other functions you may have to also include those functions in your script since you are subclassing TournamentWeapon here and not the U4E weapon. If you were subclassing the U4E weapon you could get away with this because your weapon would "inherit" everything from the U4E weapon.
Upon further inspection of the script I see I'm wrong about there only being the RateSelf function in your script Xero Mata. So it looks like you may have to use a class scope variable instead of a local one since SpeedMod was also used in other functions.
I'm hoping at this point that you know the difference between a floating point number and an integer?. Integers have no decimal places but that does not mean they cannot be negative numbers it just means that there is no such thing as an integer that equals 1.2 or 0.1. Those are floats. Floats have decimal places so 1.2 and 0.1 are floating point numbers hence the name "float". An example of an integer is 2, or 19, or 2048 or -1024.
Now there is another type of numeric number type called a "byte" and a byte is kind of like an integer with a lot more limitations. A byte cannot be negative and a byte may not go lower than 0 or higher than 255. Adding 1 to a byte that already contains 255 will make it = 0 and subtracting 1 from a byte that already = 0 will make it = 255 and subtracting or adding 1.2 to/from a byte is impossible since the compiler would throw a "type mismatch error" upon compiling since bytes also do not have decimal places.
Well I hope this has given you something to go on and look for. I'm really impressed that you've made it this far all the way up to a compiler error!. :D :D Most people give up waaaaaay before that time!!!. :(
Edit: Um I also see numerous other things in your script Xero Mata that are going to make the compiler thorw a hissy fit!. lol like this variable declaration at the top of the script.
var BFGLightning BFGL;
You are going to need to code a class called BFGLightning to add to your weapon because the BFGL variable has been declared as a BFGLightning variable type. Now you should (really you absolutely *must*) change the name of BFGLightning to something else since the U4E weapon already uses that name and it will cause errors if your weapon is played with the U4E mod installed!.
Cheerz
Professor
05-06-2005, 11:19 PM
How's this coming along Xero??? You still stuck on something or maybe I need to be clearer?
Just curious. I'm always at the beck and call of a nice weapon!!! It's just something I cannot help! lol Grrrrr! :evil:
Cheerz
vBulletin® v3.7.2, Copyright ©2000-2013, Jelsoft Enterprises Ltd.