Custom Gachapon NPC, needed worldMessage help

Results 1 to 5 of 5
  1. #1
    Apprentice shingboyboy is offline
    MemberRank
    Dec 2016 Join Date
    21Posts

    Custom Gachapon NPC, needed worldMessage help

    I have made a successful custom gachapon NPC, but I wish it could show world message to everyone what the item get by the player, like regular gachapon NPC. But the worldmessage didn't work. Can anyone help me? Thank you very much!

    This is part of the script:

    } else if (status == 2) {
    cm.gainItem(5220000, -5);

    if (chance > 0 && chance <= 12) {
    cm.gainItem(icommon, 1);
    } else if (chance >= 13 && chance <= 14) {
    cm.gainItem(inormal, 1);
    } else {
    cm.gainItem(irare, 1);
    }
    cm.worldMessage(6, "[Gacha] Congratulations to " + cm.getChar().getName() + " on getting " + cm.gainItem() + "!");
    cm.dispose();
    }


  2. #2
    I'm overrated. Fraysa is offline
    MemberRank
    Apr 2008 Join Date
    4,891Posts

    Re: Custom Gachapon NPC, needed worldMessage help

    Quote Originally Posted by shingboyboy View Post
    But the worldmessage didn't work.
    We don't know what "didn't work" means. Does it execute properly? Does the method gets called? Can you post the method? Did you even try to debug your code by placing a breakpoint on that method before posting?

  3. #3
    Apprentice shingboyboy is offline
    MemberRank
    Dec 2016 Join Date
    21Posts

    Re: Custom Gachapon NPC, needed worldMessage help

    The NPC did give the item to the player, but it doesn't shows the notice about the player receive the item, it will shows a pop up of NPC not working. But if I use the worldmessage without getting the cm.gainItem it works.

    For example: Without cm.gainItem, it works.
    cm.worldMessage(6, "[Gacha] Congratulations to " + cm.getChar().getName() + " on getting an item from gachapon!");

    But I want it to shows what the item get.

  4. #4
    I'm overrated. Fraysa is offline
    MemberRank
    Apr 2008 Join Date
    4,891Posts

    Re: Custom Gachapon NPC, needed worldMessage help

    In your first part of the code you wrote:

    PHP Code:
    on getting " + cm.gainItem() 
    And on your second post you wrote:

    PHP Code:
    on getting an item from gachapon
    So that's why the second example works and the first doesn't. You can't use "cm.gainItem" to show the item name that has been rewarded. You have to store it by either making cm.gainItem return the item integer and then showing it or use whatever Odin offers. Or, simply write "getting an item from gachapon!".

  5. #5
    Apprentice shingboyboy is offline
    MemberRank
    Dec 2016 Join Date
    21Posts

    Re: Custom Gachapon NPC, needed worldMessage help

    Oh I get it, thanks :)



Advertisement