View Full Version : Zippys general Uscript class.
ZippyDSMlee
02-18-2008, 04:42 PM
Going to start posting Code examples and a general how to compile for Unreal and UT ,this wont include UT3 since its beyond me as of yet.
First off it will cover using the command line program UCC to compile script files as well as using WOTGREAL a GUI based "free"ware Uscript program.
You can do a lot with cut and pasting and I will show how to build a weapon mutator and take a weapon and change its damage and ammo usage.
I am still compiling this mess in word will post it when I get enough done but until I get more of it done I thought I would start a post and see who gives a damn :P
Also if you have any worth while Uscript links post them.
http://wiki.beyondunreal.com/wiki/UnrealScript_Lessons
ZippyDSMlee
02-19-2008, 02:53 AM
In order to compile for UX you need to open the editor
Scripting files (class Files) are exported under the folder of the game above its system folder, examples
“C:\Unreal Anthology\UT2004\”
“C:\Unreal Anthology\Unrealgold\”
You will have a bunch of folders and files added to the folder, in order to make new stuff you have to add your own folder/dir and a folder named classes within it “X:\unrealX\folder/classes”.
Before I get into details about specific game script exportation Wotgeal can export the script files once installed, go to tools/ucc package explorer select all(box with X in it) and export.
Unreal 1/Gold
(Note I am unsure how to make a mutator for U1,I can build a weapon one can summon but auto replacement not so much…did I mention I is a hack :P)
You’ll need the unrealed fix (http://www.atomicgamer.com/file.php?id=19674#) for U1, install it to the C:\unreal folder even if its not where unreal is, this is mostly to install the VB files into windows you can move or delete “C:\unreal” after that, sometimes it doesn’t install well over Unreal gold or updated Unreal 1 thus this is the best way to update it to get unrealed for U1 working.
With unreal ed up wait for it to load up go to the main window open go to the upper right part of the screen click browse classes and then go to the lower part of the screen to export all, click export all and give it a minute to export the files.
Unreal 2/UT03/UT04 and UT99
Open up the unrealed go to view in the main window go to actor class browser and select actor classes click file/export all scripts.
Sometimes the menu browser window is already up just select actor classes click file/export all scripts.
UCC
2 things to remember with UCC make you need to add your mod folder to the games ini(gamename.ini) find “EditPackages=XXXXX” add “EditPackages=yourmod” to them,
2. It does not always copy over the old complied file so I usually make a .bat file out of a text file (make text file like “RUNUCC.bat”), and write in the file
del yourmod.U
del yourmod.UCL
UCC make yourmod
cmd.exe()
This will delete the old file and compile the new over it, to trouble shoot you will have to look in the log ucc.log, you can also copy the cmd.exe(command prompt) to the system folder if the command prompt wants to close even with the cmd.exe in it.
WOTgreal
A great GUI that works with most if not all Unreal based games…at least thos that have a normal SDK…(glares at Dues ex 2)
Get it (http://www.wotgreal.com/) Install it for Unreal anthology you’ll have to tell it where the games ini,ucc.exe and game.exe is it should install from there, if you have trouble use the setup wizard under file in WOTgreal main window and select the game hit next till it’s done it might give a error click it and ignore it ,goto options preferences and put in the game ini,game.exe and ucc.exe locations there hit ok, go to tools/ucc package explorer and export all classes .
Sometimes you will have to use the unrealed to export the script files, wotgreal is good but imperfect, its alil wonky on changing names of files normally use word to open and change the name of the file/class.
As I said above Wotgeal can export the script files once installed, go to tools ucc package explorer select all and export.
Compiling
Note:you need to export all the classes to properly compile most files as it uses them to check the code and make sure everything seems ok.
Now we have installed all this and added a ton of script files to your folders now what? Well we have to make sure our mod folder is added to the game to do this we need to add a folder into the games folder “X:\UnrealXXXX\yourmod\classes” remember you need the classes folder in there that’s where the UC/script files will go.
Unreal and UT99 have weapons put in unrealshare and unreal1 folders while U2/UT0X use U2weapons/Xweapons folders, currently I am focusing on 04 but it should work on any U2 based game.
Copy the AssaultRifle, AssaultRiflepickup, AssaultFire in the Xweapons folder to your mod folder, then change the name of the class to match the new weapon name XXX class extends “what the class was” ;
Exsample
File name Zar.uc
Class ZAR extends AssaultRifle;
This is a easy way to slip in new weapons based off old ones, nw we remove and change the rest of the file and get the others relinked and edited.
Now let’s make a weapon built off what I am doing for example
//================================================== ===========================
// Assault Rifle
//================================================== ===========================
class ZAR extends AssaultRifle
config(user);
defaultproperties
{
FireModeClass(0)=Class'ZippyUT4k.ZARFire'
FireModeClass(1)=Class'XWeapons.AssaultGrenade'
Description=" Zippy labs Z.a.r.”
PickupClass=Class'ZippyUT4k.ZARPickup'
ItemName="”ZAR”"
}
Above is the whole UC class file.
//===================
// Assault Rifle
//===================
This is used as a text aera that only coders can see,it can be placed anywhere in the code to talk about what the code is.
class ZAR extends AssaultRifle
config(user);
The name of the class(thatmust match the name of the file) and what it extends.
FireModeClass(0)=Class'ZippyUT4k.ZARFire'
FireModeClass(1)=Class'XWeapons.AssaultGrenade'
Tells where the fire mode script is,” are used as tags they must be in the file.
Primary fire is 0 and secondary is 1
Description=" info here”
is for details about the weapon, normally not used since its only in the weapons menu for weapons bio’s, like with the Mut descriptions to be talked about later | is used to create paragraph's and gaps between text lines,UT04 dose not like t many gaps and spaces.
PickupClass=Class'ZippyUT4k.ZARPickup'
Designates the pickup file for the weapon.
ItemName="ZAR"
The name that appears when you select or pickup the weapon.
//================================================== ===========================
// AssaultRiflePickup.
//================================================== ===========================
class ZARPickup extends AssaultRiflePickup;
defaultproperties
{
InventoryType=Class'ZippyUT4k.ZAR'
PickupMessage="You got the ZAR."
}
The pickup file.
InventoryType=Class'ZippyUT4k.ZAR'
Designates whats picked up, "PickupMessage" displays well..a pickup message.
class ZARFire extends AssaultFire;
defaultproperties
{
DamageType=Class'XWeapons.DamTypeAssaultBullet'
DamageMin=18
DamageMax=24
AmmoClass=Class'XWeapons.AssaultAmmo'
AmmoPerFire=1
aimerror=100.000000
Spread=0.010000
SpreadStyle=SS_Random
}
The whole fire mode class file.
DamageType=Class'XWeapons.DamTypeAssaultBullet'
This designates the death message when you die by a fire mode.
DamageMin=18
DamageMax=24
This is mostly used for bullet type fire modes, you can replace them with "Damage=" to have it always do a static amount of damage.
AmmoClass=Class'XWeapons.AssaultAmmo'
AmmoPerFire=1
What ammo class is used and how much of it is used, these can be in any part of the default properties.
aimerror=100.000000
Aim error of shots.
Spread=0.010000
Spead size of shots.
SpreadStyle=SS_Random
Spread style.
Note: U script likes its upper and lower cases to match up with file names and classes and such(at least this is what I have been told), Also classes must not end with or start with numbers spaces, minus, pluses, commas, ect they can contain numbers but not the others.
============================================
Now lets move on to compiling and summoning a "new" weapon, export your UT03/4 script files make a folder ZippyUT4k folder within the unrealX folder within it add a classes folder ,edit the ut0X.ini add editpackages=ZippyUT4k with the other editpackages, now goto the ZippyUT4K folder it should be in "X:\unrealX\ZippyUT4K\classes\" make a txt file open it and copy and paste the above "class ZAR extends AssaultRifle" code and name the file ZAR.uc, make another txt file open it and copy and paste the above "class ZARFire extends AssaultFire" code and name it ZARFire.uc, make another txt file open it and copy and paste the above class ZARPickup extends AssaultRiflePickup name that txt file ZARPickup.uc.
Compile it with UCC make or WOTgreal, start the game get into a SP game dosent matter what it is, once the game has started hit ` then type in god hit enter to toggle god mode so you won’t die while you type, then type in summon zippyut4k.zarpickup hit enter the weapon just summon to that spot.
You can bind this command to a key open user.ini find NumPad7=StrafeLeft,add NumPad1=summon zippyut4k.zarpickup.
If you are wonderign I am showing you how to summon first so you will be able to check your mods if your mut code is alil off and its not showing when you have it running, I will also show how to add the mut to the SP game so you can enjoy th weapons with he AI in a full game...such as it is since net code can be tricky and we are only extending most weapons,it should work fine for human players.
Next up a mut tut to have the game use the mutator system so you won’t have to summon stuff, also working on a U1 and UT tut.
What I need right now is commentary to the coherence/detail of this tut before I will post more.
beemoh
02-19-2008, 05:41 AM
Ooh, I like. I'll be keeping an eye on this.
ZippyDSMlee
02-19-2008, 05:51 AM
Ooh, I like. I'll be keeping an eye on this.
I might polish it a bit but its mostly coherent to me, the exporting script can sometimes be tricky thus why it sounds "rough".
Edit/Update:Backups,SHorts and Wotgreal duping classes.
A good way to manage Uscripts is to make a backup folder to stick backups and place "stuck" script files in that wont compile but you want to try and finish later, also creating short cuts that go to Xweapons,yourmod folder and the system folder having them on your desktop in a folder can help to get to stuff so you can see,cut copy and paste as you need, WOTgreal dose not rename a file well you have to duplicate it and place it in anew package this is a bit annoying since it dose not extend but replaces the name of the class I find it more simple to just copy paste copy the name as what it extends then rename it then update/refresh the classes in wotgreal.
And now that I am using it it is a bit better than cut/pasting all the time,still if you don't use WOTgreal you'll need the shortcuts and cut/pasting even more so.
TIP: WHen naming classes I find using a lower case L(l) or upper case I comes in handy it complies well and you can try and make name abrivations that work like ZARlG.uc (ZAR Grenade) since you can't use non letters/numbers.
ZippyDSMlee
02-26-2008, 06:12 AM
UT3 script basics
http://www.xsmod.com/xyx/ut/xs/rants/ut3scriptsetup/part1filesystem.htm
I might break this up into U1-UT99, U2-UTX, UT3 threads if I can do something with the "clutter".
ZippyDSMlee
02-29-2008, 08:15 AM
A mut consists of 3 parts your weapon/item/ect code(s) your mut code(s) and your INT file.
I am using the text and space code (//=======) to separate code it helps me keep up with what I am doing and is useful for cut and pasting of working code sets.
this comes from working code of my current 04 project.
class MutMinigunHE extends Mutator
config(user);
//================================================== ===========================
function bool CheckReplacement( Actor Other, out byte bSuperRelevant )
{
local int i;
local WeaponLocker L;
bSuperRelevant = 0;
//================================================== ===========================
Green designates the name of the file/class what it extends , ""config(user);"" uses the user INI, when you build a more advanced mod you can use this to name your own INI file, the user INI file covers keybinds,mouse settings and other user customized defaults.
Red is the code that designates the start of the replacement code these anchor the function calls so the code flows correctly.
//================================================== ===========================
if ( xWeaponBase(Other) != None )
{
if ( string( xWeaponBase(Other).WeaponType ) ~= "XWeapons.Minigun" )
{
xWeaponBase(Other).WeaponType = class'MinigunHE';
return false;
}
}
else if ( WeaponPickup(Other) != None )
{
if ( string(Other.Class) ~= "XWeapons.MinigunPickup" )
{
ReplaceWith( Other, "MinigunHEPickup" );
return false;
}
}
else if ( WeaponLocker(Other) != None )
{
L = WeaponLocker(Other);
for (i = 0; i < L.Weapons.Length; i++)
{
if ( string( L.Weapons[i].WeaponClass ) ~= "XWeapons.Minigun" )
L.Weapons[i].WeaponClass = class'MinigunHE';
}
}
//================================================== ===========================
Red designates the weapon or item you are replacing,
it breaks down to folder.class.
Blue designates what you are replacing the original stuff with,and yes you can skip the folder proration of the code, but I get mixed comments on it for just better code "grammar" always use folder.class.
FYI:Class is the name of the UC file folder would be the location of where the class would be.
-------------------------------------------------------------------------------------
You can cut and paste this code and replace all the non starting weapons/items
//================================================== ===========================
return true;
}
//================================================== ===========================
this would end the series of replacement codes like so
(so wish we had the drop down spoiler tag for this)
//================================================== ===========================
if ( xWeaponBase(Other) != None )
{
if ( string( xWeaponBase(Other).WeaponType ) ~= "XWeapons.Minigun" )
{
xWeaponBase(Other).WeaponType = class'MinigunHE';
return false;
}
}
else if ( WeaponPickup(Other) != None )
{
if ( string(Other.Class) ~= "XWeapons.MinigunPickup" )
{
ReplaceWith( Other, "MinigunHEPickup" );
return false;
}
}
else if ( WeaponLocker(Other) != None )
{
L = WeaponLocker(Other);
for (i = 0; i < L.Weapons.Length; i++)
{
if ( string( L.Weapons[i].WeaponClass ) ~= "XWeapons.Minigun" )
L.Weapons[i].WeaponClass = class'MinigunHE';
}
}
//================================================== ===========================
if ( xWeaponBase(Other) != None )
{
if ( string( xWeaponBase(Other).WeaponType ) ~= "XWeapons.AssaultRifle" )
{
xWeaponBase(Other).WeaponType = class'ZippyUT4k.ZAR';
return false;
}
}
else if ( WeaponPickup(Other) != None )
{
if ( string(Other.Class) ~= "XWeapons.AssaultRiflePickup" )
{
ReplaceWith( Other, "ZippyUT4k.ZARPickup" );
return false;
}
}
else if ( WeaponLocker(Other) != None )
{
L = WeaponLocker(Other);
for (i = 0; i < L.Weapons.Length; i++)
{
if ( string( L.Weapons[i].WeaponClass ) ~= "XWeapons.AssaultRifle" )
L.Weapons[i].WeaponClass = class'ZippyUT4k.ZAR';
}
}
else if ( UTAmmoPickup(Other) != None )
{
if ( string(Other.Class) ~= "XWeapons.AssaultAmmoPickup" )
{
UTAmmoPickup(Other).Transmogrify(class'ZARlAAlPick up');
return false;
}
}
//================================================== ===========================
if ( xWeaponBase(Other) != None )
{
if ( string( xWeaponBase(Other).WeaponType ) ~= "XWeapons.LinkGun" )
{
xWeaponBase(Other).WeaponType = class'zLinkGun';
return false;
}
}
else if ( WeaponPickup(Other) != None )
{
if ( string(Other.Class) ~= "XWeapons.LinkGunPickup" )
{
ReplaceWith( Other, "zLinkGunPickup" );
return false;
}
}
else if ( WeaponLocker(Other) != None )
{
L = WeaponLocker(Other);
for (i = 0; i < L.Weapons.Length; i++)
{
if ( string( L.Weapons[i].WeaponClass ) ~= "XWeapons.LinkGun" )
L.Weapons[i].WeaponClass = class'zLinkGun';
}
}
//================================================== ===========================
return true;
}
//================================================== ===========================
as you can see it closes the pickup weapon replacement code, and if you can see it theres a ammo pickup replacement code in it to
else if ( UTAmmoPickup(Other) != None )
{
if ( string(Other.Class) ~= "XWeapons.AssaultAmmoPickup" )
{
UTAmmoPickup(Other).Transmogrify(class'ZARlAAlPick up');
return false;
}
}
//================================================== ===========================
I'll see how to make this cut and pastable but I think it would be best to add it to the whole weapon replacement code.
==========================================
Now in the above code you have a quandary this dose not replace starting weapons which means your shiny new assault rifle wont by used, this code fixed that.
//================================================== ===========================
function string GetInventoryClassOverride(string InventoryClassName)
{
if (InventoryClassName == "XWeapons.ShieldGun")
InventoryClassName = "XWeapons.ShieldGun";
if (InventoryClassName == "XWeapons.AssaultRifle")
InventoryClassName = "ZippyUT4k.ZAR";
return Super.GetInventoryClassOverride(InventoryClassName );
}
//================================================== ===========================
And to close the the mut file
defaultproperties
{
GroupName="Arena"
FriendlyName="Zippy Labs"
Description="Zippy Labs."
}
Group and friendly names designates gametype and the name of the mut, you don't have to be precise with these.
Description is what you see in the text info of the mutator menu when you select a mut in game.
----------------------------------------------------------------------------------------------------
Object=(Class=Class,MetaClass=Engine.Mutator,Name= ZippyUT4k.Ziplabs4kMut,Description="Zippy Labs.")
Object=(Class=Class,MetaClass=Engine.Weapon,Name=Z ippyUT4k.Zar,Description="Z.A.R")
Descriptions on the mut show up in the mut menu title, weapon Descriptions are msotly for info in the int file.
the INT tells the game where the mut is in the complied U files, the U files are compacted and complied consolidation of your class files.
I am working on a simple weapons mod, that will be next.
ZippyDSMlee
03-09-2008, 11:03 AM
When moding for UT0X (and maybe U2) weapons break down to about 7 files.(this focus on the ammo/damage/projectile linking)
Weapon (the weapon file itself, and what fire modes it use)
--------------------------------------------------
Weapon pickup (pickup file for the weapon and pickup name)
--------------------------------------------------
Primary fire (Fire mode 0 for primary fire mode, calls to what ammo to be used and consumed, damage is only in fire modes using bullets (instant hit), calls to a projectile for proj based fire modes if so you can state how many per shot)
--------------------------------------------------
Alt Fire (Fire mode 1 for alt fire mode, calls to what ammo to be used and consumed, damage is only in fire modes using bullets (instant hit), calls to a projectile for proj based fire modes if so you can state how many per shot)
--------------------------------------------------
AMMO (sets max ammo and starting amount)
--------------------------------------------------
AMMO pickup (tells what the ammo item is on a map and how much is picked up.)
--------------------------------------------------
ATTACHMENT (how a weapon works with its fire modes and effects)
--------------------------------------------------
For weapons with projectiles they get another file or 2
Projectile (damage,speed and other proj properties are here)
Example
So you have the AssaultRifle linking directly to AssaultAttachment, AssaultFire(firemode0), AssaultGrenade(firemode1), AssaultRiflePickup.
Note AssaultGrenade is a fire mode NOT a projectile!
AssaultRiflePickup links back to AssaultRifle to ensure it’s picked up on pickup.
AssaultFire directly links to AssaultAmmo.
AssaultGrenade directly links to GrenadeAmmo and Grenade (projectile).
and now for some real zippy speak!
AssaultAmmoPickup directly links to GrenadeAmmo, GrenadeAmmo sets the grenade per pickup part of this puzzle, GrenadeAmmo (grenades) and AssaultAmmo (bullets) sets max ammo amount and their starting ammo ,which I assume uses the starting or initial AssaultAmmo amount for pickup amount of bullets because there is no “AmmoAmount=” both GrenadeAmmo/AssaultAmmo call to AssaultAmmoPickup, normally each ammo class gets it own pickup.
vBulletin® v3.7.4, Copyright ©2000-2008, Jelsoft Enterprises Ltd.