Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Fixing NPCs?

Newbie Spellweaver
Joined
Aug 3, 2015
Messages
10
Reaction score
0
I'm using a repack of OdinMS v62 called ThePack (revision 82). So far everything is great but I really don't understand how to edit certain NPCs.

An example is Yoona (20100). I don't plan on having a Cash Shop in this server (just the items), so I would like to remove her quest involving the Beginner's Shopping Guide. I figured the way to do this is to write a custom script for her and put it in the scripts folder. When I do this, however, it doesn't run the custom script and just uses her default dialogue. I know how to remove the quest from the wizet files, and I also know that I can remove this NPC and create a new one and fully script it myself, but how do I edit it to do what I want without going through all that trouble?

Also, the quest doesn't even work. When the "accept" button is clicked the chat is terminated but the quest isn't started. Her other quest works fine, so I wanted to leave that one in and simply remove the other one. Mai has the same problem where only one of her quests works. I thought the only way to fix quests was to give the NPCs new scripts but I'm new to this so I really don't know.

Any help would be greatly appreciated!
 
Experienced Elementalist
Joined
Mar 12, 2015
Messages
238
Reaction score
43
I do not take any credit for finding/making this packet structure, but tbh, I lost the thread where I found this at.
1. Add this to the file called "MaplePacketCreator.java"
2. Then go to "PlayerLoggedInHandler.java" and at the bottom use this:
Code:
player.getClient().getSession().write(MaplePacketCreator.setNPCScriptable(npcid, "description"));
I forgot what the discription was for, but just fill in something.
Enjoy!

Code:
/**     * Makes any NPC in the game scriptable.
     *
     * [USER=2000183830]para[/USER]m npcId - The NPC's ID, found in WZ files/MCDB
     * [USER=2000183830]para[/USER]m description - If the NPC has quests, this will be the text of the
     * menu item
     * [USER=850422]return[/USER]
     */
    public static MaplePacket setNPCScriptable(int npcId, String description) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.SET_NPC_SCRIPTABLE.getValue());
        mplew.write(1); // following structure is repeated n times
        mplew.writeInt(npcId);
        mplew.writeMapleAsciiString(description);
        mplew.writeInt(0); // start time
        mplew.writeInt(Integer.MAX_VALUE); // end time
        return mplew.getPacket();
    }
 
Upvote 0
Newbie Spellweaver
Joined
Aug 3, 2015
Messages
10
Reaction score
0
Thanks. I've been trying to get this to work, but I can't figure out how to do it on v62. Does anyone know the op codes for v62?
 
Upvote 0
Newbie Spellweaver
Joined
Aug 3, 2015
Messages
10
Reaction score
0
Oh.. it's not there. I thought it would be possible to add it in myself but thinking about it now that seems kind of dumb. Is there any other way to do this or should I just use a newer source?
 
Upvote 0
Newbie Spellweaver
Joined
Aug 3, 2015
Messages
10
Reaction score
0
Thanks. I thought it wasn't available because it wasn't in my SendPacketOPcode.java by default. Sorry if this is a really nooby question, but I'm not entirely sure where to put the (0xC8). The other java files I've seen look different from mine.

This is what my SendPacketOpcode.java file looks like:

Code:
package net.sf.odinms.net;


import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;


public enum SendPacketOpcode implements WritableIntValueHolder {
    // GENERAL

