Thread: Proper projectiles

Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21
  1. #11  
    Donator


    Join Date
    Jan 2010
    Age
    29
    Posts
    4,122
    Thanks given
    274
    Thanks received
    551
    Rep Power
    738
    Quote Originally Posted by World 325 View Post
    Putting it in the update is not a good idea. It could be that the anim is not looping and is finished before the player reaches the top?
    The normal forcemovement mask does not include an anim, but yes it definitly inst looping just cant seem to figure out how to loop it myself tho.
    Reply With Quote  
     

  2. #12  
    Owner of OmniScape
    OmniPS's Avatar
    Join Date
    Jul 2013
    Posts
    310
    Thanks given
    80
    Thanks received
    49
    Rep Power
    48
    Firstly I would run the anim loop in a timer task set at 1000 mills. In the player class create a Boolean called IsClimbing and set it to true in your forceMovement when the walking starts. Then in your forceMovement when the player reaches the destination set the IsClimbing to false. Now in your task have a conditional check for wether IsClimbing is true for that player and if it is play the animation. If not, end the task. This will loop the anim until you reach the end of the forceMovement
    Attached image
    Reply With Quote  
     

  3. #13  
    Donator


    Join Date
    Jan 2010
    Age
    29
    Posts
    4,122
    Thanks given
    274
    Thanks received
    551
    Rep Power
    738
    Bump still looking for a fix for forcemovement.

    Now also looking for a dump for item prices (shop sell/buy and high alch) because my own dump has loads of wrong prices.
    Reply With Quote  
     

  4. #14  
    Donator


    Join Date
    Jan 2010
    Age
    29
    Posts
    4,122
    Thanks given
    274
    Thanks received
    551
    Rep Power
    738
    Still looking for someone to sort this issue.
    Reply With Quote  
     

  5. #15  
    Donator


    Join Date
    Jan 2010
    Age
    29
    Posts
    4,122
    Thanks given
    274
    Thanks received
    551
    Rep Power
    738
    Bump
    Reply With Quote  
     

  6. #16  
    Donator


    Join Date
    Jan 2010
    Age
    29
    Posts
    4,122
    Thanks given
    274
    Thanks received
    551
    Rep Power
    738
    bump.
    Reply With Quote  
     

  7. #17  
    Registered Member
    Join Date
    Dec 2017
    Posts
    31
    Thanks given
    12
    Thanks received
    4
    Rep Power
    23
    Use this for projectile start position

    Code:
    private static Position center(Entity entity) {
            Position position = entity.getPosition();
            if (entity instanceof CharacterEntity) {
                CharacterEntity attacker = (CharacterEntity) entity;
                if (attacker.getSize() > 2) {
                    int deltax = (int) Math.ceil((double) attacker.getSize() / 3d);
                    int deltay = (int) Math.ceil((double) attacker.getSize() / 3d);
    
                    position = new Position(attacker.getPosition().getX() + deltax, attacker.getPosition().getY() + deltay, attacker.getPosition().getZ());
                }
            }
            return position;
        }
    Reply With Quote  
     

  8. #18  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    Quote Originally Posted by Lefwek View Post
    Use this for projectile start position

    Code:
    private static Position center(Entity entity) {
            Position position = entity.getPosition();
            if (entity instanceof CharacterEntity) {
                CharacterEntity attacker = (CharacterEntity) entity;
                if (attacker.getSize() > 2) {
                    int deltax = (int) Math.ceil((double) attacker.getSize() / 3d);
                    int deltay = (int) Math.ceil((double) attacker.getSize() / 3d);
    
                    position = new Position(attacker.getPosition().getX() + deltax, attacker.getPosition().getY() + deltay, attacker.getPosition().getZ());
                }
            }
            return position;
        }
    For NPCs such as dragons you'd be better off calculating the position of the head to actually keep projectiles smooth, especially in the cases such as Vorkath which are very large (size 7) and have the head poking way out of the center. Centralizing the projectile in that case would look pretty off.
    But yeah, that's right around the method to calculate the center of a NPC.
    I'd have just done
    final int offset = (int) (size * 0.5f);//multiply cuz it's a tiny bit faster than dividing; micro optimization. Not sure if that's the case about dividing by two though, might be the same speed in this case but regardless.
    final centerX = x + offset, centerY = y + offset;
    and done, has pretty much the same effect.
    Attached image
    Reply With Quote  
     

  9. #19  
    Registered Member
    Join Date
    Dec 2017
    Posts
    31
    Thanks given
    12
    Thanks received
    4
    Rep Power
    23
    Quote Originally Posted by Kris View Post
    For NPCs such as dragons you'd be better off calculating the position of the head to actually keep projectiles smooth, especially in the cases such as Vorkath which are very large (size 7) and have the head poking way out of the center. Centralizing the projectile in that case would look pretty off.
    But yeah, that's right around the method to calculate the center of a NPC.
    I'd have just done
    final int offset = (int) (size * 0.5f);//multiply cuz it's a tiny bit faster than dividing; micro optimization. Not sure if that's the case about dividing by two though, might be the same speed in this case but regardless.
    final centerX = x + offset, centerY = y + offset;
    and done, has pretty much the same effect.
    I haven't attempted to do Vorkath yet so I haven't encountered any visual problems using this method so far. The easiest way I can think of atm would be to iterate over the tiles around the edge of the npc's occupied tiles and find the closest to the player, that would be (if my thinking is correct) the best starting position.

    EDIT for op

    Looking for someone to make it so my forcemovement animation is being repeated client sided, using the stand animation via the player updating doesnt work for me.
    Ghost was gonna do this for me but he has not responded in a couple days.
    It depends on the animations, some are meant to be used with animation reset and will loop forever, others are not and require the server to loop them. When forcemovement ends it will always teleport the player to the end position in the server, look where it does that and you can find a way to loop the animation.
    Reply With Quote  
     

  10. #20  
    Donator


    Join Date
    Jan 2010
    Age
    29
    Posts
    4,122
    Thanks given
    274
    Thanks received
    551
    Rep Power
    738
    Well am gonna just stick with what kris told me before and using the stand anim, it doesnt look perfect but its better then having the animation cut off.

    So am still looking for the projectiles.
    Reply With Quote  
     

Page 2 of 3 FirstFirst 123 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 31
    Last Post: 06-19-2014, 05:52 PM
  2. Replies: 6
    Last Post: 06-16-2014, 04:55 AM
  3. The importance of prices and a strong economy
    By A -- J in forum RS2 Server
    Replies: 5
    Last Post: 05-27-2014, 04:39 AM
  4. Replies: 1
    Last Post: 04-11-2014, 03:34 PM
  5. Changing prices of server and adding items.
    By Rebels str in forum Help
    Replies: 4
    Last Post: 12-24-2009, 08:54 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •