maplesolaxia fishing system

Results 1 to 10 of 10
  1. #1
    Account Upgraded | Title Enabled! super861 is offline
    MemberRank
    Oct 2009 Join Date
    229Posts

    maplesolaxia fishing system

    hello,

    I'm trying to implement a fishing system on my mapleSolaxia source. I came across this thread and figured it was worth a shot. I've implemented most of the things and fixed the errors it gave (mostly wrong refferences beceause it was made for a different source i would guess). What i can't figure out though is the part i have to implement in the channelserver.
    i figured i had edit the net.server.server.java, so i went there. i tried adding it under the tMAn.register inside the run method. that didn't work at all so i changed some things around and added this underneath it:
    Code:
            try {
                for(Channel ch : getChannelsFromWorld(0)) {
                    for(MapleCharacter player : ch.getPlayerStorage().getAllCharacters()) {
                        if(player.isFishing && player.getMapId() == 970020000) {
                            server.Fishing.doFishing(player);
                        }
                    } 
                }
            }
            catch(Exception e) {
                System.out.println("somethingsomething error");
                e.printStackTrace();//For those who get errors
                System.exit(0);
            }
    now, however i can't even start the server anymore, so it obviously does not work.
    Could anyone point out where i went wrong and what i could try to fix this?

    note: i know its inefficient to do it like this, beceause it'll keep checking all players, which could cause too much memory usage. I'm just setting it up for me and a few friends, so for now that's not much of an issue for me. If i get this working ill eventually just try to fix that.

    if anyone could help me out, thank you!


  2. #2
    Account Upgraded | Title Enabled! Las Systos is offline
    MemberRank
    Mar 2015 Join Date
    NetherlandsLocation
    238Posts

    Re: maplesolaxia fishing system

    the run method in Server.java automatically starts when the you start the server, the piece of code you added gets all players from every channel and does something to them, but you are just starting the servers, meaning there will be no players online.
    Server.run() will only get activated once, so the place of your code is wrong to begin with.
    Altho I can think of no reason why this would stop ur server from starting, do you get any errors?

    Edit: I'm not fammiliar with 'fishing system'

  3. #3
    Account Upgraded | Title Enabled! super861 is offline
    MemberRank
    Oct 2009 Join Date
    229Posts

    Re: maplesolaxia fishing system

    Quote Originally Posted by Las Systos View Post
    the run method in Server.java automatically starts when the you start the server, the piece of code you added gets all players from every channel and does something to them, but you are just starting the servers, meaning there will be no players online.
    Server.run() will only get activated once, so the place of your code is wrong to begin with.
    Altho I can think of no reason why this would stop ur server from starting, do you get any errors?

    Edit: I'm not fammiliar with 'fishing system'
    fair enough, that makes sense. I get an outofboundsexception btw, but it's probably beceause it's the wrong place for it then. Weird that the person who made the system put it there to begin with.

    If i wanted to continously check if a person would be, say, on a chair and in a certain map and if so, run a function to make him fish. where would i have to code this in?

  4. #4
    Valued Member Exonaut is offline
    MemberRank
    Sep 2012 Join Date
    USALocation
    147Posts

    Re: maplesolaxia fishing system

    Post your entire main method from net.server.Server so we can see where you placed the call and if you accidentally removed something important.
    Last edited by Exonaut; 29-06-17 at 01:33 AM.

  5. #5
    Account Upgraded | Title Enabled! Las Systos is offline
    MemberRank
    Mar 2015 Join Date
    NetherlandsLocation
    238Posts

    Re: maplesolaxia fishing system

    If i were making it, i would put it in the same place as where u take mapdamage, like in aquarium and elnath, which is in MapleCharacter somewhere. Pretty sure its in a changemap method, but not 100%

  6. #6
    Account Upgraded | Title Enabled! super861 is offline
    MemberRank
    Oct 2009 Join Date
    229Posts

    Re: maplesolaxia fishing system

    Quote Originally Posted by Exonaut View Post
    Post your entire main method from net.server.Server so we can see where you placed the call and if you accidentally removed something important.
    oh i didn't remove anything, i just tried to implenent it like the OP mentioned in the thread i linked. when that didn't worked i tried some other stuff there, but couldn't figure out how to properly do it. i just took the code out and the server works fine. Now i just need to think of another way to get a working system for fishing.

    Quote Originally Posted by Las Systos View Post
    If i were making it, i would put it in the same place as where u take mapdamage, like in aquarium and elnath, which is in MapleCharacter somewhere. Pretty sure its in a changemap method, but not 100%
    Okay thanks ill see if i can mess around there. basicly what i want is a check, that looks if player is sitting on X chair while in map Y, if so, excecute fishing fuction for player. what i was trying to do was make a loop that keeps checking all players online in all channels, if that returns true, player.fishing() (or whatever my fishing function was called).

    from what i understood about what OP in that thread was trying to do, was using the timemanager function when the server started to start a continous check every X interval. but for me it just keeps givings errors whenever i try to do something with that. (I understand the errors and why it doesn't work, i just don't know how to do something that would).

  7. #7
    Account Upgraded | Title Enabled! super861 is offline
    MemberRank
    Oct 2009 Join Date
    229Posts

    Re: maplesolaxia fishing system

    so i decided to do this differently, however i'm getting another issue now. Could you guys see if you can help me out? i made a new thread for it.
    http://forum.ragezone.com/f566/issue...4/#post8801652

  8. #8
    Account Upgraded | Title Enabled! Las Systos is offline
    MemberRank
    Mar 2015 Join Date
    NetherlandsLocation
    238Posts

    Re: maplesolaxia fishing system

    this is all maplecharacter

    add this global variable:
    Code:
    private ScheduledFuture<?> fishTask;
    add this in "changeMapInternal" method (around the place where the damage dealing is also done)
    Code:
    if (mapid == 0) { // replace 0 with ur fish map id
        fishTask = TimerManager.getInstance().schedule(this::fishStuff, 5000); // time in milliseconds
    }
    add this method anywhere
    Code:
    private void fishStuff() {    
        if (getChair() == 1) { // I believe this checks if the player is sitting, altho I'm not sure
            // add fishing code
        }
        fishTask = TimerManager.getInstance().schedule(this::fishStuff, 5000);
    }
    now go to the leaveMap method, add a simmilar check that 'hpDecreaseTask' has but for 'fishTask'
    and then again the same story for the "empty(final boolean remove)" method

    I hope you can use your own logic to add the fishing code that u want

  9. #9
    Valued Member Exonaut is offline
    MemberRank
    Sep 2012 Join Date
    USALocation
    147Posts

    Re: maplesolaxia fishing system

    Quote Originally Posted by Las Systos View Post
    this is all maplecharacter

    add this global variable:
    Code:
    private ScheduledFuture<?> fishTask;
    add this in "changeMapInternal" method (around the place where the damage dealing is also done)
    Code:
    if (mapid == 0) { // replace 0 with ur fish map id
        fishTask = TimerManager.getInstance().schedule(this::fishStuff, 5000); // time in milliseconds
    }
    add this method anywhere
    Code:
    private void fishStuff() {    
        if (getChair() == 1) { // I believe this checks if the player is sitting, altho I'm not sure
            // add fishing code
        }
        fishTask = TimerManager.getInstance().schedule(this::fishStuff, 5000);
    }
    now go to the leaveMap method, add a simmilar check that 'hpDecreaseTask' has but for 'fishTask'
    and then again the same story for the "empty(final boolean remove)" method

    I hope you can use your own logic to add the fishing code that u want
    The original thread he is taking this system from uses the chair handlers which I believe is a better method then adding this whenever someone enters the fishing map as they may not fish and this can quickly become a bottleneck with a larger playerbase. The original thread simply checks for the fishing map and an item which can both be changed as OP wants and I believe he wants the system to be only when people are in chairs as a sort of afk/idle game. Check out the post I gave him in his second thread: http://forum.ragezone.com/f566/issue...4/#post8801724

  10. #10
    Account Upgraded | Title Enabled! super861 is offline
    MemberRank
    Oct 2009 Join Date
    229Posts

    Re: maplesolaxia fishing system

    Quote Originally Posted by Las Systos View Post
    this is all maplecharacter

    add this global variable:
    Code:
    private ScheduledFuture<?> fishTask;
    add this in "changeMapInternal" method (around the place where the damage dealing is also done)
    Code:
    if (mapid == 0) { // replace 0 with ur fish map id
        fishTask = TimerManager.getInstance().schedule(this::fishStuff, 5000); // time in milliseconds
    }
    add this method anywhere
    Code:
    private void fishStuff() {    
        if (getChair() == 1) { // I believe this checks if the player is sitting, altho I'm not sure
            // add fishing code
        }
        fishTask = TimerManager.getInstance().schedule(this::fishStuff, 5000);
    }
    now go to the leaveMap method, add a simmilar check that 'hpDecreaseTask' has but for 'fishTask'
    and then again the same story for the "empty(final boolean remove)" method

    I hope you can use your own logic to add the fishing code that u want
    ah thanks, i'll keep that in mind for future use. It could server as a neat feature in a pq for example or a more advanced fishing system later on!
    for now i went with what exonaut explaind.

    Now the fishing method starts when a player sits on a chair that equals a fishing chair and stops whenever the player goes off the chair, has a full inventory or goes out the map (i had some fun exploits with this). It seems to be working fine for now, but i'm sure more bugs will popup as i test it haha



Advertisement