[Logo]
 
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
BattleRPG Magic Weapons construction  XML
Forum Index -> UT3 RPG Go to Page: 1, 2 Next 
Author Message
BattleMode

Rampage
[Avatar]

Joined: 11/14/2007 01:35:49
Messages: 126
Offline

My first idea here was to do the same I did with players. Attach an object to them so I do not need a custom class. This turned out to not give me enough control over the weapons.

Then I investigated how Mysterial solved it for UT2004 RPG. He uses a rather clever trick of defining 1 RPGWeapon class that contains a standard weapon object and passes through all calls to the RPGWeapon to the connected Weapon. Disadvantage is that this has 1001 side effects for which all kinds of hacks are needed to compensate them. Also the UT3 weapon classes are not that clean, so passing through would be quite complicated.

So I am going to do it the old fashioned way instead. Create separate subclasses for all weapons.

Some (not yet working) weapon magic class:
Code:
class BattleWeaponMagic_IncreasedDamage extends BattleWeaponMagic config (BattleRPG);
 
 function DamageToOtherPawn (UTPawn P, int Level, int OriginalDamage, out int Damage, UTPawn InjuredPawn, vector HitLocation, out vector Momentum, class<DamageType> DamageType)
 {
   Damage = Damage * (1.0 + Level * 0.05);
 }
 
 defaultproperties
 {
   MagicName = "of Increased Damage";
   MagicMaxLevel = 10;
   bPositiveMagic = true;
   Overlay = Material'PICKUPS.UDamage.M_UDamage_Overlay';
 }




Szlat

Wicked Sick!

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

BattleMode wrote:
My first idea here was to do the same I did with players. Attach an object to them so I do not need a custom class. This turned out to not give me enough control over the weapons. 
If you go down the "RPGWeapon" approach, you are going to need to add a lot of code for passing calls on to the "ModifiedWeapon". And the linking of LinkGuns will need modifying to accept RPGWeapons with a ModifiedWeapon of LinkGun - which has all sorts of knock on effects.

As I posted in a different thread, it would be really nice if we could leave the weapons alone, and at run time apply an effect to them.

So in GameRules use the OverridePickupQuery call for the weapon, see it is a flak which we haven't picked up before, so select a magic type for it, and display the correct pickup text for it. Then have the netdamage code check the list of magictypes for that weapon for the player and action accordingly.

I am not sure if we can trap all the events that RPGWeapon used to, but we should be able to trap enough. All the damage ones will be ok (Damage, Energy, Freeze/Null Entropy, Healing, Knockback, Penetrating, Piercing, Poison, Protection, Rage, Reflection, Sturdy, Vampire, Vorpal). We could do infinity and luck on a timer. That leaves Force and Quickfoot - we may be able to handle these based on the weapon change message, but I don't mind if they go really.

The only thing I am not sure about is handling the cloning of weapons. It may be we can apply something to the pickup that says what type it is?

So - what control was it you did not have when you implemented the attached object?
BattleMode

Rampage
[Avatar]

Joined: 11/14/2007 01:35:49
Messages: 126
Offline

Szlat wrote:
So - what control was it you did not have when you implemented the attached object?  
Well, first on my list is changing the name of the weapons based on their magic. Next is changing theri appearance based on their magic type, e.g. when the player switches between weapons. Also I had some trouble figuring out an efficient way to find objects attached to weapons.

I also prefer the "leave the weapons alone" aproach actually. With the players pawns I succeeded in doing so so far. But I suppose there is a reason UT2004 RPG ended up with subclassing, and if subclassing is needed I prefer straightforward subclassing over the 1 superclass aproach with passing everything through I think.

Perhaps you know this. With a pawn I can add an inventory item and then use FindInventoryType to find it back. What trick would allow something similar with a weapon?

