Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Rotate Camera to Entity but lock pitch?


    ybs

    Recommended Posts

    Posted

    Hi guys,

    I'm new to scripting and writing my own scripts,

    How do I combine "keyboardRotateToEntity(npc)" with "getCamera().keyboardRotateToPitch(Calculations.random(238, 312))"?

    Basically I want to rotate to (npc) while keeping the Pitch of the camera between certain positions, any help is appreciated!

    Posted

    I'm not aware of anything in the API that would allow this, but one thing you could try is moving to a random yaw on a fixed pitch until npc.isOnScreen() returns true.

    Camera.keyboardRotateTo(random-yaw, fixed-pitch);

     

     

    Posted
    3 hours ago, Stoned said:

    I'm not aware of anything in the API that would allow this, but one thing you could try is moving to a random yaw on a fixed pitch until npc.isOnScreen() returns true.

    Camera.keyboardRotateTo(random-yaw, fixed-pitch);

     

    Thank you, I'll try it that way. The reason I'm doing this is because the bot clicks on the npc through the wall when it's hidden (non-human like) and Pitch defaults to the lowest.

     

    is this correct? (replacing numbers as needed)

       if(npc != null) {
                    if(!npc.isOnScreen()) {
                        getCamera().keyboardRotateTo(Calculations.random(200,300), Calculations.random(100,300));

     

    Posted

    I have been messing around with writing a camera wrapper to help solve the clicking through walls or when the NPC is only slightly visible issue. Right now the wrapper is really complicated. I have a feeling I missed something. I am going to be going back over some docs later tonight and hopefully I will find a better solution. When I do end up making a good wrapper I will put it in the Dev/Scripting/Snippets forum.

    Posted

    Get the center of the Npc as a screen coord, get the yaw value, rotate to the npc yaw and static pitch you need.

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.