    PING, // 0x11
    // LOGIN
    LOGIN_STATUS, // 1
    PIN_OPERATION, // 6
    SERVERLIST, // 0xa
    SERVERSTATUS, // 3
    SERVER_IP, // 0xc
    CHARLIST, // 0xb
    CHAR_NAME_RESPONSE, // 0xd
    RELOG_RESPONSE, // 0x16
    ADD_NEW_CHAR_ENTRY, // 0xe
    DELETE_CHAR_RESPONSE, // 0xf
    CHANNEL_SELECTED,
    ALL_CHARLIST,
    // CHANNEL
    CHANGE_CHANNEL, // 0x10
    UPDATE_STATS, // 0x1b
    FAME_RESPONSE,
    UPDATE_SKILLS, // 0x1e
    WARP_TO_MAP, // 0x49
    SERVERMESSAGE, // 0x37
    AVATAR_MEGA, // 0x42
    SPAWN_NPC, // 0xb1
    SPAWN_NPC_REQUEST_CONTROLLER, // 0xb3
    SPAWN_MONSTER, // 0x9E
    SPAWN_MONSTER_CONTROL, // 0xA0
    MOVE_MONSTER_RESPONSE, // 0xA3
    SPOUSECHAT,
    CHATTEXT, // 0x67
    SHOW_STATUS_INFO, // 0x21
    SHOW_MESO_GAIN, // 0x22
    SHOW_QUEST_COMPLETION, // 0x29
    WHISPER,
    SPAWN_PLAYER, // 0x64
    ANNOUNCE_PLAYER_SHOP, // 0x67
    SHOW_SCROLL_EFFECT, // 0x6B
    SHOW_ITEM_GAIN_INCHAT, // 0x92
    KILL_MONSTER, // 0x9f
    DROP_ITEM_FROM_MAPOBJECT, // 0xC1
    FACIAL_EXPRESSION, // 0x85
    MOVE_PLAYER, // 0x7E
    MOVE_MONSTER, // 0xA2
    CLOSE_RANGE_ATTACK, // 0x7F
    RANGED_ATTACK, // 0x80
    MAGIC_ATTACK, // 0x81
    OPEN_NPC_SHOP, // 0xe5
    CONFIRM_SHOP_TRANSACTION, // 0xe6
    OPEN_STORAGE, // 0xe8
    MODIFY_INVENTORY_ITEM, // 0x19
    REMOVE_PLAYER_FROM_MAP, // 0x65
    REMOVE_ITEM_FROM_MAP, // 0xC2
    UPDATE_CHAR_LOOK, // 0x88
    SHOW_FOREIGN_EFFECT, //0x89
    GIVE_FOREIGN_BUFF, //0x8A
    CANCEL_FOREIGN_BUFF, //0x8B
    DAMAGE_PLAYER, // 0x84
    CHAR_INFO, // 0x31
    UPDATE_QUEST_INFO, // 0x97
    GIVE_BUFF, //0x1c
    CANCEL_BUFF, //0x1d
    PLAYER_INTERACTION, // 0xEF
    UPDATE_CHAR_BOX, // 0x69
    NPC_TALK,
    KEYMAP,
    SHOW_MONSTER_HP,
    PARTY_OPERATION,
    UPDATE_PARTYMEMBER_HP,
    MULTICHAT,
    APPLY_MONSTER_STATUS,
    CANCEL_MONSTER_STATUS,
    CLOCK,
    SPAWN_PORTAL,
    SPAWN_DOOR,
    REMOVE_DOOR,
    SPAWN_SPECIAL_MAPOBJECT,
    REMOVE_SPECIAL_MAPOBJECT,
    SUMMON_ATTACK,
    MOVE_SUMMON,
    SPAWN_MIST,
    REMOVE_MIST,
    DAMAGE_SUMMON,
    DAMAGE_MONSTER,
    BUDDYLIST,
    SHOW_ITEM_EFFECT,
    SHOW_CHAIR,
    CANCEL_CHAIR,
    SKILL_EFFECT,
    CANCEL_SKILL_EFFECT,
    BOSS_ENV,
    REACTOR_SPAWN,
    REACTOR_HIT,
    REACTOR_DESTROY,
    MAP_EFFECT,
    GUILD_OPERATION,
    BBS_OPERATION,
    SHOW_MAGNET,
    MESSENGER,
    NPC_ACTION,
    SET_NPC_SCRIPTABLE, 
    SPAWN_PET,
    MOVE_PET,
    PET_CHAT,
    PET_COMMAND,
    PET_NAMECHANGE,
    COOLDOWN,
    PLAYER_HINT,
    USE_SKILL_BOOK,
    SHOW_EQUIP_EFFECT,
    SKILL_MACRO,
    CS_OPEN,
    CS_UPDATE,
    CS_OPERATION,
    PLAYER_NPC,
    SHOW_NOTES,
    SUMMON_SKILL,
    ARIANT_PQ_START,
    CATCH_MONSTER,
    ARIANT_SCOREBOARD,
    ZAKUM_SHRINE,
    BOAT_EFFECT,
    CHALKBOARD, SEND_TV, REMOVE_TV, ENABLE_TV,
    DUEY,
    UPDATE_MOUNT, MTS_OPEN,
    MTS_OPERATION,
    MTS_OPERATION2,
    GET_MTS_TOKENS,
    TROCK_LOCATIONS,
    MONSTER_CARNIVAL_START,
    MONSTER_CARNIVAL_OBTAINED_CP,
    MONSTER_CARNIVAL_PARTY_CP,
    MONSTER_CARNIVAL_SUMMON,
    MONSTER_CARNIVAL_DIED;
    private int code = -2;


