Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Custom Name System error (https://forums.graalonline.com/forums/showthread.php?t=134264740)

Nogross 10-08-2011 06:11 PM

Custom Name System error
 
Hello Forum,

I got a proplem with my Custom Name System.. It's based like Gunderaks 1:
http://forums.graalonline.com/forums...hp?t=134264204

The proplem is that the hp text and the guild text will be overwritten if there are more then 2 player in the room. I hope you guys can help me.

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
enablefeatures(200);
  
setTimer(0.05);
}

function 
onTimeOut() {
  
this.hideimgs(200200 this.i);

  for (
temp.plplayers) {
    
this.showtext(200 this.itemp.pl.1.57temp.pl.3.05"Arial""cb", @ temp.pl.nick);
    
changeimgcolors(200 this.i0.510.51);
    
changeimgvis(200 this.i1);
    
changeimgzoom(200 this.i0.75);
    
this.i++;
    
this.showtext(201 this.itemp.pl.1.57temp.pl.3.85"Arial""cb", @ temp.pl.hearts "/" temp.pl.maxhp);
    
changeimgcolors(201 this.i10.10.11);
    
changeimgvis(201 this.i1);
    
changeimgzoom(201 this.i0.65);
    
this.i++;
    
showtext(202 this.itemp.pl.1.57temp.pl.4.35"Arial""cb", @ temp.pl.clientr.guildtag);
    
changeimgcolors(202 this.i1111);
    
changeimgvis(202 this.i1);
    
changeimgzoom(202 this.i0.65);
    
this.i++;
  }
  
setTimer(0.05);


Thanks anyway!
NG

Emera 10-08-2011 06:19 PM

I suggest you use a GANI to display the nicknames. You an do much more with a GANI than you can with that. That is what we use on Lexia. Here is a bare bone system.

NPC Code:
SPRITE 0 SPRITES 0 0 24 12 shadow
SCRIPT

function onPlayerEnters() {
setTimer(0.05);
}

function onTimeOut() {
ShowingNicknames();
setTimer(0.05);
}

function ShowingNicknames() {
with(findImg(2)) {
text = player.nick;
x = player.x + 1.5;
y = player.y + 3.4;
style = "bc";
layer = 0;
mode = 1;
}
}
SCRIPTEND


Crow 10-08-2011 06:23 PM

I suggest not using a gani, as it's not as efficient.

Nogross 10-08-2011 06:25 PM

Quote:

Originally Posted by Crow (Post 1670317)
I suggest not using a gani, as it's not as efficient.

What do you suggest then? And also the script I use atm. works perfectly, the only proplem is that it overdraws the texts if there are more then 2 people in a room.

fowlplay4 10-08-2011 06:27 PM

Quote:

Originally Posted by Emera (Post 1670316)
I suggest you use a GANI to display the nicknames. You an do much more with a GANI than you can with that. That is what we use on Lexia. Here is a bare bone system.

You don't need to use a timeout in a GANI like that, also you have an else on a with statement which makes no sense.

You could use a GANI script like this:

PHP Code:

SCRIPT
function onPlayerEnters() {
  
with (findimg(2)) {
    
text player.nick;
    
player.x;
    
player.y;
    
attachtoowner true;
    
attachoffset = {1.53.4};
    
style "bc";
    
layer 0;
    
mode 1;
  }
}
SCRIPTEND 

and when the player's nickname changes on the server-side you can just update the attr you're using. I.e:

PHP Code:

function onPlayerNickChanges(obj) {
  
obj.attr[3] = "";
  
obj.attr[3] = "nickname.gani";


Quote:

Originally Posted by Nogross (Post 1670318)
What do you suggest then? And also the script I use atm. works perfectly, the only proplem is that it overdraws the texts if there are more then 2 people in a room.

The way you're doing it now is what I would use personally, it's much more flexible. Nicknames systems have been the source of lag complaints though so I wouldn't even make one tbh. I prefer mouse-over to display nickname systems at the end of the day.

Please learn to style your script, or at least run it through my http://fp4.ca/gs2beautifier/ before posting your script.

PHP Code:

//#CLIENTSIDE 

function onCreated() {
  
enablefeatures(200);
  
setTimer(0.05);
}

function 
onTimeOut() {
  
this.hideimgs(2004000); // Hide all potential images from last timeout
  
this.0;               // Set this.i to 0
  
for (temp.plplayers) {
    
this.showtext(200 this.itemp.pl.1.57temp.pl.3.05"Arial""cb", @ temp.pl.nick);
    
changeimgcolors(200 this.i0.510.51);
    
changeimgvis(200 this.i1);
    
changeimgzoom(200 this.i0.75);
    
this.i++;
    
this.showtext(201 this.itemp.pl.1.57temp.pl.3.85"Arial""cb", @ temp.pl.hearts "/" temp.pl.maxhp);
    
changeimgcolors(201 this.i10.10.11);
    
changeimgvis(201 this.i1);
    
changeimgzoom(201 this.i0.65);
    
this.i++;
    
showtext(202 this.itemp.pl.1.57temp.pl.4.35"Arial""cb", @ temp.pl.clientr.guildtag);
    
changeimgcolors(202 this.i1111);
    
changeimgvis(202 this.i1);
    
changeimgzoom(202 this.i0.65);
  }
  
setTimer(0.05);


If you're going to base your system off anyone's code base it off my 'player block drawer' in this post (2nd script): http://forums.graalonline.com/forums...04&postcount=6

Nogross 10-08-2011 07:18 PM

Thank you guys, I fixed it.

ffcmike 10-08-2011 08:25 PM

Quote:

Originally Posted by Nogross (Post 1670333)
Thank you guys, I fixed it.

What was your fix?
My guess would be that in incrementing this.i per every display aswell as using higher base indexes your displays were contradicting eachother.

On the subject of gani vs weapon, I also suggest not using a gani, it is very inefficient over a larger number of players, while a weapon makes it much easier to check for things like AP changing or nickname display being disabled.


All times are GMT +2. The time now is 04:27 AM.

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