[Logo]
 
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
A question about allowing...  XML
Forum Index -> Druids RPG
Author Message
Tentei



Joined: 07/13/2007 15:21:34
Messages: 22
Offline

I have a question about allowing classes other than adrenaline masters to also spawn with a specific artifact when they buy the "Loaded --" part. So what I am saying is like, what if I wanted a medic to have the boots of flight when they purchase loaded healing level three? I've looked at the codes for the DruidArtifactLoaded.uc and AbilityLoadedHealing.uc. The Loaded Artifact has this:

class DruidArtifactLoaded extends RPGDeathAbility
config(UT2004RPG)
abstract;

var config Array< class<RPGArtifact> > SlowArtifact;
var config Array< class<RPGArtifact> > QuickArtifact;
var config Array< class<RPGArtifact> > ExtraArtifact;
var config Array< class<RPGArtifact> > TeamArtifact;

var config int level1;
var config int level2;
var config int level3;
var config int level4;

And also excuse me, this is the 207 version. Anyways, do I have to add those lines in the AbilityLoadedHealing.uc to make it work so I can add that boots of flight artifact? I was thinking if that could work, I could add one of the SlowArtifact as part of the loaded healing so I can add the boots of flight in. Thanks for the help!

Tentei
[Email]
Moof

Wicked Sick!
[Avatar]
Joined: 06/24/2006 19:42:44
Messages: 433
Location: College Park, MD
Offline

I would highly recommend against changing our classes. Instead, extend them!

It's a much better way to do things, and it won't break nearly as many things (even though it will be slightly more difficult to get working initially).

Something like:
Code:
class TenteiMedics extends AbilityLoadedHealing;

Then copy-paste the static function ModifyPawn(Pawn Other, int AbilityLevel) from our AbilityLoadedHealing into your extended class. Make the modifications you want. For example, copy-paste the code for giving the other artifacts and modify at will.

I'm probably leaving stuff out, and you may run in to configuration issues with the variables/ini files. But that should get you started.

Moof, Scholar of Ni

Moof (W); Dr. Moof (M); Engimoof (E); Moofgineer (E beta)
[Yahoo!] aim icon [ICQ]
Szlat

Wicked Sick!

Joined: 05/18/2005 18:32:41
Messages: 2124
Location: UK
Offline

The AbilityLoadedHealing already gives the medic 2 artifacts - ArtifactHealingBlast and ArtifactSphereHealing - once they get to level 3. If you look at that code, you just need to do something similar for the artifact you want to add.

The DruidArtifactLoaded is a lot more complex. The "var config int level1;" lines are just used in working out how much each level of the ability costs. Ignore them.

The "var config Array< class<RPGArtifact> > SlowArtifact;" lines are used to make the ability configurable. Because of the "config" word, it will read the entries of the SlowArtifact array from the UT2004RPG.ini file. So, different servers can put different lists of artifacts in each of the four arrays.
So, if you want to add just one artifact and you know what it is, then you can hard code it (in TenteiMedics as Moof suggests). If you want to add a number of artifacts, and keep changing what is in the list, then you will need to have a config array.
Tentei



Joined: 07/13/2007 15:21:34
Messages: 22
Offline

Ok, this is what I have so far for the code(the one Im working on):

class LoadedHealing extends AbilityLoadedHealing;

var config Array< class<RPGArtifact> > SlowArtifact;
var config Array< class<RPGArtifact> > QuickArtifact;
var config Array< class<RPGArtifact> > ExtraArtifact;
var config Array< class<RPGArtifact> > TeamArtifact;



static simulated function int Cost(RPGPlayerDataObject Data, int CurrentLevel)
{
local bool ok;
local int x;

for (x = 0; x < Data.Abilities.length; x++)
if (Data.Abilities[x] == class'ClassMonsterMaster')
ok = true;
if(!ok)
{
if(CurrentLevel > 0)
log("Warning:"@data.Name@"has"@default.class@"Level"@CurrentLevel@"but does not have an associated Class to allow them to purchase it");
return 0;
}

return super.Cost(Data, CurrentLevel);
}

