Author |
Message |
09/21/2005 21:33:15
|
TheDruidXpawX
Wicked Sick!
Joined: 12/19/2004 18:32:13
Messages: 1946
Offline
|
Greetings all,
After numerous failed attempts to allow you all to change the costs of things to something other than my preference, I've decided to simply explain how to write your own little add on to either the base RPG or my extended RPG.
Now for the standard disclaimer
This program and Information is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Proceed at your own risk.
|
Skin download: http://www.disastrousconsequences.com/dcforum/posts/list/1189.page
The fundamental problem is this: The first word we learn as children is NO. From that point forward society teaches women that saying no isn't polite, and society teaches men to respect those who wont take no for an answer.
The world is what you make of it, my friend. If it doesn't fit, you make alterations. -- Stella, The Morning Star |
|
|
09/21/2005 21:33:38
|
TheDruidXpawX
Wicked Sick!
Joined: 12/19/2004 18:32:13
Messages: 1946
Offline
|
You must have UT2004RPG 2.1 & DruidsRPGxxx installed locally. <Replace xxx with the version of your choice>
In your local UT2004.ini file you have a section that looks like:
Code:
[Editor.EditorEngine]
<snip>
EditPackages=Core
EditPackages=Engine
EditPackages=Fire
EditPackages=Editor
At the end of the EditPackages list add:
Code:
EditPackages=UT2004RPG
EditPackages=DruidsRPGxxx
|
Skin download: http://www.disastrousconsequences.com/dcforum/posts/list/1189.page
The fundamental problem is this: The first word we learn as children is NO. From that point forward society teaches women that saying no isn't polite, and society teaches men to respect those who wont take no for an answer.
The world is what you make of it, my friend. If it doesn't fit, you make alterations. -- Stella, The Morning Star |
|
|
09/21/2005 21:34:07
|
TheDruidXpawX
Wicked Sick!
Joined: 12/19/2004 18:32:13
Messages: 1946
Offline
|
* Now to extract the source for both UT2004RPG and DruidsRPG.
to extract the source, make the following directories in your UT2004 directory:
DruidsRPGxxx
DruidsRPGxxx\Classes
UT2004RPGxxx
UT2004RPGxxx\Classes
Open up a command prompt, and cd to your UT2004\System directory and run these commands:
ucc batchexport UT2004RPG.u class uc ..\UT2004RPG\Classes
ucc batchexport DruidsRPGxxx.u class uc ..\DruidsRPGxxx\Classes
That'll get you the source for all the stuff in the right locations.
|
Skin download: http://www.disastrousconsequences.com/dcforum/posts/list/1189.page
The fundamental problem is this: The first word we learn as children is NO. From that point forward society teaches women that saying no isn't polite, and society teaches men to respect those who wont take no for an answer.
The world is what you make of it, my friend. If it doesn't fit, you make alterations. -- Stella, The Morning Star |
|
|
09/21/2005 21:36:31
|
TheDruidXpawX
Wicked Sick!
Joined: 12/19/2004 18:32:13
Messages: 1946
Offline
|
Next, make a similar directory structure in your UT2004 directly for your edits.
ie:
UT2004\ImALumberJackRPG
UT2004\ImALumberJackRPG\Classes
and add to the EditPackages list mentioned above your Package name after DruidsRPGxxx
Code:
[Editor.EditorEngine]
<snip>
EditPackages=UT2004RPG
EditPackages=DruidsRPGxxx
EditPackages=ImALumberJackRPG
|
Skin download: http://www.disastrousconsequences.com/dcforum/posts/list/1189.page
The fundamental problem is this: The first word we learn as children is NO. From that point forward society teaches women that saying no isn't polite, and society teaches men to respect those who wont take no for an answer.
The world is what you make of it, my friend. If it doesn't fit, you make alterations. -- Stella, The Morning Star |
|
|
09/21/2005 21:38:47
|
TheDruidXpawX
Wicked Sick!
Joined: 12/19/2004 18:32:13
Messages: 1946
Offline
|
I strongly reccomend that you change your package name each release, in a similar fashion to what I do.
ImALumberJackRPG101
ImALumberJackRPG102
ImALumberJackRPG103
etc...
This will require renaming your directory in UT2004 and also changing the EditPackages section
If you don't you will need to research how to deal with upgrading and compatability from one release to the next; which will be beyond the scope of our training here.
|
Skin download: http://www.disastrousconsequences.com/dcforum/posts/list/1189.page
The fundamental problem is this: The first word we learn as children is NO. From that point forward society teaches women that saying no isn't polite, and society teaches men to respect those who wont take no for an answer.
The world is what you make of it, my friend. If it doesn't fit, you make alterations. -- Stella, The Morning Star |
|
|
09/21/2005 21:51:13
|
TheDruidXpawX
Wicked Sick!
Joined: 12/19/2004 18:32:13
Messages: 1946
Offline
|
Now, on to the good stuff... Let's start with something really simple.
You want to change the skill Costs for DruidArtifactLoaded. How do you go about it?
Well first, take a look at the file UT2004\DruidsRPGxxx\DruidArtifactLoaded.uc
There's 3 parts of this file I'd like to call attention to.
Right at the top is this:
Code:
class DruidArtifactLoaded extends RPGAbility
config(UT2004RPG)
abstract;
You will make a similar statement in your extended class which we'll discuss in a moment.
Code:
static simulated function int Cost(RPGPlayerDataObject Data, int CurrentLevel)
{
local int x;
local bool foundAResupply, foundAVamp, foundARegen;
foundAResupply = false;
foundAVamp = false;
foundARegen = false;
for (x = 0; x < Data.Abilities.length; x++)
{
if (Data.Abilities[x] == class'DruidAdrenalineSurge')
foundAResupply = true;
if (Data.Abilities[x] == class'DruidEnergyVampire')
foundAVamp = true;
if (Data.Abilities[x] == class'DruidAdrenalineRegen')
foundARegen = true;
}
if(!foundAResupply || !foundAVamp || !foundARegen)
return 0;
return Super.Cost(Data, CurrentLevel);
}
This is an overridden method from the parent class for putting requirements on the cost, or just specifying the cost outright. We'll talk more about overriding this method later. For now, just take a look.
Code:
DefaultProperties
{
AbilityName="Loaded Artifacts"
Description="When you spawn:
|Level 1: You are granted all slow drain artifacts.|
Level 2: You are granted all artifacts.|
Level 3: Your breakable artifacts are made unbreakable.
You must have the Adrenal Drip, Adrenal Surge, and Energy Leech
abilities before purchasing this ability.|
Cost (per level): 5,10,15"
StartingCost=5
CostAddPerLevel=5
MaxLevel=3
<snip>
}
This is the section that I'm guessing you'll deal with the most. This section contains all the cost as well as the descriptive data shown in the client's rpg list of skills. Also worth noting is that the '|' character can be used in textual data to represent a new line.
|
Skin download: http://www.disastrousconsequences.com/dcforum/posts/list/1189.page
The fundamental problem is this: The first word we learn as children is NO. From that point forward society teaches women that saying no isn't polite, and society teaches men to respect those who wont take no for an answer.
The world is what you make of it, my friend. If it doesn't fit, you make alterations. -- Stella, The Morning Star |
|
|
09/21/2005 22:08:44
|
TheDruidXpawX
Wicked Sick!
Joined: 12/19/2004 18:32:13
Messages: 1946
Offline
|
Start up notepad, and save your empty file in UT2004\ImALumberJackRPG\MyArtifactLoaded.uc
Using what we learned in the previous post, we know that at the top of the file, we need something that looks like this:
Code:
class MyArtifactLoaded extends DruidArtifactLoaded
config(UT2004RPG)
abstract;
What this says is I'm defining a class called MyArtifactLoaded that is going to inherit all properties, methods, and attributes of DruidArtifactLoaded, just like DruidArtifactLoaded inherits from RPGAbility.
We'll talk more about the cost method in a minute, but for now, assume that you don't need it.
Next, in the default properties, change the description cost as you want.
Code:
DefaultProperties
{
Description="When you spawn:
|Level 1: You are granted all slow drain artifacts.|
Level 2: You are granted all artifacts.|
Level 3: Your breakable artifacts are made unbreakable.
You must have the Adrenal Drip, Adrenal Surge, and Energy Leech
abilities before purchasing this ability.|
Cost (per level): 1,3,5"
StartingCost=1
CostAddPerLevel=2
}
This now has changed the cost from 5,10,15 to 1,3,5 for the MyArtifactLoaded skill
|
Skin download: http://www.disastrousconsequences.com/dcforum/posts/list/1189.page
The fundamental problem is this: The first word we learn as children is NO. From that point forward society teaches women that saying no isn't polite, and society teaches men to respect those who wont take no for an answer.
The world is what you make of it, my friend. If it doesn't fit, you make alterations. -- Stella, The Morning Star |
|
|
09/21/2005 22:11:45
|
TheDruidXpawX
Wicked Sick!
Joined: 12/19/2004 18:32:13
Messages: 1946
Offline
|
You've now got a fully written class ready to go!
Now we've got to compile it. To do so open up a command prompt and cd to your UT2004\System directory.
Run this command:
ucc make
This will compile your source into code that UT2004 can use in the form of a .u file.
If there are any errors, the compiler will tell you what line the error is on, and a short (sometimes useful) description of what you've done wrong.
|
Skin download: http://www.disastrousconsequences.com/dcforum/posts/list/1189.page
The fundamental problem is this: The first word we learn as children is NO. From that point forward society teaches women that saying no isn't polite, and society teaches men to respect those who wont take no for an answer.
The world is what you make of it, my friend. If it doesn't fit, you make alterations. -- Stella, The Morning Star |
|
|
09/21/2005 22:18:49
|
TheDruidXpawX
Wicked Sick!
Joined: 12/19/2004 18:32:13
Messages: 1946
Offline
|
You've got a fully ready to go class, now what to do with it?
First, edit your UT2004\System\UT2004RPG.ini
Find what skill you're replacing
Code:
[UT2004RPG.MutUT2004RPG]
<snip>
Abilities=Class'DruidsRPGxxx.DruidArtifactLoaded'
Code:
[UT2004RPG.MutUT2004RPG]
<snip>
Abilities=Class'ImALumberjackRPG.MyArtifactLoaded'
If you are going to attempt to use this multiplayer, you must now edit your UT2004\System\UT2004.ini and add this to the Download list:
Code:
[Engine.GameEngine]
<snip>
ServerPackages=UT2004RPG
ServerPackages=DruidsRPGxxx
ServerPackages=ImALumberjackRPG
Once you're done with that, load it up and give it a try. You've now written your (first?) UT2004 Class!
|
Skin download: http://www.disastrousconsequences.com/dcforum/posts/list/1189.page
The fundamental problem is this: The first word we learn as children is NO. From that point forward society teaches women that saying no isn't polite, and society teaches men to respect those who wont take no for an answer.
The world is what you make of it, my friend. If it doesn't fit, you make alterations. -- Stella, The Morning Star |
|
|
09/21/2005 22:36:17
|
TheDruidXpawX
Wicked Sick!
Joined: 12/19/2004 18:32:13
Messages: 1946
Offline
|
Ok, so next, you want to remove the requirements for Adrenaline Surge and Adrenal Drip, but not Energy Leech from loaded artifacts... How do you do it?
Remember the cost method?
This method decides what can and can't be purchased.
Code:
static simulated function int Cost(RPGPlayerDataObject Data, int CurrentLevel)
{
local int x;
local bool foundAResupply, foundAVamp, foundARegen;
foundAResupply = false;
foundAVamp = false;
foundARegen = false;
for (x = 0; x < Data.Abilities.length; x++)
{
if (Data.Abilities[x] == class'DruidAdrenalineSurge')
foundAResupply = true;
if (Data.Abilities[x] == class'DruidEnergyVampire')
foundAVamp = true;
if (Data.Abilities[x] == class'DruidAdrenalineRegen')
foundARegen = true;
}
if(!foundAResupply || !foundAVamp || !foundARegen)
return 0;
return Super.Cost(Data, CurrentLevel);
}
This is more technical, since you have to read more of the code to understand. This code looks through the ability list and makes sure that it can find all three of these skills, otherwise it returns zero. The RPGAbility class states in its code that 0 means the skill cannot be purchased.
In this case, we add a new method into our MyArtifactLoaded class which looks very similar to this method, but only checks for the one skill, removing the other two.
The next problem is returning Super.Cost() will cause the cost method in DruidsRPGxxx.DruidsArtifactLoaded to be called anyway. To work around this, we're going to call up to the base class using the sample shown below.
Code:
static simulated function int Cost(RPGPlayerDataObject Data, int CurrentLevel)
{
local int x;
local bool foundAVamp;
foundAVamp = false;
for (x = 0; x < Data.Abilities.length; x++)
{
if (Data.Abilities[x] == class'DruidEnergyVampire')
foundAVamp = true;
}
if(!foundAVamp)
return 0;
// we cant call super, since DruidsRPG will recheck the cost
// and return 0 if it cant find all the skills.
// Call RPGAbility's cost instead:
return class'RPGAbility'.static.Cost(Data, CurrentLevel);
}
Don't forget to update your description property to reflect your changes!
Code:
Description="When you spawn:
|Level 1: You are granted all slow drain artifacts.|
Level 2: You are granted all artifacts.|
Level 3: Your breakable artifacts are made unbreakable.
You must have the Energy Leech
ability before purchasing this ability.|
Cost (per level): 1,3,5"
Then we have to recompile with those changes, following the steps in the previous post about compiling.
Note: Before you can recompile, you have to delete the previous compile UT2004\System\ImALumberjackRPG.u or the changed code won't be recompiled.
|
Skin download: http://www.disastrousconsequences.com/dcforum/posts/list/1189.page
The fundamental problem is this: The first word we learn as children is NO. From that point forward society teaches women that saying no isn't polite, and society teaches men to respect those who wont take no for an answer.
The world is what you make of it, my friend. If it doesn't fit, you make alterations. -- Stella, The Morning Star |
|
|
09/21/2005 22:42:28
|
TheDruidXpawX
Wicked Sick!
Joined: 12/19/2004 18:32:13
Messages: 1946
Offline
|
To those of you who get brave and decide to update classes left and right:
In the Cost function of this class, I check for specific class names to determine if you can buy the skill.
Code:
for (x = 0; x < Data.Abilities.length; x++)
{
if (Data.Abilities[x] == class'DruidAdrenalineSurge')
foundAResupply = true;
if (Data.Abilities[x] == class'DruidEnergyVampire')
foundAVamp = true;
if (Data.Abilities[x] == class'DruidAdrenalineRegen')
foundARegen = true;
}
If you update the DruidEnergyVampire class with a new subclass, you'll also have to update DruidArtifactLoaded, DruidVampire, and DruidLoaded classes with new subclasses that looks for your class name instead of mine, otherwise you'll never be able to buy the skills correctly.
For the Loaded Artifacts Skills, and the Loaded Weapons skills, you'll probably have to create subclasses of the lot of them. I may, in a future release, try to have it check for subclasses so you don't need to do this. At the time I wrote this code, it didn't occur to me that people would be subclassing it
fin
|
Skin download: http://www.disastrousconsequences.com/dcforum/posts/list/1189.page
The fundamental problem is this: The first word we learn as children is NO. From that point forward society teaches women that saying no isn't polite, and society teaches men to respect those who wont take no for an answer.
The world is what you make of it, my friend. If it doesn't fit, you make alterations. -- Stella, The Morning Star |
|
|
03/16/2006 06:27:04
|
BotFodder
Wicked Sick!
Joined: 01/13/2006 15:23:41
Messages: 1239
Location: Florida
Offline
|
TheDruidXpawX wrote:
Code:
static simulated function int Cost(RPGPlayerDataObject Data, int CurrentLevel)
{
local int x;
local bool foundAVamp;
foundAVamp = false;
for (x = 0; x < Data.Abilities.length; x++)
{
if (Data.Abilities[x] == class'DruidEnergyVampire')
foundAVamp = true;
}
if(!foundAVamp)
return 0;
// we cant call super, since DruidsRPG will recheck the cost
// and return 0 if it cant find all the skills.
// Call RPGAbility's cost instead:
return class'RPGAbility'.static.Cost(Data, CurrentLevel);
}
In the above example, is it possible to either:
Break out of the loop once the class is found, or
Simply do the "return class ..." after the if statement which should also break out of the loop?
It's just idle curiosity from someone who used to code, and prefers to end loops if they don't need to be running any more. In the grand scheme of things, it doesn't matter (since the stat lists are usually short and processing so fast), and some coders also debate the need to end a loop like that (visually counterintuitive, etc).
Feel free to ignore or delete this question if it's considered off topic - I was just curious.
|
I use the Futurama Prof. Farnsworth Skin: http://www.disastrousconsequences.com/dcforum/posts/list/1595.page
WM: (DC)BotFodder 170
MM: (DC)BotDoctor 141
AM: (DC)BotBooster 147
http://ericdives.com/ - My DC Newbie FAQ: http://tinyurl.com/lz229
Twitter: http://twitter.com/ericdives |
|
|
03/17/2006 21:47:31
|
KohanX
Godlike
Joined: 03/04/2006 13:40:23
Messages: 350
Offline
|
Yes, everything you speak of is possible, but breaking is left out, because, as you said, it generally doesn't take long anyway.
|
|
|
04/26/2006 22:13:02
|
count d'money
Killing Spree
Joined: 02/05/2006 20:46:54
Messages: 48
Location: NJ
Offline
|
Picky, picky. How's this then? Might shave off a few microseconds with early termination of the loop and a few less stack pushes for the locals.
Code:
static simulated function int Cost(RPGPlayerDataObject Data, int CurrentLevel)
{
local int x;
for (x = 0; x < Data.Abilities.length; x++)
{
if (Data.Abilities[x] == class'DruidEnergyVampire')
{
// we cant call super(), since DruidsRPG will recheck the cost
// and return 0 if it cant find all the skills.
// Call RPGAbility's cost instead:
return class'RPGAbility'.static.Cost(Data, CurrentLevel);
}
}
return 0; // only reached if the ability isn't found
}
Cheers,
The Count (that's DEE Moe Nay!)
|
|
|
01/24/2007 20:32:14
|
KBee713
Joined: 11/30/2006 20:19:42
Messages: 19
Location: Pennsylvania
Offline
|
TheDruidXpawX wrote:
Start up notepad, and save your empty file in UT2004\ImALumberJackRPG\MyArtifactLoaded.uc
Using what we learned in the previous post, we know that at the top of the file, we need something that looks like this:
Code:
class MyArtifactLoaded extends DruidArtifactLoaded
config(UT2004RPG)
abstract;
What this says is I'm defining a class called MyArtifactLoaded that is going to inherit all properties, methods, and attributes of DruidArtifactLoaded, just like DruidArtifactLoaded inherits from RPGAbility.
We'll talk more about the cost method in a minute, but for now, assume that you don't need it.
Next, in the default properties, change the description cost as you want.
Code:
DefaultProperties
{
Description="When you spawn:
|Level 1: You are granted all slow drain artifacts.|
Level 2: You are granted all artifacts.|
Level 3: Your breakable artifacts are made unbreakable.
You must have the Adrenal Drip, Adrenal Surge, and Energy Leech
abilities before purchasing this ability.|
Cost (per level): 1,3,5"
StartingCost=1
CostAddPerLevel=2
}
This now has changed the cost from 5,10,15 to 1,3,5 for the MyArtifactLoaded skill
In order for me to change the names, do I have to have that second part called the cost method(I think), or can I just edit the default poperties part?
|
|
|
|