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!

NPC Heal

Joined
May 7, 2010
Messages
83
Reaction score
9
I'm trying to figure out if there's a command for NPC that heals your HP and/or MP. I've searched for it, but no luck..
 
Custom Title Activated
Member
Joined
Mar 6, 2012
Messages
1,503
Reaction score
213
Make it then... Why so noob. The simpliest poop ever.......
 
Upvote 0
Junior Spellweaver
Joined
Oct 12, 2012
Messages
137
Reaction score
6
Make it then... Why so noob. The simpliest poop ever.......

WHY Y U NO HINT HIM TO RIGHT DIRECTION THEN? HMMMMM? WHY Y HAVE TO BE penis? HMMMMMMM?

Back to CombatxHacker, I actually am interested in knowing myself. This idea can be usefull for many things.
 
Upvote 0
Initiate Mage
Joined
Dec 13, 2012
Messages
26
Reaction score
0
Hmm... I'm busy with other projects atm so I don't feel like looking into it. But I had a thought, is that NPC on beginner island still there that damages your health? You might look at how he's scripted to get a clue. Obviously your trying to add health not take it away, but still might get you in the right direction.

Also, you regain hp and mp on leveling up, so maybe looking at the source code for that would have a good hint?
 
Upvote 0
至死不渝
Joined
Dec 31, 2008
Messages
454
Reaction score
33
Add a function to npcconversationmanager such as "healhp" and then use the methods used for !heal for that function... Then use the function in ur npc script.
 
Upvote 0
Custom Title Activated
Member
Joined
Mar 6, 2012
Messages
1,503
Reaction score
213
cm.getPlayer().setHp(cm.getPlayer().getMaxHp());
Something like that. Check your source. Noobs...
 
Upvote 0
Custom Title Activated
Member
Joined
Nov 14, 2008
Messages
1,025
Reaction score
640
cm.getPlayer().setHp(cm.getPlayer().getMaxHp());
Something like that. Check your source. Noobs...

i wouldn't talk if i were u

anyway, assuming you use moopledev
PHP:
cm.getPlayer().addHP(delta);

where delta is the hp to add
with simple maths, we can find out how much hp is needed until the player is full:

PHP:
var delta = cm.getPlayer().getMaxHp() - cm.getPlayer().getHp();

again, i have never healed the player on purpose but it should work.
 
Upvote 0
Custom Title Activated
Member
Joined
Mar 6, 2012
Messages
1,503
Reaction score
213
What's the point of that delta? Useless much? You can just getmaxhp n heal. Why subtract n all that extra crap? Why shouldn't I be talking? I haven't looked into a source for a pretty long time. Only difference was you put add and I put set.
 
Upvote 0
Joined
May 7, 2010
Messages
83
Reaction score
9
i wouldn't talk if i were u

anyway, assuming you use moopledev
PHP:
cm.getPlayer().addHP(delta);

where delta is the hp to add
with simple maths, we can find out how much hp is needed until the player is full:

PHP:
var delta = cm.getPlayer().getMaxHp() - cm.getPlayer().getHp();

again, i have never healed the player on purpose but it should work.

I'm using Orpheus, which is a repack based off of Moople. Anywho, I get a bat error.

Code:
javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: Ref
erenceError: "cm" is not defined. (<Unknown source>#6) in <Unknown source> at li
ne number 6
        at com.sun.script.javascript.RhinoScriptEngine.eval(Unknown Source)
        at javax.script.AbstractScriptEngine.eval(Unknown Source)
        at scripting.AbstractScriptManager.getInvocable(AbstractScriptManager.ja
va:59)
        at scripting.npc.NPCScriptManager.start(NPCScriptManager.java:59)
        at net.server.handlers.channel.NPCTalkHandler.handlePacket(NPCTalkHandle
r.java:54)
        at net.MapleServerHandler.messageReceived(MapleServerHandler.java:128)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.mess
ageReceived(DefaultIoFilterChain.java:716)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessage
Received(DefaultIoFilterChain.java:434)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(Def
aultIoFilterChain.java:46)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.mes
sageReceived(DefaultIoFilterChain.java:796)
        at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutpu
tImpl.flush(ProtocolCodecFilter.java:427)
        at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(Prot
ocolCodecFilter.java:245)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessage
Received(DefaultIoFilterChain.java:434)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(Def
aultIoFilterChain.java:46)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.mes
sageReceived(DefaultIoFilterChain.java:796)
        at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFi
lterAdapter.java:119)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessage
Received(DefaultIoFilterChain.java:434)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageRece
ived(DefaultIoFilterChain.java:426)
        at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(Abstract
PollingIoProcessor.java:715)
        at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(Abstr
actPollingIoProcessor.java:668)
        at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(Abstr
actPollingIoProcessor.java:657)
        at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(Ab
stractPollingIoProcessor.java:68)
        at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run