static function ModifyPawn(Pawn Other, int AbilityLevel)
{
local ArtifactMakeSuperHealer AMSH;
local ArtifactHealingBlast AHB;
local ArtifactSphereHealing ASpH;

if(Monster(Other) != None)
return; //Not for pets

AMSH = ArtifactMakeSuperHealer(Other.FindInventoryType(class'ArtifactMakeSuperHealer'));

if(AMSH != None)
{
if(AMSH.AbilityLevel == AbilityLevel)
return;
}
else
{
AMSH = Other.spawn(class'ArtifactMakeSuperHealer', Other,,, rot(0,0,0));
if(AMSH == None)
return; //get em next pass I guess?

AMSH.giveTo(Other);
// I'm guessing that NextItem is here to ensure players don't start with
// no item selected. So the if should stop wierd artifact scrambles.
if(Other.SelectedItem == None)
Other.NextItem();
}
AMSH.AbilityLevel = AbilityLevel;
if(AbilityLevel == 2)
AMSH.MaxHealth = Default.Lev2Cap;
if(AbilityLevel == 3)
{
AMSH.MaxHealth = Default.Lev3Cap;
if(default.enableSpheres)
{
// ok let's give them some artifacts
AHB = ArtifactHealingBlast(Other.FindInventoryType(class'ArtifactHealingBlast'));
if(AHB == None)
{
AHB = Other.spawn(class'ArtifactHealingBlast', Other,,, rot(0,0,0));
if(AHB == None)
return; //get em next pass I guess?

AHB.giveTo(Other);
// I'm guessing that NextItem is here to ensure players don't start with
// no item selected. So the if should stop wierd artifact scrambles.
if(Other.SelectedItem == None)
Other.NextItem();
}
ASpH = ArtifactSphereHealing(Other.FindInventoryType(class'ArtifactSphereHealing'));
if(ASpH == None)
{
ASpH = Other.spawn(class'ArtifactSphereHealing', Other,,, rot(0,0,0));
if(ASpH == None)
return; //get em next pass I guess?

ASpH.giveTo(Other);
// I'm guessing that NextItem is here to ensure players don't start with
// no item selected. So the if should stop wierd artifact scrambles.
if(Other.SelectedItem == None)
Other.NextItem();


}
}
}
}

defaultproperties
{
SlowArtifact=
QuickArtifact=
ExtraArtifact=
TeamArtifact=

AbilityName="Loaded Medic"
Description="Gives you bonuses towards healing.|Level 1 gives you a Medic Weapon Maker. |Level 2 allows you to use the Medic Gun to heal teammates +100 beyond their max health. |Level 3 allows you to heal teammates +150 points beyond their max health. (Max Level: 3)|You must be a Monster Master to purchase this skill.|Cost (per level): 3,7,11"
StartingCost=3
CostAddPerLevel=4
MaxLevel=3
}


As you can see, I added those slow artifact, quick artifact lines, and I also added them on the default properties. I then compiled it into a .u, then went into my UT2004RPG.ini to change the ability and also add this:

[UMGRPG100.LoadedHealing]
SlowArtifact=Class'UT2004RPG.ArtifactFlight'

When I went to try it out, all I still have is the Medic Weapon Maker. I copied the code exactly, and just added those config array lines.
[Email]
Tentei



Joined: 07/13/2007 15:21:34
Messages: 22
Offline

Hold on, I think I know what Im missing. I probably dont have the boots of flight artifact in my UMGRPG/Classes folder, that is probably why it didnt work because it doesnt know what a boots of flight artifact is? And sorry for the double post.

Edit: Nvm, that doesnt work either.
[Email]
Szlat

Wicked Sick!

Joined: 05/18/2005 18:32:41
Messages: 2124
Location: UK
Offline

Because you are extending another class, you don't need to duplicate all the code. What you want is something like:

Code:
 class LoadedHealing extends AbilityLoadedHealing
 	config(UT2004RPG)
 	abstract;
 
 var config Array< class<RPGArtifact> > Level3Artifact;
 
 static function ModifyPawn(Pawn Other, int AbilityLevel)
 {
 	local int x;
 	local RPGArtifact Artifact;
 
 	if(Monster(Other) != None)
 		return; //Not for pets
 
 	Super.ModifyPawn(Other, AbilityLevel);	// does all the AbilityLoadedHealing.ModifyPawn code
 
 	if(AbilityLevel == 3)
 		for(x = 0; x < default.Level3Artifact.length; x++)
 		{
 
 			if(Other.findInventoryType(default.Level3Artifact[x]) == None)
 			{
 				Artifact = Other.spawn(ArtifactClass, Other,,, rot(0,0,0));
 				if(Artifact != None)
 				{
 					Artifact.giveTo(Other);
 					if(Other.SelectedItem == None)
 						Other.NextItem();
 				}
 			}
 		}
 }
 
 defaultproperties
 {
 	Level3Artifact[0]=class'UT2004RPG.ArtifactFlight'
 }
 

I just hacked the code together - there may be bugs I haven't checked. But it gets you in a good starting place.

And if you copy the code, make sure you remove the space that gets put at the start of some lines.

EDIT: Forget to mention the UT2004RPG.ini file. You can put in a section

[UMGRPG100.LoadedHealing]
Level3Artifact=Class'UT2004RPG.ArtifactFlight'

if you want, but that is the current default set in default properties. But you could change the artifact or even have multiple artifacts.
You also need to replace the line in the [UT2004RPG.MutUT2004RPG] section
Abilities=Class'DruidsRPG207.AbilityLoadedHealing'
with the line
Abilities=Class'UMGRPG100.LoadedHealing'
so that people can buy your ability.

But remember, because we had the line
if(AbilityLevel == 3)
you only get the boots of flight if you have LoadedHealing level 3.
Tentei



Joined: 07/13/2007 15:21:34
Messages: 22
Offline

Well, following what you said Szlat, there were some problems when I was compiling them. Instead, I just made a new ability that extended Loaded Artifacts, but only allowed medics to purchase them. Anyways, my problems are solved! Thanks for the help guys!
[Email]
 
Forum Index -> Druids RPG
Go to: