Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Bug Report (https://forums.graalonline.com/forums/forumdisplay.php?f=193)
-   -   player.hears & player.ap (https://forums.graalonline.com/forums/showthread.php?t=134259855)

xAndrewx 07-16-2010 02:24 PM

player.hears & player.ap
 
So, if the players AP is less than 50, the player.hearts serverside when increasing wont work! For example

if my ap is 20 and I try to heal the player via serverside
HTML Code:

temp.p = findplayer("Graal707396");
temp.p.hearts += 1;

Wouldn't work! However it works if I want to hurt the player.

If I change my ap to above 50, the above code works and so does decreasing the players health! please fix

Crow 07-16-2010 04:21 PM

Known problem. I don't think it'll be fixed, either. Just use the classic workaround:
PHP Code:

temp.pl findPlayer("xAndrewx");
temp.ap temp.pl.ap;
temp.pl.ap 50;
temp.pl.hp 5// yes, hp is valid, and so is maxhp
temp.pl.ap temp.ap


xAndrewx 07-16-2010 04:58 PM

I didn't know about the HP/MAXHP, however still doesn't work :(

Quote:

Originally Posted by Crow (Post 1587898)
PHP Code:

temp.pl findPlayer("xAndrewx");
temp.ap temp.pl.ap;
temp.pl.ap 50;
temp.pl.hp 5// yes, hp is valid, and so is maxhp
temp.pl.ap temp.ap


I'm using it as a public player class function

Crow 07-16-2010 05:32 PM

Quote:

Originally Posted by xAndrewx (Post 1587905)
I'm using it as a public player class function

Can't exactly follow..

xAndrewx 07-16-2010 06:58 PM

HTML Code:

player.join("functions");
Inside this class
HTML Code:

public function onHealPlayer(amount) {
  this.hearts = min(this.hearts += temp.amount, this.fullhearts);
}

doesn't seem to fix it with sliding the ap either :(

cbk1994 07-16-2010 09:19 PM

Just set up some functions in the player class....

PHP Code:

public function heal(hearts) {
  
this.setHealth(this.getHearts() + hearts);
}

public function 
hurt(hearts) {
  
this.setHealth(this.getHearts() - hearts);
}

public function 
getHearts() {
  return 
this.hearts;
}

public function 
setHealth(hearts) {
  
this.oldAP this.ap;
  
this.ap 50;
  
this.hearts max(0min(this.fullheartshearts));
  
this.ap oldAP;


then you don't have to worry about it

xAndrewx 07-16-2010 09:24 PM

Quote:

Originally Posted by cbk1994 (Post 1587942)
Just set up some functions in the player class....

PHP Code:

public function heal(hearts) {
  
this.setHealth(this.getHearts() + hearts);
}

public function 
hurt(hearts) {
  
this.setHealth(this.getHearts() - hearts);
}

public function 
getHearts() {
  return 
this.hearts;
}

public function 
setHealth(hearts) {
  
this.oldAP this.ap;
  
this.ap 50;
  
this.hearts max(0min(this.fullheartshearts));
  
this.ap oldAP;


then you don't have to worry about it

still doesn't work :[

Jiroxys7 07-16-2010 11:29 PM

so much for "hp cant be recovered by normal means"
where did i hear that? im pretty sure it was classic. problem is, it cant be healed by er.. abnormal means either. only death. I always found that a bit misleading

ffcmike 07-17-2010 01:12 AM

You could possibly try a "hack" towards solving this in the form of player.hurt(-number);, still seems strange not to be working however, I recall having issues where using "this." as opposed to "player." within player classes and more specifically the same with "this.hearts" within Gani Attribute scripts which fixed by changing it to "player.", could possibly be the solution here aswell.

cbk1994 07-17-2010 01:24 AM

I've never had problems using 'this' to refer to the player which a player class is joined to—it's the preferable way to do it. There may be some weird problem with hearts though. I've never scripted with the classic heart system (and don't really know why anyone would want to).

Cloven 07-17-2010 03:43 AM

Quote:

Originally Posted by cbk1994 (Post 1587994)
I've never had problems using 'this' to refer to the player which a player class is joined to—it's the preferable way to do it. There may be some weird problem with hearts though. I've never scripted with the classic heart system (and don't really know why anyone would want to).

Yeah my guess is it's some weird problem with hearts, if anything. We have multiple scripts that refer to the player as 'this' without issue.

xAndrewx 07-17-2010 10:26 AM

lets hope stefan fixes it!!! :D

Crow 07-17-2010 12:18 PM

It is indeed a "problem" with the default hearts system. Many default systems seem to be coded in a hackish way. This specific problem is just related to the "no heals for PKers" thing. Another hackish implementation is the heart dropping stuff when lifting a pot. Try adding the default pot tiles to a level, and change them to the "pot lifted" tiles using the two-dimensional tiles array and updateBoard(). Doing so will drop a heart.

cbk1994 07-17-2010 06:45 PM

Quote:

Originally Posted by Crow (Post 1588042)
Doing so will drop a heart.

Graal never ceases to amaze me...

xAndrewx 07-17-2010 06:47 PM

lol no way

Stefan please fix for v6 this aint cool


All times are GMT +2. The time now is 08:34 AM.

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