(AbstractPollingIoProcessor.java:1141)
        at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnabl
e.java:64)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

This is what is on line 6:

PHP:
var delta = cm.getPlayer().getMaxHp() - cm.getPlayer().getHp();

I assume you can't use cm in a variable..
 
Upvote 0
Custom Title Activated
Member
Joined
Nov 14, 2008
Messages
1,025
Reaction score
640
I'm using Orpheus, which is a repack based off of Moople. Anywho, I get a bat error.

Code:
javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: Ref
erenceError: "cm" is not defined. (<Unknown source>#6) in <Unknown source> at li
ne number 6
        at com.sun.script.javascript.RhinoScriptEngine.eval(Unknown Source)
        at javax.script.AbstractScriptEngine.eval(Unknown Source)
        at scripting.AbstractScriptManager.getInvocable(AbstractScriptManager.ja
va:59)
        at scripting.npc.NPCScriptManager.start(NPCScriptManager.java:59)
        at net.server.handlers.channel.NPCTalkHandler.handlePacket(NPCTalkHandle
r.java:54)
        at net.MapleServerHandler.messageReceived(MapleServerHandler.java:128)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.mess
ageReceived(DefaultIoFilterChain.java:716)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessage
Received(DefaultIoFilterChain.java:434)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(Def
aultIoFilterChain.java:46)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.mes
sageReceived(DefaultIoFilterChain.java:796)
        at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutpu
tImpl.flush(ProtocolCodecFilter.java:427)
        at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(Prot
ocolCodecFilter.java:245)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessage
Received(DefaultIoFilterChain.java:434)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(Def
aultIoFilterChain.java:46)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.mes
sageReceived(DefaultIoFilterChain.java:796)
        at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFi
lterAdapter.java:119)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessage
Received(DefaultIoFilterChain.java:434)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageRece
ived(DefaultIoFilterChain.java:426)
        at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(Abstract
PollingIoProcessor.java:715)
        at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(Abstr
actPollingIoProcessor.java:668)
        at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(Abstr
actPollingIoProcessor.java:657)
        at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(Ab
stractPollingIoProcessor.java:68)
        at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run
(AbstractPollingIoProcessor.java:1141)
        at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnabl
e.java:64)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

This is what is on line 6:

PHP:
var delta = cm.getPlayer().getMaxHp() - cm.getPlayer().getHp();

I assume you can't use cm in a variable..

First, you can although it has to be inside the function, so make sure it is. Next, if it is indeed inside the function, check inside your source if the methods are named like that.

@TiredGuy The delta variable is the remaining HP for max. If you add 30k hp and the player has 15k HP already, then it'll be 45k. Of course, by setting to the max HP it will work just fine aswell. No point in being so aggressive neither. We have all been noobs before, and you are no exception.
 
Upvote 0
Custom Title Activated
Member
Joined
Mar 6, 2012
Messages
1,503
Reaction score
213
First, you can although it has to be inside the function, so make sure it is. Next, if it is indeed inside the function, check inside your source if the methods are named like that.

@TiredGuy The delta variable is the remaining HP for max. If you add 30k hp and the player has 15k HP already, then it'll be 45k. Of course, by setting to the max HP it will work just fine aswell. No point in being so aggressive neither. We have all been noobs before, and you are no exception.

Yah I noticed cause my source I use setHp and not add soiI was thinking the opposite.
 
Upvote 0
Back
Top