Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Gani Problems (https://forums.graalonline.com/forums/showthread.php?t=69336)

xXziroXx 10-11-2006 09:18 PM

Gani Problems
 
Ive been trying different methods of passing along params / information to ganis.. without much success I am afraid, so now I seek help from you guys.


Script:
PHP Code:

player.attr[19] = { {2040}, {510} };
player.attr[20] = "ml_hud.gani"


Gani:
PHP Code:

SCRIPT
function onCreated()
{
  
this.health = { player.attr[19][0][0], player.attr[19][0][1] };
  
this.mana = { player.attr[19][1][0], player.attr[19][1][1] };

  
setTimer(.05);
}

function 
onTimeOut()
{
  
showimg(1"@verdana@b@" this.account SPC "HP:" SPC this.health[0] @ "/" this.health[1SPC "MP:" SPC this.mana[0] @ "/" this.mana[1], 3y);
  
changeimgzoom(1.5);
}
SCRIPTEND 

That should show the text:

HP: 20/40 MP: 5/10

next to all players.. but it dont, it only show for the current player, the text:

HP: 0/0 MP: 0/0

is shown next to all other players.


Ive also tried to pass the params with same attribute as the gani, but then the gani wouldnt even work at all.

PHP Code:

  player.attr[20] = { "ml_hud.gani"param1param2etc..}; 

I tried to use both variants WITH and WITHOUT .gani, it didnt work -at all- without it.

Any suggestions?

Chompy 10-12-2006 03:03 PM

Quote:

Originally Posted by xXziroXx (Post 1229728)

Script:
PHP Code:

player.attr[19] = { {2040}, {510} };
player.attr[20] = "ml_hud.gani"


Gani:
PHP Code:

SCRIPT
function onCreated()
{
  
this.health = { player.attr[19][0][0], player.attr[19][0][1] };
  
this.mana = { player.attr[19][1][0], player.attr[19][1][1] };

  
setTimer(.05);
}

function 
onTimeOut()
{
  
showimg(1"@verdana@b@" this.account SPC "HP:" SPC this.health[0] @ "/" this.health[1SPC "MP:" SPC this.mana[0] @ "/" this.mana[1], 3y);
  
changeimgzoom(1.5);
}
SCRIPTEND 

That should show the text:

HP: 20/40 MP: 5/10

next to all players.. but it dont, it only show for the current player, the text:

HP: 0/0 MP: 0/0

is shown next to all other players.


Ive also tried to pass the params with same attribute as the gani, but then the gani wouldnt even work at all.

PHP Code:

  player.attr[20] = { "ml_hud.gani"param1param2etc..}; 

I tried to use both variants WITH and WITHOUT .gani, it didnt work -at all- without it.

Any suggestions?


hmm,:)
HTML Code:

this.health = { player.attr[19][0][0], player.attr[19][0][1] };
this.mana = { player.attr[19][1][0], player.attr[19][1][1] };

HTML Code:

player.attr[19] = { {20, 40}, {5, 10} };
-------------------------
you are trying to call it like if attr19 was:
HTML Code:

player.attr[19] = { { {20}, {40} }, { {5}, {10} } };
correct me if I am wrong :)

Chompy 10-12-2006 03:06 PM

wait, I saw it was wrong because of "attr[19]" my bad :P

you could try to set it like to
PHP Code:

temp.attr player.attr[19];
temp.stuff temp.attr[0][1]; 

etc..

and you could try showtext instead of showimg
BTW; sorry for double post

xXziroXx 10-12-2006 10:47 PM

Doesnt mather if you use showtext or showimg, only showimg works serversided to show text (yes, I know ganis are clientsided).

And Ive already tried doing that Chompy, and im suprised no one is able to help me..

Raelyn 10-13-2006 12:10 AM

Quote:

Originally Posted by xXziroXx (Post 1229728)
...?

Ziro, psst, you should help with my Gani problems.. The door on Aetherforge only opens clientside, if a player pulls it open, the other players still see it closed. :)

xXziroXx 10-15-2006 02:56 PM

*bumps* Anyone?

Admins 10-15-2006 03:22 PM

You tried to use echo to see what player.attr[19] contains?

xXziroXx 10-15-2006 03:29 PM

Quote:

Originally Posted by Stefan (Post 1231324)
You tried to use echo to see what player.attr[19] contains?

Yes, and it shows exactly what I set it to. And if it was anything wrong in it, it wouldnt show the proper stats for the player himself - would it?

contiga 10-15-2006 07:02 PM

It's very simple to fix..

use:

player.attr[20] = { "ml_hud.gani", param1, param2, etc..};

And do this:
PHP Code:

SCRIPT
function onCreated()
{
  
sleep0.05); // Dunno why, but it doesn't load params in the first 0.05 seconds, it's a bug.
  
this.health = { params0][ 0], params0][ 1]};
  
this.mana = { params1][ 0], params1][ 1]};

  
setTimer.05);
}

function 
onTimeOut()
{
  
showimg(1"@verdana@b@" this.account SPC "HP:" SPC this.health[0] @ "/" this.health[1SPC "MP:" SPC this.mana[0] @ "/" this.mana[1], 3y);
  
changeimgzoom(1.5);
}
SCRIPTEND 


xXziroXx 10-15-2006 07:40 PM

Ok, me and Contiga tried to get it to work, without any luck.

He tried to do a player.testvar, but then it went entirely the same for all players.

It doesnt work to send params with player.attr ganis, wich is kind of lame.

Shouldnt this work?:

PHP Code:

player.attr[#] = { "ganiname", param1, param2, etc}; 

Because it doesnt. You can only set a player attribute to:

PHP Code:

player.attr[#] = "ganiname"; 


Yen 10-15-2006 09:24 PM

attr[] can only hold a string, not an array, contrary to the popular belief.

On Zodiac, we have to use a second attr[] in the format of "maxhp hp maxmp mp" and then tokenize it.

xXziroXx 10-18-2006 07:39 PM

Quote:

Originally Posted by Yen (Post 1231413)
attr[] can only hold a string, not an array, contrary to the popular belief.

On Zodiac, we have to use a second attr[] in the format of "maxhp hp maxmp mp" and then tokenize it.

I'll try that once I can either:

A) Get Graal / RC to work on my friends Linux computer.
B) Get him to trade back to Windows
C) Get back home :rolleyes:

Admins 10-18-2006 11:50 PM

The internal type of attr[] are strings, but you can assign arrays to it and if you assign it back to a normal variable it will be an array again.


All times are GMT +2. The time now is 02:39 PM.

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