cm.giveBuff [NPC Command]

Junior Spellweaver
Joined
Apr 21, 2007
Messages
158
Reaction score
1
Alright.
This is made by someone from OdinMS Forums. :)


No credits for me. :D I remember the person that made this had a avatar that is from a anime that is animated and have someone spinning. XD Lmao.
If your the person tell me. Ill add your credits. :)

--------------------
Open NPCConversationManager.java

UNDER:
Code:
    public void setSkin(int color) {            
            getPlayer().setSkinColor(getPlayer().getSkinColor().getById(color));
            getPlayer().updateSingleStat(MapleStat.SKIN, color);
            getPlayer().equipChanged();
        }
ADD:
Code:
                public void giveBuff(int buff, int level) {
            SkillFactory.getSkill(buff).getEffect(level).applyTo(getPlayer());
        }
Save & Compile. If you don't know how to compile...
You Phail.

To use:
cm.giveBuff (1301007, 30);
cm.giveBuff (<skillid>, <skill level>);

DONE! :D
---------------------

Don't care about the thing in the code box. :)
Thats old. :D Just skip it. :X

Code:
The reason I put this here is because I need help with scripting meh Buff NPC. :)

The NPC script that is working but with bugs (Scroll down for bugs):
[code]
/*
    This file is part of the OdinMS Maple Story Server
    Copyright (C) 2008 Patrick Huy <[email protected]> 
                       Matthias Butz <[email protected]>
                       Jan Christian Meyer <[email protected]>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License version 3
    as published by the Free Software Foundation. You may not use, modify
    or distribute this program under any other version of the
    GNU Affero General Public License.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

function start() {
    cm.sendSimple ("Hello, would you like to be buff'ed? \r\nSelect which buff you want. \r\n#b#L0##s2311003#    Holy Symbol#l\r\n#L1##s4101004#    Haste#l\r\n#L2##s2301004#    Bless#l\r\n#L3##s2301002#    Heal#l\r\n#L4##s2301003#    Invinsble#l\r\n#L5##s2321000#    Maple Warrior#l\r\n#L6##s1005#    Echo of Hero#l\r\n#L7##s3221002#    Sharp Eyes#l\r\n#L8##s4001003#    Hide#l\r\n#L9##s2201001#    Meditation#l\r\n#L10##s2001003#    Magic Armor#l\r\n#L11##s1301006#    Iron Will#l\r\n#L12##s3001003#    Focus#l\r\n#L13##s1301007#    Hyper Body#l");
}

function action(mode, type, selection) {
    cm.dispose();
    if (selection == 0) {
        cm.sendSimple ("Enjoy your buff!");
        cm.giveBuff(2311003); // holy symbol

    } else if (selection == 1) {
        cm.sendSimple ("Enjoy your buff!");
        cm.giveBuff(4101004); //haste

    } else if (selection == 2) {
        cm.sendSimple ("Enjoy your buff!");
        cm.giveBuff(2301004); //bless

    } else if (selection == 3) {
        cm.sendSimple ("Enjoy your buff!");
        cm.giveBuff (2301002); //heal

    } else if (selection == 4) {
        cm.sendSimple ("Enjoy your buff!");
        cm.giveBuff (2301003); //invinsible

    } else if (selection == 5) {
        cm.sendSimple ("Enjoy your buff!");
        cm.giveBuff (2321000); // maple warrior

    } else if (selection == 6) {
        cm.sendSimple ("Enjoy your buff!");
        cm.giveBuff (1005); //echo of hero

    } else if (selection == 7) {
        cm.sendSimple ("Enjoy your buff!");
        cm.giveBuff (3221002); //sharp eyes

    } else if (selection == 8) {
        cm.sendSimple ("Enjoy your buff!");
        cm.giveBuff (4001003); //hide

    } else if (selection == 9) {
        cm.sendSimple ("Enjoy your buff!");
        cm.giveBuff (2201001); //meditation

    } else if (selection == 10) {
        cm.sendSimple ("Enjoy your buff!");
        cm.giveBuff (2001003); //magic armor

    } else if (selection == 11) {
        cm.sendSimple ("Enjoy your buff!");
        cm.giveBuff (1301006); //Iron Will

    } else if (selection == 12) {
        cm.sendSimple ("Enjoy your buff!");
        cm.giveBuff (3001003); //focus

    } else if (selection == 13) {
        cm.sendSimple ("Enjoy your buff!");
        cm.giveBuff (1301007); //Hyper body

    } else {
        cm.dispose();
    }
}
Bugs List:
1. I can't figure out how to set the buff skill level. :( So in the script above, all the buff skills are level 1. :D
2. Nothing else I could think off. :P

I'll be happy if someone could continue my script above. :)[/code]

For Buff NPC that is COMPLETED:
http://forum.ragezone.com/showthread.php?p=3877236#post3877236

Have fun~! :D

PS:
THE NPC COMMAND IS NOT MADE BY ME.
 
Last edited:
Re: [RELEASE] cm.giveBuff [NPC Command]

EDIT: nvm
someone send me npcconvertion manage i dont have a copy
 
Re: [RELEASE] cm.giveBuff [NPC Command]

Bugs List:
1. I can't figure out how to set the buff skill level. :( So in the script above, all the buff skills are level 1. :D
2. Nothing else I could think off. :P

I'll be happy if someone could continue my script above. :)

To set the buff skill level, change

PHP:
public void giveBuff(int buff) {
          SkillFactory.getSkill(buff).getEffect(1).applyTo(getPlayer());
}

to

PHP:
public void giveBuff(int buff, int level) {
          SkillFactory.getSkill(buff).getEffect(level).applyTo(getPlayer());
}

Then you could use

PHP:
cm.giveBuff(2311003, 30);

to give a level 30 hs (:

Note: This is similar to the !cast command from somewhere.
 
Re: [RELEASE] cm.giveBuff [NPC Command]

Hmm... Any ideas on how to make an NPC cast an ITEM buff?
If this is possible, we can make NPCs cast morphs or check if a player have morphs. It would be great!
 
Re: [RELEASE] cm.giveBuff [NPC Command]

is there a way to make all those keys into 1 key soo that a player can just click and get all the buffs also if i change the thingy to cm.giveBuff(2311003, 30); some skill wont work i think it is becuase the max skill level is below 30 causing it not to read?
 
Re: [RELEASE] cm.giveBuff [NPC Command]

is there a way to make all those keys into 1 key soo that a player can just click and get all the buffs?

Simply add as many cm.giveBuff (<your buff here>); to make an NPC give many buffs.

Example:

cm.giveBuff (1301007, 30);
cm.giveBuff (1301007, 30);
cm.giveBuff (1301007, 30);
 
Re: [RELEASE] cm.giveBuff [NPC Command]

is there a way to make all those keys into 1 key soo that a player can just click and get all the buffs also if i change the thingy to cm.giveBuff(2311003, 30); some skill wont work i think it is becuase the max skill level is below 30 causing it not to read?

Basically,

PHP:
cm.giveBuff(<skillID>, <skillLevel>);

So, you could use something like

PHP:
function start() {
    cm.sendYesNo("Hello, would you like to be buff'ed?");
}

function action(mode, type, selection) {
    if (mode == -1) {
        cm.dispose();
    } else {
        cm.giveBuff(2311003, 30); //Lvl 30 HS
        cm.giveBuff(5101004, 1); //Lvl 1 GM Hide
        cm.giveBuff(4111001, 20); //Lvl 20 Meso Up
        cm.dispose();
    }
}

to give more than one buff, with different levels. The first arguement is the skillID, and the second arguement is the skill level. It doesn't matter if the max skill level is below 30, because you can set the skill level.
 
Re: [RELEASE] cm.giveBuff [NPC Command]

Basically,

PHP:
cm.giveBuff(<skillID>, <skillLevel>);
So, you could use something like

PHP:
function start() {
    cm.sendYesNo("Hello, would you like to be buff'ed?");
}

function action(mode, type, selection) {
    if (mode == -1) {
        cm.dispose();
    } else {
        cm.giveBuff(2311003, 30); //Lvl 30 HS
        cm.giveBuff(5101004, 1); //Lvl 1 GM Hide
        cm.giveBuff(4111001, 20); //Lvl 20 Meso Up
        cm.dispose();
    }
}
to give more than one buff, with different levels. The first arguement is the skillID, and the second arguement is the skill level. It doesn't matter if the max skill level is below 30, because you can set the skill level.

thx alot~
 
Re: [RELEASE] cm.giveBuff [NPC Command]

How can you not have a copy of one? o.o
Then all your NPC's will be Ded.

im on vacation aka away from MY comp
I meant i dont have as version of the source

Nice anyway its done now
Also
This is great for boss maps
Put a npc in there with all buffs and your good
 
Re: [RELEASE] cm.giveBuff [NPC Command]

I'll be updating the first post and will make a better npc soon. :D
Just needa fix my source. o.o
its weird lately. :(
 
Re: [RELEASE] cm.giveBuff [NPC Command]

To set the buff skill level, change

PHP:
public void giveBuff(int buff) {
          SkillFactory.getSkill(buff).getEffect(1).applyTo(getPlayer());
}

to

PHP:
public void giveBuff(int buff, int level) {
          SkillFactory.getSkill(buff).getEffect(level).applyTo(getPlayer());
}

Then you could use

PHP:
cm.giveBuff(2311003, 30);

to give a level 30 hs (:

Note: This is similar to the !cast command from somewhere.

where to edit this thingy?
what java?
 
Re: [RELEASE] cm.giveBuff [NPC Command]

No credits for me. :D I remember the person that made this had a avatar that is from a anime that is animated and have someone spinning. XD Lmao.
If your the person tell me. Ill add your credits. :)

--------------------
Open NPCConversationManager.java

Edited my post. :)
Should be working now. :D
 
Back