Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   player.hearts (https://forums.graalonline.com/forums/showthread.php?t=134259854)

xAndrewx 07-16-2010 11:28 AM

player.hearts
 
I'm trying to update this serverside- but it won't o-o
I'm using a custom GUI, so I'm using this to heal the player

HTML Code:

public function onHealPlayer(amount) {
  player.hearts += temp.amount;
  triggerclient("weapon", "-Player/HUD", "updateHP", player.hearts);
}

Once it's updated, it'll call the HUD to update. However, on the serverside it shows the HP changing without a problem, but when I go on the clientside it's staying at the old value, not the new one!
Anyone have any reasons why?
I tried it with the default system, but no fix x-x (still updated on the serverside, not the clientside)

cbk1994 07-16-2010 12:42 PM

If you're using player.hearts you shouldn't have to manually sync those clientside and serverside.. at least I don't think so.

xAndrewx 07-16-2010 01:07 PM

I'm using a default HUD :(

ffcmike 07-16-2010 01:12 PM

Quote:

Originally Posted by xAndrewx (Post 1587881)
I'm trying to update this serverside- but it won't o-o
I'm using a custom GUI, so I'm using this to heal the player

HTML Code:

public function onHealPlayer(amount) {
  player.hearts += temp.amount;
  triggerclient("weapon", "-Player/HUD", "updateHP", player.hearts);
}

Once it's updated, it'll call the HUD to update. However, on the serverside it shows the HP changing without a problem, but when I go on the clientside it's staying at the old value, not the new one!
Anyone have any reasons why?
I tried it with the default system, but no fix x-x (still updated on the serverside, not the clientside)

Hm yeah the player.hearts variable is definately synced and should not require manual update, but assuming the HUD is relying on a trigger to update the display my only guess based on this would be the lack of "player." before triggerclient();.

xAndrewx 07-16-2010 01:15 PM

Strange- I'm testing it now and even when I add player.hearts++ to a weapon it won't call it o-o

Infact, I can't even heal the player now... lol
It seems to be ok when I remove the players hearts, but when I add them it wont add.

xAndrewx 07-16-2010 01:33 PM

fixed it by resetting my player =O


However, if my ap is < 50 it won't heal... lol is that normal for classic o-o

It's an engine problem, thanks guys ^^
http://forums.graalonline.com/forums...89#post1587889


All times are GMT +2. The time now is 07:03 AM.

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