Szlat wrote:
So in GameRules use the OverridePickupQuery call for the weapon, see it is a flak which we haven't picked up before, so select a magic type for it, and display the correct pickup text for it. Then have the netdamage code check the list of magictypes for that weapon for the player and action accordingly. 
In this aproach how would the magic stay on the weapon when it goes from one player to another player? How would you change the pickup text here?

It seems to me you really need to do something with the weapon object (either by subclassing, superclassing (let's call what UT2004 RPG does that) or attaching). I have also thought about just applying everything to the player based on the weapon currently active but it seems to me that would result in all kinds of unwanted limitations.

For now I have chosen to subclass everything. But the actual weapon magic logic is defined separately, so in the future this could be changed without having to re-build the weapon magic classes.
Szlat

Wicked Sick!

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

BattleMode wrote:
first on my list is changing the name of the weapons based on their magic.  
Can you change the ItemName property?

BattleMode wrote:
Next is changing theri appearance based on their magic type, e.g. when the player switches between weapons.  
When you do the first pickup, and decide to generate a magic type for this weapon, at that time can we not apply an overlay like UT2004RPG did? The overlay will then stop on the weapon when they change weapons.

BattleMode wrote:
Also I had some trouble figuring out an efficient way to find objects attached to weapons.  
I think keep the weapon magic types in player data rather than attached directly to the weapon.

BattleMode wrote:
Perhaps you know this. With a pawn I can add an inventory item and then use FindInventoryType to find it back. What trick would allow something similar with a weapon? 
Not sure there is one. Weapons do not have an inventory chain. I think you would have to sub-class and add the code yourself.

BattleMode wrote:

Szlat wrote:
So in GameRules use the OverridePickupQuery call for the weapon, see it is a flak which we haven't picked up before, so select a magic type for it, and display the correct pickup text for it. Then have the netdamage code check the list of magictypes for that weapon for the player and action accordingly. 
In this aproach how would the magic stay on the weapon when it goes from one player to another player? How would you change the pickup text here? 
Perhaps we would have to trap the throw weapon command, and somehow change the pickup item so that the magic type etc is defined in it. Perhaps by changing the pickup ItemName to match what the weapon is? Then when the next player picks it up, we can see it is already a magic weapon.

BattleMode wrote:
It seems to me you really need to do something with the weapon object (either by subclassing, superclassing (let's call what UT2004 RPG does that) or attaching). I have also thought about just applying everything to the player based on the weapon currently active but it seems to me that would result in all kinds of unwanted limitations. 
Agreed the subclassing method gives less limitations as to what you can achieve, but also may provide more incompatibilities with other mutators. And you will need to put the extra code in for the link gun.

BattleMode

Rampage
[Avatar]

Joined: 11/14/2007 01:35:49
Messages: 126
Offline

Szlat wrote:
Can you change the ItemName property? 
I am still trying to figure that part out, the internationalization stuff does things I do not completely get yet.

Szlat wrote:
I think keep the weapon magic types in player data rather than attached directly to the weapon. 
That would make it quite tough to keep the magic intact while the weapon switches between players.

Szlat wrote:
Not sure there is one. Weapons do not have an inventory chain. I think you would have to sub-class and add the code yourself. 
Hm, once I subclass the weapon I no longer need to attach any objects :-S

Szlat wrote:
Perhaps we would have to trap the throw weapon command, and somehow change the pickup item so that the magic type etc is defined in it. Perhaps by changing the pickup ItemName to match what the weapon is? Then when the next player picks it up, we can see it is already a magic weapon. 
Abuse the ItemName to define the type of magic, interesting idea, that is worth some experimenting.

Szlat wrote:
Agreed the subclassing method gives less limitations as to what you can achieve, but also may provide more incompatibilities with other mutators. And you will need to put the extra code in for the link gun. 
Agreed, however given the way the scoreboard and some other things work compatibility is quite hard with UT3.
BattleMode

Rampage
[Avatar]

Joined: 11/14/2007 01:35:49
Messages: 126
Offline

BattleMode wrote:

Szlat wrote:
Can you change the ItemName property? 
I am still trying to figure that part out, the internationalization stuff does things I do not completely get yet. 


Unfortunately the direct aproach of changing ItemName doesn't work: "Error, Can't assign Const variables". So (ab)using it for storing the magic type is out too.

It is declared as a "var databinding localized string ItemName;".
BattleMode

Rampage
[Avatar]

Joined: 11/14/2007 01:35:49
Messages: 126
Offline

Well I figured out how to override the name (to add the magic specification) now.

It's quite simple, it's a matter of subclassing the weapon (ahum) and creating a new GetHumanReadableName() method. I tried GetItemName (which seemed like the logical choice) and GetLocalString but those don't work.

Since the default GetHumanReadableName does nothing but return Default.ItemName it seems the list with reasons why it has to be a subclass has become 1 bullet longer.

So I will probably stick to my bunch of subclasses aproach. It's bad for compatibility (although it also means RPG will not try to modify weapons it doesn't recognize) but it seem to be good for everything else. 52 classes and counting .
Szlat

Wicked Sick!

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

BattleMode wrote:

Szlat wrote:
Can you change the ItemName property? 
I am still trying to figure that part out, the internationalization stuff does things I do not completely get yet. 
Mmm. I hadn't considered that.

BattleMode wrote:

Szlat wrote:
Perhaps we would have to trap the throw weapon command, and somehow change the pickup item so that the magic type etc is defined in it. Perhaps by changing the pickup ItemName to match what the weapon is? Then when the next player picks it up, we can see it is already a magic weapon. 
Abuse the ItemName to define the type of magic, interesting idea, that is worth some experimenting. 
If you can't use the ItemName of the pickup, it may be possible to use other fields (e.g. set health to modifier+10)
Szlat

Wicked Sick!

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

BattleMode wrote:
....So I will probably stick to my bunch of subclasses aproach. It's bad for compatibility (although it also means RPG will not try to modify weapons it doesn't recognize) but it seem to be good for everything else. 52 classes and counting
Shame, but ok.

Are you having one RPGWeapon subclass of Weapon, with different magic subclasses of it, or are you producing individual classes for a vampire flak, vampire link etc?
BattleMode

Rampage
[Avatar]

Joined: 11/14/2007 01:35:49
Messages: 126
Offline

Szlat wrote:
Are you having one RPGWeapon subclass of Weapon, with different magic subclasses of it, or are you producing individual classes for a vampire flak, vampire link etc? 
Separate classes for each weapon type (e.g. class BattleWeapon_FlakCannon extends UTWeap_FlakCannon). I do not want to do the pass-through aproach Mysterial made for UT2004 RPG, it's too ugly and has to many fixes for all the side effects.

I will either add a reference to a static class or one to a dynamic class and then probably a pointer back to the weapon, so all the real work will be done in the BattleWeaponMagic class as defined above.
Szlat

Wicked Sick!

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

BattleMode wrote:

Szlat wrote:
Are you having one RPGWeapon subclass of Weapon, with different magic subclasses of it, or are you producing individual classes for a vampire flak, vampire link etc? 
Separate classes for each weapon type. I do not want to do the pass-through aproach Mysterial made for UT2004 RPG, it's too ugly and has to many fixes for all the side effects.

I will either add a reference to a static class or one to a dynamic class and then probably a pointer back to the weapon, so all the real work will be done in the BattleWeaponMagic class as defined above. 
Sorry, I am a bit thick tonight. Can you clarify if you have say 10 magic types, then you would have 10 subclasses of the flak, and 10 subclasses of the rocket, and 10 subclasses of the link etc? This would get to be a heck of a lot of classes - would this include vehicle weapons?

An alternative (which may be what you were planning anyway) is to have one subclass for each type of weapon (e.g. BattleFlak, BattleLink, BattleShock). Give these BattleWeapon classes a variable that can hold a magic type class. And have one magic type class for each of the magic types - pretty much like your BattleWeaponMagic_IncreasedDamage (e.g. BattleWeaponMagic_Vampire, BattleWeaponMagic_IncreasedDamage, BattleWeaponMagic_Sturdy) . Then when the new magic weapon gets created, set the variable to point to the appropriate magic class. Then you need one class per weapon + one class per magic type.
Szlat

Wicked Sick!

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

In that case, can you make the magic type classes (e.g. BattleWeaponMagic_IncreasedDamage) have pickups of their own. So on the old invasion monsters could spawn them, as could luck weapons. The player could then pickup the BattleWeaponMagic_IncreasedDamage pickup and choose which weapon to apply it to.
And players would be able to share magic types they didn't want with other players.

This would be in addition to the normal random allocation of magic types to weapons on first pickup.
BattleMode

Rampage
[Avatar]

Joined: 11/14/2007 01:35:49
Messages: 126
Offline

Szlat wrote:
Can you clarify if you have say 10 magic types, then you would have 10 subclasses of the flak, and 10 subclasses of the rocket, and 10 subclasses of the link etc? This would get to be a heck of a lot of classes -  
No not at all.

I have one separate class for each weapon type (11 classes) and one separate class for each type of magic (2 at the moment, but this will become more). So 11 weapons and 10 magic types will be 21 classes, not 110.

Each weapon has a magic variable in which an instance of a magic object is stored. So the weapon object has a link to the magic object.

Szlat wrote:
In that case, can you make the magic type classes (e.g. BattleWeaponMagic_IncreasedDamage) have pickups of their own. So on the old invasion monsters could spawn them, as could luck weapons. The player could then pickup the BattleWeaponMagic_IncreasedDamage pickup and choose which weapon to apply it to.
And players would be able to share magic types they didn't want with other players. This would be in addition to the normal random allocation of magic types to weapons on first pickup. 
That is an interesting idea. I think this would be possible (having magic pickups), but I want to start with the standard magic and standard artifacts before I spend time on that.

BTW is there perhaps someone in your community who can make me 3D artifacts for UT3?
BattleMode

Rampage
[Avatar]

Joined: 11/14/2007 01:35:49
Messages: 126
Offline

I got the base magic logic working now. Weapons can have magic and can have their name changed according to their magic. I used 2 tricks, sub classing all weapons and using the worldinfo.game.basemutator chain to locate BattleRPG while initializing the weapon.

Next challenge is to get SetOverlayMaterial working for weapons (so they look like magic weapons). Somehow it seems in UT2004 both Pawns and Weapons have this method but in UT3 only Pawns have that method. The source code of SetOverlayMaterial is available but it doesn't look like it would be easy to adapt it for weapons.
Kearin



Joined: 01/05/2008 02:09:23
Messages: 6
Offline

What Szlat was asking for as the increased damage sounds a lot like my WoP power ups.

And you can give each weapon its own inventory chain. The weapon power ups in Weapons of Power where just a unique kind of inventory chain I created that each got a chance to act on various weapon events like AdjustTargetDamage, AdjustPlayerDamage. It's not that bad really, just copy the InvManager model of InventoryChain. The trickiest part really is replication.

Also, one thing you guys need to consider with the approach you're taking of subclasses all the weapons is that you've locked the weapons that can be affected. If anyone makes a new weapons, you'll need to make a new subclass for it to work. I think Mysterial did it the correct way using a decorator/proxy pattern. By having RPGWeapon, he could support future weapons.

Lastly, for the overlays, you're right they pushed it down into UTPawn. There might be a way to do this with a custom material. Assuming the materials for weapons aren't complex, the effects would just be shaders that take the original weapon skin as an input. I'd have to play more with this to know for certain.

Good luck with your RPG mod.
 
Forum Index -> UT3 RPG Go to Page: 1, 2 Next 
Go to: