View Full Version : Projectile Class
legacy-ThanadoS
07-14-2004, 04:16 PM
Hi folks.
I got another question... How do i define a new projectile class to say... the rocketlauncher?
I know the Firemodeclass, the ammoclass, the pickupclass, but i really don't know how to assign a new projectile class?
Help anyone? :)
legacy-the Adster
07-14-2004, 05:00 PM
Right, this is a little complicated, so listen up and stop talking at the back (I saw that finger gesture, see me after this).
Define your own weapon class (extend any existing weapon, like the Link Gun for example), in the defaultproperties of it define the FireModeClass(0) as a custom one (we'll extend this from an existing one in a moment). So far you should have been able to follow that (I hope so, as I've just got back from the gym so might be a little confusing).
Extend one of the weapon fire classes (like BioFire for example). At this point you should have a custom Link Gun that fires Bio Blobs, you can stop reading now if that's all you want to do.
Otherwise, extend one of the projectile classes (like BioGlob for example), change the defaultproperties for your custom weapon fire class's ProjectileClass to this new class. You can change the way your custom projectiles act by making changes to its defaultproperties. Change the speed to 25000 for super-fast BioGlobs etc.
Hope that helps.
legacy-skyshooter
07-14-2004, 05:12 PM
Hi, i got your pm...
ok, in the other thread i posted the whole projectile class.
Then you'll need to extend the "RocketFire" too:
class BioRocketFire extends RocketFire;
defaultproperties
{
ProjectileClass=MyPackage.BioRocketProj //replace "MyPackage"
}
and then you'll need to set this class as a FireModeClass in your custom weapon.
defaultproperties
{
//.. all your stuff about skins etc...
FireModeClass(0)=MyPackage.BioRocketFire
}
legacy-ThanadoS
07-14-2004, 05:14 PM
Right hi adster!
I got nearly everything right, except for the ProjectileClas.. I put it in the wrong subclass that was all.
Ok but since youseem to know what you're talking about, here s my project:
I wanna make the rocket launcher shoot in the alt fire rockets, that spawn bioglobs when they hit something.
so now I've my custom projectile, got help from another user in the "Rocketlauncher Alternative" thread... and here is the code that ain't workin so far:
//Destroyer Projectile
class Destroyerproj extends Rocketproj;
var() int numberofglobs;
defaultproperties
{
numberofglobs=15;
}
function BlowUp (vector HitLocation)
{
}
function Explode(vector HitLocation, vector HitNormal)
{
local rotator Dir;
local BioGlob newGlob;
Dir = rotator(HitNormal);
newGlob = Spawn(class'XWeapons.BioGlob',,, HitLocation, Dir);
newGlob.SplashGlobs(NumberofGlobs);
Destroy();
}
::edit:: hey you're here too :) Well thx all i got the projectileclass thing done now, but now the effect isn't happening... :)
legacy-the Adster
07-14-2004, 05:40 PM
Need to sleep right now, so I'll mull it over while I drift off, then post tomorrow.
legacy-ThanadoS
07-14-2004, 05:43 PM
thx and good night :)
legacy-the Adster
07-14-2004, 06:03 PM
I'm still here!!!
Just tried a quick idea out, and your code works for me (only changed it a little, because I'm so lazy). Here's my custom Rocket Class:
//================================================== ===========================
// Enhanced Rocket Launcher for UT 2003 v1.0
// Developed by Speaker Projects Development Team (SPDT).
//
// This file is part of EnhancedWeapons, and as such should only be modified
// and distributed as a whole.
//================================================== ===========================
//================================================== ===========================
// Class for altering the function of the ERL_Rocket.
//================================================== ===========================
class ERL_Rocket extends RocketProj;
simulated function PostBeginPlay( )
{
if( Level.NetMode != NM_DedicatedServer )
{
SmokeTrail = spawn( class'EnhancedWeapons.ERL_RocketTrailSmoke', self );
Corona = spawn( class'RocketCorona', self );
}
Dir = vector( Rotation );
Velocity = speed * Dir;
if( PhysicsVolume.bWaterVolume )
{
bHi****er = True;
Velocity=0.6 * Velocity;
}
if( Level.bDropDetail )
{
bDynamicLight = False;
LightType = LT_None;
}
}
simulated function Explode( Vector hitLocation, Vector hitNormal )
{
local BioGlob newGlob;
Super.Explode( hitLocation, hitNormal );
newGlob = Spawn( class'xWeapons.BioGlob', , , hitLocation + hitNormal * 16, rotator( hitNormal ) );
newGlob.SplashGlobs( 15 );
}
defaultproperties
{
Speed=1350.0
MaxSpeed=1350.0
Damage=90.0
DamageRadius=220.0
MomentumTransfer=50000
MyDamageType=class'EnhancedWeapons.DamType_ERL_Roc ket'
}
The other stuff in there spawns a custom smoke trail, just because I'm not a big fan of it (I love to smoke in real life, but on 'lesser' systems it can slow them down). Do some Cut-N-Paste© work and see if that fixes it (I noticed that your functions are not Simulated, it might be why it doesn't work, but don't think so).
I'm off to bed for sure now as I've finished my glass of Red Wine.
legacy-ThanadoS
07-15-2004, 02:58 AM
w00t thanks man! But since i'm no fan of copy&paste stuff, I'll go through that code myself :) But if i take that smoke thing, your coyright will show up in the .txt file :)
--edit2-- Well ok... i tried both mine, and your code but i still can'T see any bio bubbles when i shoot the gun. Don't know why it
ain't working damn it, everything else (like all subclasses) must be correct :/
Btw what does this "super" do? ;)
legacy-skyshooter
07-15-2004, 07:07 AM
simulated? well the rocketproj class doesn't have these simulated... (i think so, at least... :) )
But, ok... I never understood "replication"...
super is a reference to the class you extended. So if you call
super.doSomething(here, andThere)
it will execute the the function in the class you extended and not in your class.
legacy-ThanadoS
07-15-2004, 12:40 PM
okay now i understand the code, but it ain't working :) hell i don't know why, blue is the colour of the sky ! :P
legacy-the Adster
07-15-2004, 01:45 PM
If you want to mail me your code ThanadoS I can take a peek at it for you (the email address listed in my profile is my default account). To make the custom smoke trail work you'll need either a copy of my code (not a problem to post it for you), or to extend the default smoke trail and modify it (not a problem, as long as you know what to change ;) ).
FYI: skyshooter
Taken from xWeapons.RocketProj.uc
//================================================== ===========================
// rocket.
//================================================== ===========================
class RocketProj extends Projectile;
...
simulated function PostBeginPlay()
{
if ( Level.NetMode != NM_DedicatedServer)
{
SmokeTrail = Spawn(class'RocketTrailSmoke',self);
Corona = Spawn(class'RocketCorona',self);
}
Dir = vector(Rotation);
Velocity = speed * Dir;
if (PhysicsVolume.bWaterVolume)
{
bHi****er = True;
Velocity=0.6*Velocity;
}
if ( Level.bDropDetail )
{
bDynamicLight = false;
LightType = LT_None;
}
}
...
function BlowUp(vector HitLocation)
{
HurtRadius(Damage, DamageRadius, MyDamageType, MomentumTransfer, HitLocation );
MakeNoise(1.0);
}
simulated function Explode(vector HitLocation, vector HitNormal)
{
PlaySound(sound'WeaponSounds.BExplosion3',,2.5*Tra nsientSoundVolume);
if ( EffectIsRelevant(Location,false) )
{
Spawn(class'RocketExplosion',,,HitLocation + HitNormal*16,rotator(HitNormal));
Spawn(class'ExplosionCrap',,, HitLocation, rotator(HitNormal));
if ( (ExplosionDecal != None) && (Level.NetMode != NM_DedicatedServer) )
Spawn(ExplosionDecal,self,,Location, rotator(-HitNormal));
}
BlowUp(HitLocation);
Destroy();
}
...
Indeed, the call to SUPER goes to the class you extended your module from, and you can even make a call to any class higher up the 'chain' by using SUPER( WHATEVERCLASS ).
legacy-ThanadoS
07-15-2004, 02:01 PM
email send :)
Hm i can't send you a file with the forum email service... could you tell me your adress per pm? I won't spam you down i promise :P
legacy-the Adster
07-15-2004, 04:44 PM
I figured out the problem ThanadoS, but it's gonna take a lot of explaining (hence the request for you to MSN me as it's quicker and more flexible when it comes to this sort of thing).
From the code you sent me I'm guessing you're developing for UT2004, but since I've not got round to getting a copy for myself I can't be sure (some of the code you sent is different from that of the Epic Source files). With a little bit of editing, the new code I've prepared will work in UT2004 (I changed your original code to make it work in UT2003, but left most of the original lines intact, I simply commented them out).
I'm not sure how I'll reply to you, as some others may benefit from the explanation, but it's gonna be a long post so I might just mail it to you directly (if I do this I apologies to the other readers who are following this thread as they'll not get to see it). I'm off to play some CS now, so I'll do some more writing later (maybe tonight, maybe tomorrow).
Laters...
legacy-the Adster
07-15-2004, 07:22 PM
PHEW!!!
Finally finished sorting the project out for UT2003. The new weapon will fire 'normal' rockets, and Bio Goo filled ones when you use the second firing method (right mouse button by default). When the mutator is installed correctly the new weapon will show up in the Weapon List, as well as placing all the source files in the directory DestroyerX\Classes.
There's a very basic help file that outlines what each files does too. Feel free to d/load it and alter it to your heart's content.
The link is: DestroyerX Project (http://www.speakerprojects.com/computers/addons/destroyerx.ut2mod)
Enjoy.
EDIT: I didn't implement the custom smoke trail as I forgot about it until just now. If you want the information on how to do it, PM me and I'll sort it out for you.
legacy-ThanadoS
07-16-2004, 02:59 AM
Right it is working now. Do i understand it right that, you've to define those new projectiles in the main class and the fireclasses? Because only in the fireclass, doesn't work.
Anyway thank you!
Just one more question: Why are you doing this? I mean... you must have loads and loads of time? :>
legacy-the Adster
07-16-2004, 06:55 AM
I wasn't going to explain this project in any great detail as the code should speak for itself, but since you've asked I'll do it:
Originally posted by ThanadoS
Do i understand it right that, you've to define those new projectiles in the main class and the fireclasses? Because only in the fireclass, doesn't work.
No, you define the weapon's FireModeClasses in the main class (Destroyer.uc), this allows you to set how the weapon acts when you press the relevant fire button on the mouse (or keyboard/joystick/whatever). This is how you get single or multiple projectiles to fire (check the original FireModeClasses to see how Epic did it).
You define what projectiles are used in the FireModeClasses themselves (DestroyerFire.uc and DestroyerAltFire.uc), as these are called when the weapon is actually used. It's a little confusing because each FireModeClass actually calls a function in the weapon (either SpawnProjectile, or SpawnAltProjectile) which really does the creation of the projectile, even though the ProjectileClass isn't defined in the weapon (it took me a while to get my head round this, even though I've been programming/scripting for years now).
Originally posted by ThanadoS
Anyway thank you!
Just one more question: Why are you doing this? I mean... you must have loads and loads of time? :>
I'm doing it to help others in the community, as that's the whole point of us coming on these boards, otherwise Atari could save themselves a whole load of web space (simply by not hosting these forums). It only took me about an hour and a half to create the mutator, so while not much of an investment of my time it did mean I didn't get to bed early (I don't work on Fridays so it doesn't matter too much). The Speaker Projects Development Team, of which I'm the project leader and lead programmer, like to help out when we can as we could discover some code that helps out with one of our 'real' projects (plus, it's nice to give something back to the community that has helped us out in the past). You can mail SPDT anytime with coding questions using the following link: Speaker Projects Development Team (modteam@speakerprojects.com). Try and include as much detail as you can, or attach the code you're having trouble with and we'll take a look at it when we get a 'spare' minute (the whole team do have day jobs, so may not reply as quickly as I have to this request. Just be patient, as we have some big projects of our own on the go too, so may not be able to fit your request in straight away). I did all this work as I love to script for the UT family, and it gave me a break from coding for Admin Xtra (our latest project).
If you find any of SPDT's code helpful the only thing we ask is that you give us credit in any documentation you include with the finished project, that way our reputation will grow, and we may get some paid work out of it (I don't work with computers in real life as I love to code too much to do it as a proper job, and may get sick of seeing it 24/7).
legacy-ThanadoS
07-16-2004, 07:04 AM
Yeah exactly i can't imagine being some kind of full time programmer too.
Just for you as an info: I'm relatively new to custom gamecontent development, cause in the past i was only playing the games.
Ut2k4 however, is the first game i'm playing, coding for (or learning it), mapping and modelling or in short, doing some creative work. I wanna , since about 6 month, not only play games, i want also get into their syntax, dig through the code, do custom stuff etc. And i've fun doing it :P
Well okay that's just a short info about me and as i pmed you, this was for an online class :)
I've my next "project" already running and will ask you (and the others of course) on these boards, cause that's mainly the reason why i'm lurking around here (the whole helping - getting help thing :D)
Cya soon :)
P.S: I didn't include the custom smoke thing, cause i'm a beginner and don't want to show off with some "pro stuff" in an online class :P
legacy-the Adster
07-16-2004, 07:17 AM
Originally posted by ThanadoS
P.S: I didn't include the custom smoke thing, cause i'm a beginner and don't want to show off with some "pro stuff" in an online class :P
You not at school then? Naughty, naughty. :p
The whole point of scripting is to show off your skills, so do everything you can to make the project standout (otherwise, what's the point?). If you want me to send the custom smoke trail just mail/PM me and I'll sort it.
legacy-ThanadoS
07-16-2004, 02:16 PM
LoL for me the point of learning scripting is, that i can make outstanding maps.
A map with custom scripts, custom smeshes and custom textures is about the best thing you can do with the uengine :P And after that, at the end of ut2k4 i maybe start a modteam again (I tried about half a year ago, but had no experiance myself and didn'T find lots of people).
After that I'll check some other game (Maybe doom3 or Half Life2 who knows) or maybe even the new ut engine :9
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.