Jump to content
  • 0

Custom entity animation?


Vaiku

Question

I'm hoping to use projectiles on weapons to accomodate adding unique spell effects to weapons, including melee ones. For example, a dagger that has a range=1 projectile that takes health from player each time they hit but maybe adds mana, or applies a dot to the enemy, etc.

 

My problem is that this treats the weapon as a projectile and puts the entity's animation into a the "_Shoot" instead of the "_attack" that I'd like (for some reason, _weapon doesn't seem to work as I'd expect? not sure when _weapon even applies...)

What i'd like to do is be able to assign to each item the appropriate attack state that the entity should use, regardless of what I set for those other values. This will also allow me to expand from only one _attack state (thrust vs. slash animations).

 

I have no idea where to start though, looking for input / anyone who's done something similar!

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 1

I ended up adding checkboxes to the item editor to specify which weapon type I was using. You can then check out the Client>Entites> Enity.cs and find "UpdateSpriteAnimation" and add some checks to display whatever animation you want for that weapon type. I did this to add new animations but you could just add the checks to the current ones listed. I would just play around with it. To add the checkboxes search for every thing listed for the "TwoHand" checkbox and copy it for the new weapon types you want.

 

Example: I added polearms and two handed weapon animations

 

  if (AnimatedTextures[SpriteAnimations.Weapon] != null && !item.TwoHanded && Globals.IsInteracting != true)
                            {
                                SpriteAnimation = SpriteAnimations.Weapon;
                            }

                            if (AnimatedTextures[SpriteAnimations.Shoot] != null && item.ProjectileId != Guid.Empty && !item.Polearms && Globals.IsInteracting != true)
                            {
                                SpriteAnimation = SpriteAnimations.Shoot;
                            }
                            if (AnimatedTextures[SpriteAnimations.WeaponTwoHand] != null && item.TwoHanded && !item.Polearms && Globals.IsInteracting != true)
                            {
                                SpriteAnimation = SpriteAnimations.WeaponTwoHand;
                            }

                            if (AnimatedTextures[SpriteAnimations.WeaponPolearm] != null && item.Polearms && Globals.IsInteracting != true)
                            {
                                SpriteAnimation = SpriteAnimations.WeaponPolearm;
                            }
                        }

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...