Jump to content

Change trees according to level


Recommended Posts

Posted (edited)

Try something like this. You could continue to add this for each level if you wanted to. Just make a range between two numbers. 

  if (getSkills().getDynamic(Skill.WOODCUTTING) <15) {
                    ChopLogs;
                }
                
                if (getSkills().getDynamic(Skill.WOODCUTTING) >=15 && getSkills().getDynamic(Skill.WOODCUTTING) <30 ) {
                    ChopOaks;
                }

Edited by lg_juggles
Posted

 

Try something like this. You could continue to add this for each level if you wanted to. Just make a range between two numbers. 

  if (getSkills().getDynamic(Skill.WOODCUTTING) <15) {
                    ChopLogs;
                }
                
                if (getSkills().getDynamic(Skill.WOODCUTTING) >=15 && getSkills().getDynamic(Skill.WOODCUTTING) <30 ) {
                    ChopOaks;
                }

 

I have something very similar to this. Instead of making multiple Chop cases, I wanted to make one that changes a variable that represents the type of tree. The only thing I need to figure out is how to force my case DetermineTree to run when the script starts and again as the script runs.

 

Posted
enum Trees { 
    NORMAL(1, new Position(...)), OAK(15, new Position(...)), ... ;

    private int level;
    private Position location;

    TREES(int level, Position location) {
        this.level = level;
        this.location = location;
    }

    public static Trees getCurrent(Script script) {
        int c = script.getStatic(Skill.WOODCUTTING);
        if (c < 15) 
            return Trees.NORMAL;
        else if (c < 30)
            return Trees.OAK;
        else if (c < 45)
            return Trees.WILLOW;
        else if (c < 60)
            return Trees.MAPLE;
        else if (c < 75)
            retirm Trees.YEW;
        else if (c < 90)
            return Trees.MAGIC;
        else
            return Trees.REDWOOD;
    }
}

Trees current;

@Override
public void onStart() {
    current = Trees.getCurrent(this);
    ...
}

@Override
public int onLoop() {
    current = Trees.getCurrent(this);
    ...
    return 69;
}

When you are chopping a tree different from current, then its time to switch

  • Like 2
Posted

I have something very similar to this. Instead of making multiple Chop cases, I wanted to make one that changes a variable that represents the type of tree. The only thing I need to figure out is how to force my case DetermineTree to run when the script starts and again as the script runs.

 

Like Token said above it'll switch when its at its new level. 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...