Subtle GMS-likeness

Results 1 to 6 of 6
  1. #1
    :l Cygnus is offline
    MemberRank
    Mar 2015 Join Date
    f425Location
    237Posts

    config Subtle GMS-likeness

    The key to a nostalgic gms-like experience in my opinion lies mostly in subtle details, here are some common ones that I find most nostalgic servers are lacking.

    Scripted Portal SFX
    When entering scripted portals, by default there's no portal sound played, to play the sound you need to send a packet to the player. In v62, the packet is showSpecialEffect(7) (showSpecialEffect is the commonly used name for the packet in odinms, yours might differ), if you're using a different version, yours might differ, just play around with the value and you should find it +- 3. Now, to access the packet in your portal script, you need to make a script method, you can either place it in AbstractPlayerInteraction if you believe you'll use it for NPC's too (this is useful if you have a portal that opens an NPC prompt, you can then use cm.playPortalSound();) or just place it in your PortalPlayerInteraction if you're more likely to only use it for portals.
    Code:
    public void playPortalSound() {
       c.getSession().write(MaplePacketCreator.showSpecialEffect(7));
    }
    Now to call the method, simply call pi.playPortalSound(); in your portal script

    Random Spawnpoints
    In gms, at least for lower versions, when taking the Victoria Island Cab, you'd be warped to a random point in the map, most cab scripts by default do not randomize the spawnpoint, and you'll always be warped to the exact same spot. To properly get a random spawnpoint, we need a method that shuffles the available spawnpoints in the destination map and returns it. Some sources already have a method to do this in MapleMap.java, but when I was adding this to v.62, xiuzsource did not. If you don't have it already, insert this in MapleMap.java
    Spoiler:
    Code:
        public MaplePortal getRandomSpawnpoint() {        List<MaplePortal> spawnPoints = new ArrayList<MaplePortal>();
            for (MaplePortal portal : portals.values()) {
                if (portal.getType() >= 0 && portal.getType() <= 2) {
                    spawnPoints.add(portal);
                }
            }
            MaplePortal portal = spawnPoints.get(new Random().nextInt(spawnPoints.size()));
            return portal != null ? portal : getPortal(0);
        }

    Now, to call this method, you can either do it like this
    Code:
    cm.getPlayer().changeMap(maps[destination], cm.getClient().getChannelServer().getMapFactory().getMap(maps[destination]).getRandomSpawnpoint());
    but as you can see, it's quite the mouthful for every time you want to call it, so I prefer to add a method so that we can call it through
    Code:
    cm.warpRandomSpawnpoint(maps[destination]);
    to do so, we add a method in npcconversationmanager.java
    Code:
    public void warpRandomSpawnpoint(int id) {
      c.getPlayer().changeMap(id,getClient().getChannelServer().getMapFactory().getMap(id).getRandomSpawnpoint());
    }
    GMS-like Teleport Rocks
    This one is a bit too long to give a proper explanation, but to break it down; I found that teleport rocks weren't working properly, Normal Teleport rocks could be used to travel cross-continent (not gms-like), there were also some issues with VIP rocks iirc. This is based on Moople's telerocks (which weren't working properly) but adjusted for v62, you can easily make it work for v83.
    Spoiler:
    Code:
                    case 504: // vip teleport rock
                        boolean vip = slea.readByte() == 1;
                        boolean success = false;
                        String error = "Either the player could not be found or you were trying to teleport to an illegal location.";
                        if (!vip) {
                            int mapId = slea.readInt();
                            int targetMap = mapId;
                            MapleMap target = c.getChannelServer().getMapFactory().getMap(mapId);
                            MaplePortal spawnPoint = target.getRandomSpawnpoint();
                            if (target.getForcedReturnId() == 999999999) {
                                if (itemId == 5041000 || player.getMapId() / 100000000 == targetMap / 100000000) { 
                                remove(c, itemId);
                                c.getPlayer().changeMap(target, spawnPoint);
                                } else {
                                    c.getPlayer().dropMessage(1, error);
                                }
                            } else {
                                c.getPlayer().dropMessage(1, error);
                                c.getSession().write(MaplePacketCreator.enableActions());
                            }
                        } else {
                            String name = slea.readMapleAsciiString();
                            MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(name);
                            if (victim != null) {
                                MapleMap target = victim.getMap();
                                if (c.getChannelServer().getMapFactory().getMap(victim.getMapId()).getForcedReturnId() == 999999999 && (victim.getMapId() >= 100000000 && victim.getMapId() < 900000000)) {
                                    if (victim.isGM() == false) {
                                        if (itemId == 5041000 || player.getMapId() / 100000000 == victim.getMapId() / 100000000) { //Only allow VIP to cross continent
                                            if (victim.getMap() != player.getMap()) {
                                            remove(c, itemId);
                                            c.getPlayer().changeMap(target, target.findClosestSpawnpoint(victim.getPosition()));
                                            success = true;
                                            } else {
                                                c.getPlayer().dropMessage(1, "It's the map you're currently on.");
                                            }                     
                                        } else {
                                            c.getPlayer().dropMessage(1, error);
                                        }
                                    } else {
                                        c.getPlayer().dropMessage(1, error);
                                    }
                                } else {
                                    c.getPlayer().dropMessage(1, "You cannot teleport to this map.");
                                }
                            } else {
                                c.getPlayer().dropMessage(1, "Player could not be found in this channel.");
                            }
                            if (!success) {
                                c.getSession().write(MaplePacketCreator.enableActions());
                            }
                        }
                        break;
    Last edited by Cygnus; 24-07-15 at 06:25 PM.


  2. #2
    Moderator Eric is offline
    ModeratorRank
    Jan 2010 Join Date
    DEV CityLocation
    3,188Posts

    Re: Subtle GMS-likeness

    I actually never knew about the random spawnpoint until I was copying BMS. I guess I never really paid much attention back then though xD

    Nonetheless, Nice job. +1 for more GMS-like ;p

  3. #3
    (O_o(o_O(O_O)o_O)O_o) Novak is offline
    MemberRank
    Apr 2009 Join Date
    The NetherlandsLocation
    1,120Posts

    Re: Subtle GMS-likeness

    Is it all scripted portals that are supposed to play that sound? If so you might as well send it in the scripted portal handler, so that you don't have go through all of your scripts.

    Great release!

  4. #4
    :l Cygnus is offline
    MemberRank
    Mar 2015 Join Date
    f425Location
    237Posts

    Re: Subtle GMS-likeness

    Quote Originally Posted by chunkarama View Post
    I actually never knew about the random spawnpoint until I was copying BMS. I guess I never really paid much attention back then though xD
    I didn't remember from personal recollection either, don't worry :^)

    Quote Originally Posted by Novak View Post
    Is it all scripted portals that are supposed to play that sound? If so you might as well send it in the scripted portal handler, so that you don't have go through all of your scripts.

    Great release!
    The problem with doing so is that some scripted portals will only let you through if certain conditions are met, ie. Party Quest portals are locked until you clear the stage.
    Thanks

  5. #5
    (O_o(o_O(O_O)o_O)O_o) Novak is offline
    MemberRank
    Apr 2009 Join Date
    The NetherlandsLocation
    1,120Posts

    Re: Subtle GMS-likeness

    Quote Originally Posted by Cygnus View Post
    The problem with doing so is that some scripted portals will only let you through if certain conditions are met, ie. Party Quest portals are locked until you clear the stage.
    Thanks
    Ah yeah ofcourse, silly me :p

    EDIT:

    Hold on, maybe jam it into the pi.warpmap function? xD anyways, I might check that later. I suppose it's clear by now I'm too lazy to edit all scripts :x

  6. #6
    :l Cygnus is offline
    MemberRank
    Mar 2015 Join Date
    f425Location
    237Posts

    Re: Subtle GMS-likeness

    Quote Originally Posted by Novak View Post
    Ah yeah ofcourse, silly me :p

    EDIT:

    Hold on, maybe jam it into the pi.warpmap function? xD anyways, I might check that later. I suppose it's clear by now I'm too lazy to edit all scripts :x
    That should work if you override the warp method in PortalPlayerInteraction, not a bad idea :P



Advertisement