Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-08-2011, 06:11 PM
Nogross Nogross is offline
Registered User
Nogross's Avatar
Join Date: Feb 2011
Location: Germany
Posts: 23
Nogross is an unknown quantity at this point
Send a message via ICQ to Nogross
Question 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

Last edited by Nogross; 10-08-2011 at 06:58 PM.. Reason: Beautified
Reply With Quote
  #2  
Old 10-08-2011, 06:19 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
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

__________________

Last edited by Emera; 10-08-2011 at 06:32 PM..
Reply With Quote
  #3  
Old 10-08-2011, 06:23 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
I suggest not using a gani, as it's not as efficient.
__________________
Reply With Quote
  #4  
Old 10-08-2011, 06:25 PM
Nogross Nogross is offline
Registered User
Nogross's Avatar
Join Date: Feb 2011
Location: Germany
Posts: 23
Nogross is an unknown quantity at this point
Send a message via ICQ to Nogross
Quote:
Originally Posted by Crow View Post
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.
Reply With Quote
  #5  
Old 10-08-2011, 06:27 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by Emera View Post
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 View Post
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
__________________
Quote:

Last edited by fowlplay4; 10-08-2011 at 06:45 PM..
Reply With Quote
  #6  
Old 10-08-2011, 07:18 PM
Nogross Nogross is offline
Registered User
Nogross's Avatar
Join Date: Feb 2011
Location: Germany
Posts: 23
Nogross is an unknown quantity at this point
Send a message via ICQ to Nogross
Thank you guys, I fixed it.
Reply With Quote
  #7  
Old 10-08-2011, 08:25 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Quote:
Originally Posted by Nogross View Post
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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:35 AM.


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