Jump to content
  • 0

Projectile Draw Height


Ainz Ooal Gown

Question

Hi All,

 

I have an issue with the draw location of projectiles due to the sprite image size I am using for my player character being a lot larger than default sprite (82x82).

 

Currently when a player fires a projectile it is coming from his feet lol, does anyone know where the draw projectile height can be edited?

 

Thanks

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

Could you not adjust the sprite for the projectile to account for that as well? Though the actual hitbox would not change and still be at your feet. Not perfect, but a quick option. 

 

 

 

I imagine you'd have to make the entire thing spawn up a tile to really make it work. But also check for hits a tile above and where players actually are.. Or you could only shoot them in the foot. 

Link to comment
Share on other sites

  • 0
16 minutes ago, Joyce said:

Could you not adjust the sprite for the projectile to account for that as well? Though the actual hitbox would not change and still be at your feet. Not perfect, but a quick option. 

 

 

 

I imagine you'd have to make the entire thing spawn up a tile to really make it work. But also check for hits a tile above and where players actually are.. Or you could only shoot them in the foot. 

 

Thanks for reply buddy. Yeah could move the sprite, it would just mean move everything else (paperdolls an such) as projectiles is the last thing I added and didnt think about position of where it would fire from.

 

Happy for the hit box to stay the same, its just the image I would like to move up by 32px but cant seem to find where its draw in source yet.

Link to comment
Share on other sites

  • 0

Oh I meant the image for the projectile only, make that one large and have the arrow further up. Less code to edit. (and possibly break future updates with) 

 

I believe projectiles count as entities, so they share the same draw method as everything else. You'd likely have to override that one with a projectile specific one for this to work. (or alternatively check if the current draw method is run from a projectile class. Ie if this is projectile do x) 

Link to comment
Share on other sites

  • 0
15 minutes ago, Joyce said:

Oh I meant the image for the projectile only, make that one large and have the arrow further up. Less code to edit. (and possibly break future updates with) 

 

I believe projectiles count as entities, so they share the same draw method as everything else. You'd likely have to override that one with a projectile specific one for this to work. (or alternatively check if the current draw method is run from a projectile class. Ie if this is projectile do x) 

 

Ah right, yeah I already tried changing the project image but that doesnt work really. As animations for projectiles have to be aimed upwards and have auto rotation on, and when you increase the image height it only changes how far away the image is shown on screen. Has to be in the center otherwise when facing a different direction is flips it if that makes sense.

 

Probs right not to change code for it so wont break future updates. Just cant think of a solution

 

Spoiler

7b86ebb8e4638819284077ed0b4d1a42.gif

 

Link to comment
Share on other sites

  • 0

a7bab10af1b239fdccc89012fecd9d32.gif

in Intersect-Engine\Intersect.Server\Networking\PacketHandler.cs line 867

 

change

                        MapInstance.Get(player.MapId)
                            .SpawnMapProjectile(
                                player, projectileBase, null, weaponItem, player.MapId,
                                (byte)player.X, (byte)player.Y, (byte)player.Z,
                                (byte)player.Dir, null
                            );

to

                        byte z = (byte)(player.Y - 1);
                        MapInstance.Get(player.MapId)
                            .SpawnMapProjectile(
                                player, projectileBase, null, weaponItem, player.MapId,
                                (byte)player.X, z, (byte)player.Z,
                                (byte)player.Dir, null
                            );

change - 1 to the amount of tiles you want the arrow to go up

 

Link to comment
Share on other sites

  • 0

wishy's solution didnt work for me. but, in Intersect.Client.Entities.Projectile.Projectile.cs/AddProjectileSpawns, there is this:

Spoiler

                            var s = new ProjectileSpawns(
                                FindProjectileRotationDir(Dir, d), X + FindProjectileRotationX(Dir, x - 2, y - 2),
                                Y - 1 + FindProjectileRotationY(Dir, x - 2, y - 2), Z, CurrentMap, animBase,
                                mMyBase.Animations[spawn].AutoRotate, mMyBase, this
                            );

 

where you just add that "Y - 1" to go up, which is what I assume you want

Link to comment
Share on other sites

  • 0
5 hours ago, wishy said:

a7bab10af1b239fdccc89012fecd9d32.gif

in Intersect-Engine\Intersect.Server\Networking\PacketHandler.cs line 867

 

change


                        MapInstance.Get(player.MapId)
                            .SpawnMapProjectile(
                                player, projectileBase, null, weaponItem, player.MapId,
                                (byte)player.X, (byte)player.Y, (byte)player.Z,
                                (byte)player.Dir, null
                            );

to


                        byte z = (byte)(player.Y - 1);
                        MapInstance.Get(player.MapId)
                            .SpawnMapProjectile(
                                player, projectileBase, null, weaponItem, player.MapId,
                                (byte)player.X, z, (byte)player.Z,
                                (byte)player.Dir, null
                            );

change - 1 to the amount of tiles you want the arrow to go up

 

 

Awesome buddy, proper chuffed works a treat.

 

1 minute ago, gooby said:

wishy's solution didnt work for me. but, in Intersect.Client.Entities.Projectile.Projectile.cs/AddProjectileSpawns, there is this:

  Hide contents


                            var s = new ProjectileSpawns(
                                FindProjectileRotationDir(Dir, d), X + FindProjectileRotationX(Dir, x - 2, y - 2),
                                Y - 1 + FindProjectileRotationY(Dir, x - 2, y - 2), Z, CurrentMap, animBase,
                                mMyBase.Animations[spawn].AutoRotate, mMyBase, this
                            );

 

where you just add that "Y - 1" to go up, which is what I assume you want

 

Thanks man, Wishy's siolution worked for me :)

Link to comment
Share on other sites

  • 0
On 4/14/2020 at 6:00 PM, gooby said:

wishy's solution didnt work for me. but, in Intersect.Client.Entities.Projectile.Projectile.cs/AddProjectileSpawns, there is this:

  Reveal hidden contents


                            var s = new ProjectileSpawns(
                                FindProjectileRotationDir(Dir, d), X + FindProjectileRotationX(Dir, x - 2, y - 2),
                                Y - 1 + FindProjectileRotationY(Dir, x - 2, y - 2), Z, CurrentMap, animBase,
                                mMyBase.Animations[spawn].AutoRotate, mMyBase, this
                            );

 

where you just add that "Y - 1" to go up, which is what I assume you want

yours worked perfectly, ty:2_grimacing:

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...