[Logo]
 
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Druids school for Changing skill levels, overriding methods, and adding your own classes to RPG  XML
Forum Index -> UnrealScript, Coding, Mapping, and 3rd party Mods Go to Page: Previous  1, 2
Author Message
{TARD}-GAFFA


[Avatar]
Joined: 05/18/2007 02:04:18
Messages: 26
Offline

nice post i am going to try some of these is there a way of making zounds be able to purchase playing them at like 300 stat points that would be fun because people play my zounds too much on my server so i want them to work for it


[Email]
{RAD}Raze2K5

Killing Spree

Joined: 04/20/2005 14:25:39
Messages: 82
Location: Tempe, AZ
Offline

quick question... I'm attempting to create my own character class called the "Jack of All Trades" (master of none, of course) and am extending ALL abilities to allow this character to be able to select the ability, as well as the original default character...

the catch is that my class won't be able to max any of the abilities, where as the original class WILL be able to... so instead of basically stealing all your code and doubling the length of the the in-game skills list, I've decided to extend the skills... ALL of them... and I'm using an if/else statement to attempt to achieve the result I'm looking for, but don't know if I need to terminate the return string with a semi colon...

I'm inside my first modified class (MyAbilityMonsterPoints)... should it look like THIS?
Code:
defaultproperties
 {
      AbilityName="Monster Points"
      Description="Allows you to summon monsters with the loaded monsters skill. (Max Level: 20, 13 for JoAT)|You must be a Monster Master or Jack-of-All-Trades to purchase this skill.|Cost (per level): 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21"
      StartingCost=2
      CostAddPerLevel=1
 	if(Data.Abilities[x] == class'ClassMonsterMaster')
 	     MaxLevel=20
 	else
 	     MaxLevel=13
 }


or should it look like THIS?

Code:
defaultproperties
 {
      AbilityName="Monster Points"
      Description="Allows you to summon monsters with the loaded monsters skill. (Max Level: 20, 13 for JoAT)|You must be a Monster Master or Jack-of-All-Trades to purchase this skill.|Cost (per level): 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21"
      StartingCost=2
      CostAddPerLevel=1
 	if(Data.Abilities[x] == class'ClassMonsterMaster')
 	     MaxLevel=20; //note how i added a semi-colon! ^^
 	else
 	     MaxLevel=13; //here too! ^^
 }


thanks

NOTE TO SELF: DruidNoWeaponDrop may have the fix for seperating skill selection by class if current method doesn't work

Disclaimer: Post count does not reflect level of expertise.
[WWW]
Szlat

Wicked Sick!

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

I have never seen anyone putting an if statement in the defaultproperties section. I don't think you can.
So, you have to do it as in DruidNoWeaponDrop. The Cost function returns 0 if you cannot buy the next level, >0 as the cost for a valid purchase.
So, if the player in this case has the ClassMonsterMaster ability, then return the correct cost. If the player has ClassJackofallTrades, then return the correct cost up to level 13, then return 0. For all other classes, return 0
{RAD}Raze2K5

Killing Spree

Joined: 04/20/2005 14:25:39
Messages: 82
Location: Tempe, AZ
Offline

Szlat wrote:
I have never seen anyone putting an if statement in the defaultproperties section. I don't think you can.
So, you have to do it as in DruidNoWeaponDrop. The Cost function returns 0 if you cannot buy the next level, >0 as the cost for a valid purchase.
So, if the player in this case has the ClassMonsterMaster ability, then return the correct cost. If the player has ClassJackofallTrades, then return the correct cost up to level 13, then return 0. For all other classes, return 0 


Thank you for the quick reply... I'm in the process of redoing my changes then (following DruidNoWeaponDrop as the example)... I figured it wouldn't work because it looked like the "defaultproperties" section was declaring constants, and extending would just amend an existing constant by way of replacement for the exact constant, not by statement... if that makes sense...

so here's what I've got (it's a template... classORIGINAL is replaced with the original master class, and the #'s are replaced with the skill level set for the JoAT):

