Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Healing Players (https://forums.graalonline.com/forums/showthread.php?t=52219)

internetexplorer 04-11-2004 02:00 AM

Healing Players
 
I'm making some type of healing NPC,
and it's suppose to heal the player no matter
what AP they might have.
Hopefully someone will find this and help me. :grin:

NPC Code:
if (actionserverside) {
if (strequals(#p(0),heal)) {
with (getplayer(#p(1))) {
if (playerap <= 39) {
playerap += 40;
playerhearts = playerfullhearts;
playerap -= 40;
} else {
playerhearts = playerfullhearts;
}
}
}
}
//#CLIENTSIDE
if (playerchats) {
if (startswith(/heal,#c)) {
triggeraction 0,0,serverside,Tools,heal,#T(#e(5,-1,#c));
}
}


-Ramirez- 04-11-2004 02:53 AM

You would want to set a variable to the current AP, raise their AP to 40 or higher, raise their hearts, then change their AP back to the temporary variable.

osrs 04-11-2004 06:09 AM

Re: Healing Players
 
Quote:

Originally posted by internetexplorer
NPC Code:
CODE


Problem: #T(#e(5,-1,#c))

You don't need to use #T since you're using #e. Also it's #e(6,-1,#c), because #e counts white spaces.

Quote:

I'm making some type of healing NPC,
and it's suppose to heal the player no matter
what AP they might have.

Why is it checking if player's AP are <= 39 then? :confused:
Also you're adding 40 and taking 40 of AP.. lol

xManiamaNx 04-11-2004 06:35 AM

I'm pretty sure that if the player ap is <= 39 graal will not allow players to increase their heart amount. apystem=false serveroption will allow players to heal no matter what ap they have.

internetexplorer 04-11-2004 06:41 AM

Re: Re: Healing Players
 
Quote:

Originally posted by osrs


Problem: #T(#e(5,-1,#c))

You don't need to use #T since you're using #e. Also it's #e(6,-1,#c), because #e counts white spaces.



Why is it checking if player's AP are <= 39 then? :confused:
Also you're adding 40 and taking 40 of AP.. lol

It would check to see if the player has 39 ap or lower to do the actions, and if they don't (else), the other commands will heal them with 40 ap or over w/o messing with their ap... Mind helping me a bit more? I'm just a little confused.

osrs 04-11-2004 06:53 AM

Re: Re: Re: Healing Players
 
Quote:

Originally posted by internetexplorer


It would check to see if the player has 39 ap or lower to do the actions, and if they don't (else), the other commands will heal them with 40 ap or over w/o messing with their ap... Mind helping me a bit more? I'm just a little confused.

Read Maniaman's post, he explained your problem.

internetexplorer 04-11-2004 07:01 AM

Re: Re: Re: Re: Healing Players
 
Quote:

Originally posted by osrs


Read Maniaman's post, he explained your problem.

That would just destroy the whole point of making the NPC. lol
Thanks anyways. <3

Riot 04-11-2004 10:14 AM

Re: Re: Healing Players
 
Quote:

Originally posted by osrs


Problem: #T(#e(5,-1,#c))

You don't need to use #T since you're using #e. Also it's #e(6,-1,#c), because #e counts white spaces.

Erm, no.

#T() is perfectly fine where it is. #T = trim whitespace.

Doing it this way means he could do /healaccount or /heal account.

WanDaMan 04-11-2004 11:34 AM

Well, It should work no matter what AP it is..
here's an example..

if (actionserverside) {
if(strequals(#p(0),heal)){
with (getplayer(#t(1))) {
playerhearts = playerfullhearts;
}
}
}
//#CLIENTSIDE
if (playerchats) {
tokenize #c;
if (startswith(/heal,#c)) {
triggeraction 0,0,serverside,tool,heal;
}
}

osrs 04-11-2004 03:49 PM

Re: Re: Re: Healing Players
 
NPC Code:

with (getplayer(#t(1))) {



Your code won't work that way, Wan.

Quote:

Originally posted by Riot


Erm, no.

#T() is perfectly fine where it is. #T = trim whitespace.

Doing it this way means he could do /healaccount or /heal account.

Hmm yea, i was wrong. x-x

internetexplorer 04-11-2004 08:59 PM

Well... will there be any type of way of doing this w/o messing with server options? :confused: :confused: :confused: :confused:

xManiamaNx 04-11-2004 10:08 PM

increasing their ap, healing, and then decreasing their ap again

-Ramirez- 04-11-2004 10:08 PM

Quote:

Originally posted by internetexplorer
Well... will there be any type of way of doing this w/o messing with server options? :confused: :confused: :confused: :confused:
Quote:

Originally posted by -Ramirez-
You would want to set a variable to the current AP, raise their AP to 40 or higher, raise their hearts, then change their AP back to the temporary variable.
*****, Maniaman said it again before I could. :(

internetexplorer 04-11-2004 11:29 PM

Well... I'm using:
NPC Code:
if (playerap <= 39) {
playerap += 40;
playerhearts = playerfullhearts;
playerap -= 40;
} else {
playerhearts = playerfullhearts;
}



Shouldn't that work? o_o;;

DIABLO2099 04-12-2004 12:53 AM

Can't you just increase their hearts serverside? If you want to heal clientside then you can raise their ap I suppose. IE, throw a sleep in there and see what it does.

-Ramirez- 04-12-2004 01:01 AM

Quote:

Originally posted by internetexplorer
Shouldn't that work? o_o;;
Yeah... it should. Xecutor's suggestion is probably what I'd try too. Although it shouldn't have to wait...

--Edit--
I just did some testing and discovered that it DOES raise the hearts without needing to raise the AP at all. The problem is that the client won't raise the hearts due to still having low AP. (Oh the wonders of still having clientside-only support!)

You'd just need to do something to make the client see that the hearts have gone up.

internetexplorer 04-12-2004 03:36 AM

This is all so very confusing... mind giving me an example? :(


All times are GMT +2. The time now is 12:51 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.