Jump to content

Change trees according to level


Rhetoric

Recommended Posts

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
Link to comment
Share on other sites

 

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.

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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