Code:
static simulated function int Cost(RPGPlayerDataObject Data, int CurrentLevel)
 {
 	local int x;
 	local int rv;
 	local bool ok;
 
 	for (x = 0; x < Data.Abilities.length && !ok; x++)
 		if (Data.Abilities[x] == class'ClassWeaponsMaster' || Data.Abilities[x] == class'ClassJackOfAll')
 			ok = true;
 	
 	if(Data.Level < (default.RequiredLevel + CurrentLevel))
 		return 0;
 	if((Data.Level >= (default.RequiredLevel + CurrentLevel)) && (CurrentLevel <= #)) //1 LESS THAN LEVEL CUTOFF FOR JACKOFALL CLASS, it checks the current skill level then determines whether to allow next level or not
 		rv = Super.Cost(Data, CurrentLevel);
 	if((Data.Level >= (default.RequiredLevel + CurrentLevel)) && (CurrentLevel >= #)) //1 HIGHER THAN ABOVE, THIS IS WHERE THE DETERMINATION FOR CHARACTER CLASSES COMES IN
 	{
 		for (x = 0; x < Data.Abilities.length && !ok; x++)
 			if (Data.Abilities[x] == class'ClassORIGINAL')
 				rv = Super.Cost(Data, CurrentLevel);
 			else
 				rv = 0;
 	}
 	if(rv > 0)
 	{
 		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;
 		}
 		else
 			return rv;
 	}
 	return 0;
 }


it seems as thouugh DruidNoWeaponDrop deals with "Super.Cost(Data, Current Level)" so this being my first was a bit difficult to follow (haven't coded in years)... dunno if that'll work yet, but here's hoping :} if it does, the rest should be cake o_O

Disclaimer: Post count does not reflect level of expertise.
[WWW]
Szlat

Wicked Sick!

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

As far as I know, RPGAbility does not have a property RequiredLevel. So you will need to declare it, and set a default value in defaultproperties, so that default.RequiredLevel works.
If you made it a config variable, then admins could change the required minimum level in the ini file.

It looks like it is close to working.
JackofAll should be able to buy levels 1 to 3.
However, I am not sure that WeaponMasters will be able to buy all the levels.

The second loop looks a bit wrong.
When it starts, ok will be true, so !ok is false, so the loop immediately terminates.
And if it did go, if there was another ability after ClassWeaponMaster (or ClassORIGINAL as it now is) it would reset rv = 0.

Perhaps something like:
Code:
 static simulated function int Cost(RPGPlayerDataObject Data, int CurrentLevel)
 {
  	local int x;
  	local bool maxl;
  
  	for (x = 0; x < Data.Abilities.length && maxl == 0; x++)
 	{
  		if (Data.Abilities[x] == class'ClassWeaponsMaster')
 			maxl = default.MaxLevel;
 		if (Data.Abilities[x] == class'ClassJackOfAll')
 			maxl = 3;		// or whatever max level you want for the JackofAll
 	}
 
 	if (maxl > 0)	
 	{
  		if(Data.Level >= (default.RequiredLevel + CurrentLevel) && CurrentLevel < maxl) 
  			return Super.Cost(Data, CurrentLevel);
 	}
 	else
 	{	// hasn't got a class that can buy it
 		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;
 }
 


{RAD}Raze2K5

Killing Spree

Joined: 04/20/2005 14:25:39
Messages: 82
Location: Tempe, AZ
Offline

Szlat wrote:
As far as I know, RPGAbility does not have a property RequiredLevel. So you will need to declare it, and set a default value in defaultproperties, so that default.RequiredLevel works.
If you made it a config variable, then admins could change the required minimum level in the ini file.

It looks like it is close to working.
JackofAll should be able to buy levels 1 to 3.
However, I am not sure that WeaponMasters will be able to buy all the levels.

The second loop looks a bit wrong.
When it starts, ok will be true, so !ok is false, so the loop immediately terminates.
And if it did go, if there was another ability after ClassWeaponMaster (or ClassORIGINAL as it now is) it would reset rv = 0.  


oops I apologize, the code I posted was for my extension to AbilityEnhancedReduction, which defines that variable within the class itself... i DO understand what you're saying, though, and am VERY glad you pointed that out, because even though I was manually checking the conditions in each extended class, i didn't pay attention to what variables were called...

Thanks a bunch! I just finished extending the last class, so... time to package it up and see how it goes... ::crosses fingers::

Disclaimer: Post count does not reflect level of expertise.
[WWW]
{RAD}Raze2K5

Killing Spree

Joined: 04/20/2005 14:25:39
Messages: 82
Location: Tempe, AZ
Offline

ok after compiling, I've received 37 warnings... seems like a lot

they all look similar to this:

Parsing RADAdrenalineSurge
C:\Unreal Anthology\UT2004\JackOfAll\Classes\RADAdrenalineSurge.uc(5) : Warning, 'AdjustableStartingCost' obscures 'AdjustableStartingCost' defined in base class 'DruidAdrenalineSurge'.
C:\Unreal Anthology\UT2004\JackOfAll\Classes\RADAdrenalineSurge.uc(5) : Warning, 'AdjustableCostAddPerLevel' obscures 'AdjustableCostAddPerLevel' defined in base class 'DruidAdrenalineSurge'.

etc etc... do I have to change that information just as i did for

Super.Cost(Data, CurrentLevel)

which was changed, as per the thread, to

class'RPGAbility'.Static.Cost(Data, CurrentLevel)

or do i want these obscurities to occur... ?

EDIT: nevermind... forgot to remove all the extra called variables... since I'm extending, they inherit all of the parent's properties, and there was no need to re-define variables except within a struct itself...

0 errors, 0 warnings... time to TEST!!

Disclaimer: Post count does not reflect level of expertise.
[WWW]
{RAD}Raze2K5

Killing Spree

Joined: 04/20/2005 14:25:39
Messages: 82
Location: Tempe, AZ
Offline

fail

It downloaded and loaded up just fine, and i got my stats removed the way it should be handled by RPG, and it refunded my points...

BUT... I can't select any of my skills as a weapon master can someone help me with by lending another set of eyes, and a sharp mind? in it's entirety, this is the final code i have for, as one example, Loaded Weapons:

Code:
class RADLoaded extends DruidLoaded
 	config(UT2004RPG) 
 	abstract;
 
 static simulated function int Cost(RPGPlayerDataObject Data, int CurrentLevel)
 {
 	local int x;
 	local int rv;
 	local bool ok;
 
 	for (x = 0; x < Data.Abilities.length && !ok; x++)
 		if ((Data.Abilities[x] == class'ClassWeaponsMaster') || (Data.Abilities[x] == class'ClassRADsJackOfAll'))
 			ok = true;
 
 	if(Data.Level < default.MinLev2 && CurrentLevel > 0)
 		return 0;
 	if(Data.Level < default.MinLev3 && CurrentLevel > 1)
 		return 0;
 	if(CurrentLevel <= 1) //1 LESS THAN LEVEL CUTOFF FOR JACKOFALL CLASS
 		rv = class'RPGAbility'.static.Cost(Data, CurrentLevel);
 
 	if(Data.Level >= default.MinLev1) && (CurrentLevel >= 2)) //1 HIGHER THAN ABOVE, THIS IS WHERE THE DETERMINATION FOR CHARACTER CLASSES COMES IN
 	{
 		for (x = 0; x < Data.Abilities.length && !ok; x++)
 			if (Data.Abilities[x] == class'ClassWeaponsMaster')
 				rv = class'RPGAbility'.static.Cost(Data, CurrentLevel);
 	}
 	if(rv > 0)
 	{
 		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;
 		}
 		else
 			return rv;
 	}
 	return 0;
 }
 
 defaultproperties
 {
      Description="When you spawnLevel 1: You are granted all regular weapons with the default percentage chance for magic weapons.|Level 2: You are granted onslaught weapons and all weapons with max ammo. This is the max level for a Jack-of-all-Trades.|Level 3: You are granted super weapons (Invasion game types only).|Level 4: Magic weapons will be generated for all your weapons.|Level 5: You receive all positive magic weapons.|You must be a Weapons Master or Jack-of-All-Trades to purchase this skill.|You must be level 40 before you can buy level 2 and level 55 before you can buy level 3.|Cost (per level): 10,15,20,25,30"
 }

Disclaimer: Post count does not reflect level of expertise.
[WWW]
{RAD}Raze2K5

Killing Spree

Joined: 04/20/2005 14:25:39
Messages: 82
Location: Tempe, AZ
Offline

Fixed! here the working code for allowing a different class to select a skill, but not at the max of the original class:

Code:
class RADLoaded extends DruidLoaded
 	config(UT2004RPG) 
 	abstract;
 
 static simulated function int Cost(RPGPlayerDataObject Data, int CurrentLevel)
 {
 	local int x;
 	local bool ok;
 
 	for (x = 0; x < Data.Abilities.length && !ok; x++)
 		if(Data.Abilities[x] == class'ClassWeaponsMaster' || Data.Abilities[x] == class'ClassRADsJackOfAll')
 			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;
 	}
 
 	if(Data.Level < default.MinLev2 && CurrentLevel > 0)
 		return 0;
 	if(Data.Level < default.MinLev3 && CurrentLevel > 1)
 		return 0;
 	if(CurrentLevel == 0)
 		return Super(RPGAbility).Cost(Data, CurrentLevel);
 
 	if(CurrentLevel == 1)
 	{
 		for (x = 0; x < Data.Abilities.length; x++)
 			if(Data.Abilities[x] == class'ClassWeaponsMaster' || Data.Abilities[x] == class'ClassRADsJackOfAll')
 			{
 				if(Data.Level >= default.MinLev2)
 					return Super(RPGAbility).Cost(Data, CurrentLevel);
 			}
 	}
 	if(CurrentLevel >= 2)
 	{
 		for (x = 0; x < Data.Abilities.length; x++)
 			if(Data.Abilities[x] == class'ClassWeaponsMaster')
 				if(Data.Level >= default.MinLev3)
 					return Super(RPGAbility).Cost(Data, CurrentLevel);
 	}
 }
 
 defaultproperties
 {
      Description="When you spawnLevel 1: You are granted all regular weapons with the default percentage chance for magic weapons.|Level 2: You are granted onslaught weapons and all weapons with max ammo. This is the max level for a Jack-of-all-Trades.|Level 3: You are granted super weapons (Invasion game types only).|Level 4: Magic weapons will be generated for all your weapons.|Level 5: You receive all positive magic weapons.|You must be a Weapons Master or Jack-of-All-Trades to purchase this skill.|You must be level 40 before you can buy level 2 and level 55 before you can buy level 3.|Cost (per level): 10,15,20,25,30"
 }


Hope this helps someone Thanks for the write up, dru, can't wait to finish the rest!

Disclaimer: Post count does not reflect level of expertise.
[WWW]
 
Forum Index -> UnrealScript, Coding, Mapping, and 3rd party Mods Go to Page: Previous  1, 2
Go to: