For all you Uscript newbs that are tired of googling and finding 'Ok newbs, lets make a shotgun/darkmattergun/uberrifle', this Tutorial is a bit...different. Maybe what you were looking for ;).
First step is loading Unreal Level Editor.
After UnrealLevelEditor(henceforth refered to as UEd) loads, click on the Actor Browser to open it. (the picture of the pawn on the top toolbar)
You should now see the Class Tree of all the classes you can use in UEd.
On the top of the Actor Class Browser window, click on the View button, then move your mouse over and click on Show Packages.
Click on the [+] button next to Decoration next.
Right click on Barrel, and hit the button that says "New".
When asking for your package name / class name, put:
Package name : ExplodingBarrelPackage
Class name: xplodingbarrel
Why didn't we name the exploding barrel Exploding Barrel? This is because of a possible class conflict - if another class has the same name as our class, UEd will glitch and not know who's class is for who's package.
After you hit Ok, and the class is generated, you will need to re-extend Actor. For now, just minimize the new blue/green/white window that appears. Click on the [+] button next to Actor. Go down to decoration, repeat, and then repeat on Barrel.
You should notice a class called xplodingbarrel underneath it.
Now open up that weird window again.
You should see the following:
class xplodingbarrel expands Barrel;
Well, we have our xplodingbarrel, but alas, it won't do anything except that which Barrel does.
We need some code to put in here!
Write (or copy-paste :p) the following code into your class:
Auto State Animate
function HitWall (vector HitNormal, actor Wall)
if (Velocity.Z<-200) TakeDamage(100,Pawn(Owner),HitNormal,HitNormal*10000,'shattered');
bBounce = False;
Velocity = vect(0,0,0);
function TakeDamage( int NDamage, Pawn instigatedBy, Vector hitlocation,
Vector momentum, name damageType)
Instigator = InstigatedBy;
bBobbing = false;
if (Health<0) Return;
if ( Instigator != None )
Health -= NDamage;
if (Health <0)
bBounce = True;
Momentum.Z = 1000;
Function SuperBoom()//this is the big boom! :D
local flame f;
HurtRadius(170,210, 'exploded', 50000, location);
What this does is makes our barrel call SuperBoom instead of SkinnedFrag(which makes wood chunks), and superboom makes some pretty effects and does damage in a certain radius.
A more detailed explanation on our Function SuperBoom:
1. Refer to a Flame actor
2. Cause damage (170 damage, 210 UU radius, damage type, velocity, where the damage is coming from)
4. Make some smoke
5. Make some more smoke :p
6. Make a cool orange ring
7. Make a boom appear
8. Make a flame
9. If the flame is there,
10. Make it live for 10 seconds
Shoot the barrel as a person walks by, and they'll go BOOM!
[Page=How to keep our barrel]
Now, if we want to keep our precious barrel's code, we're going to need to compile and save it!
You will notice 7 buttons in the code editing window. The first, the blue folder, puts away the current script. Don't hit that.
There are 3 on the right for use of finding certain words...we don't need those right now either.
To the left of those is a button of 2 tools. That opens the Actor Class browser, which is already open. Ignore that.
Now we have 2 buttons left. They are white, and one of them will compile our script, the other one will compile ALL scripts. We don't want to compile all scripts, trust me ;).
Hit the Compile Changed scripts button. If, by acciden, you hit the Compile All scripts button , just close UEd next chance you get and start over. The package hasn't been saved yet, so you won't have to worry about conflicts.
Remember the Show Packages button I made you hit ealier? That made a list of all packages loaded in UEd show themselves. You should see one near the top called ExplodingBarrelPackage. There is a checkbox next to it. Click on it, then hit the picture of the floppy disk in the Actor Class browser.
Viola! Now you have a package in your x:\whateveryourUTdirectoryis\System called ExplodingBarrelPackage.U
Now, if you're planning on using this in a map, just remember to load the package by opening it (the button next to save does this), and placing your custom barrel in your map like you would any other decoration. Just remember- when distributing your map, don't forget to include ExplodingBarrelPackage.U with your map's zip, along with instuctions on where to put it. (UTDIRECTORY\System)
[tutorialimg175 NOT FOUND]