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
  • Need some help with my script


    Jordan2310

    Recommended Posts

    Hi I am new at writing scripts trying to learn I have write a basic goblin script that just attacks goblins but I won’t to 1 set up a level cap so like when it has 10 attack Strength and defence I want it to change to a different NPC how to I put it into Code formAnd where would I put it in the codeAnd I wanted to swap from attack to strength to defence so we can level each one

    Link to comment
    Share on other sites

    Hi,

    I'd advise that you learn Java first then learn the DreamBot API.

    But for what you asked for..

    For NPC Level Switches:

    if(getSkills.getRealLevel(Skill.ATTACK) >= 10) {
      goblin code here
    } else if(getSkills.getRealLevel(Skill.ATTACK) >= 20) {
      other npc code here
    } 
    etc..
      
    

    For Combat Style Switches:

    Use PlayerSettings, I think the config is 46.. not sure

    Here is a well made snippet for that made by @Infidel <3 

     

    I hope this helps!

    Link to comment
    Share on other sites

    2 hours ago, Defiled said:

    Hi,

    I'd advise that you learn Java first then learn the DreamBot API.

    But for what you asked for..

    For NPC Level Switches:

    
    if(getSkills.getRealLevel(Skill.ATTACK) >= 10) {
      goblin code here
    } else if(getSkills.getRealLevel(Skill.ATTACK) >= 20) {
      other npc code here
    } 
    etc..
      
    

    For Combat Style Switches:

    Use PlayerSettings, I think the config is 46.. not sure

    Here is a well made snippet for that made by @Infidel <3 

     

    I hope this helps!

    Thanks you so much for your help just got to find out where I put this I’m my script and there is no good tutorial out there for all this kind of stuff anymore 

    Link to comment
    Share on other sites

    6 hours ago, Jordan2310 said:

    Thanks you so much for your help just got to find out where I put this I’m my script and there is no good tutorial out there for all this kind of stuff anymore 

    9 hours ago, Defiled said:

    Hi,

    I'd advise that you learn Java first then learn the DreamBot API.

    But for what you asked for..

    For NPC Level Switches:

    
    
    if(getSkills.getRealLevel(Skill.ATTACK) >= 10) {
      goblin code here
    } else if(getSkills.getRealLevel(Skill.ATTACK) >= 20) {
      other npc code here
    } 
    etc..
      
    

    For Combat Style Switches:

    Use PlayerSettings, I think the config is 46.. not sure

    Here is a well made snippet for that made by @Infidel <3 

     

    I hope this helps!

    Where would I put the code in my script and when you say goblin code here what code would that be sorry to be a pain 

    Link to comment
    Share on other sites

    2 hours ago, Jordan2310 said:

     

    That code is an example for what you should do, that isn't something you can copy paste.. But..

    goblin code is the code for the goblin killer..

    And yes.. there isn't a lot of tutorials on scripting in terms of the API but there is a ton of Java Tutorials online.. I suggest that you learn Java before attempting to script then learn the API

     

    getSkills().getRealLevel(Skill.SKILLNAME) <-- That gets the REAL level of the Skill (without any boosts)

    so you can just put that in an if statement and go nuts 

    Link to comment
    Share on other sites

    1 hour ago, Defiled said:

    That code is an example for what you should do, that isn't something you can copy paste.. But..

    goblin code is the code for the goblin killer..

    And yes.. there isn't a lot of tutorials on scripting in terms of the API but there is a ton of Java Tutorials online.. I suggest that you learn Java before attempting to script then learn the API

     

    getSkills().getRealLevel(Skill.SKILLNAME) <-- That gets the REAL level of the Skill (without any boosts)

    so you can just put that in an if statement and go nuts 

    You definitely know your stuff thanks for all the help I’m going to learn java first like you said that should give me more of a understanding of what I need to do 

     

    Link to comment
    Share on other sites

    2 minutes ago, Jordan2310 said:

    You definitely know your stuff thanks for all the help I’m going to learn java first like you said that should give me more of a understanding of what I need to do 

     

    Thank you :) That's so nice of you to say! 

    and yes, you should know Java before entering into scripting.. makes your life way easier..

    Link to comment
    Share on other sites

    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.