    public void setValue(int code) {
        this.code = code;
    }


    @Override
    public int getValue() {
        return code;
    }


    public static Properties getDefaultProperties() throws FileNotFoundException, IOException {
        Properties props = new Properties();
        FileInputStream fileInputStream = new FileInputStream(System.getProperty("net.sf.odinms.sendops"));
        props.load(fileInputStream);
        fileInputStream.close();
        return props;
    }




    static {
        try {
            ExternalCodeTableGetter.populateValues(getDefaultProperties(), values());
        } catch (IOException e) {
            throw new RuntimeException("Failed to load sendops", e);
        }
    }
}

I apologize for posting so much, I'm really new to this. Thanks to everyone that helped so far.
 
Upvote 0
Newbie Spellweaver
Joined
Aug 3, 2015
Messages
10
Reaction score
0
Oh I didn't realize there was a properties file, that makes a lot more sense! Thanks a lot for all your help, I'll test that right now.

Edit: Hmm.. after adding that the game crashes and I get: "error code: -2147287038 (Unknown error 0x80030002). Do I have to edit the recvops.java / recvops.properties as well?
 
Last edited:
Upvote 0
Experienced Elementalist
Joined
Mar 12, 2015
Messages
238
Reaction score
43
woops, i thought this was v83
dont know whats the cause of the error, you dont need to add it to recv
 
Upvote 0
Experienced Elementalist
Joined
Mar 28, 2015
Messages
237
Reaction score
69
That packet will not remove quests. As is stated in the javadocs, it will only alter the NPC's text. There's, to my knowledge, no easy way to remove the quests from appearing server-sided, the one way that comes to mind would be to prevent the loading of quests in the map. In my opinion the by far easier and cleaner way is to .wz edit out the quests. As for the quests you mentioned you couldn't start, nexon added the requirement of wearing Wizet (GM) clothing to start some quests, especially on Maple Island, I believe Mai's training was one of them. They could also be scripted quests, but I don't think that's the case here. Another possibility is that some quest actions aren't coded, but since I'm not familiar with ThePack I wouldn't know.
 
Upvote 0
Newbie Spellweaver
Joined
Aug 3, 2015
Messages
10
Reaction score
0
Thanks, you're right. For some strange reason there's the requirement of having a "Wizet Plain Suit" in your inventory. You can't even be wearing it, it has to be in your inventory. After a lot of clicking in my Quest.wz I finally found all of her quest ids:

1022 - Lucas' Cute Daughter
1039 - Helping Out Yoona
8020 ~ 8025 - Yoona's Quiz on Shopping

I thought the NPC itself was broken but didn't realize it was actually the requirement you mentioned. Now I can just do some wizet edits to make her do what I want. I didn't realize before but you can also change her default dialogue in the String.wz (what she says every time you talk to her, regardless of if she has a quest available or not).

Anyway that information helped a lot. I would still appreciate if anyone could provide a method to script NPCs like this, but it's no longer as big of an issue.

Edit: Apparently whenever I try to make any change to the Quest.wz file at all it corrupts after saving and the game will crash if I try to use it (even a really small change like changing the exp reward a quest gives). Does anyone know why this happens? I'm using HaRepacker.

Edit again: Never mind, the method posted here seems to work.
 
Last edited:
Upvote 0
Back
Top