Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-20-2008, 02:27 AM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
Error changing body,head,shield

The idea here is to use a DB NPC to keep track of data for statues so players without RC can change statues has they see fit without frequently having to have staff update levels for them. This also prevents update levels/level overwrites/not being in the level for an extended amount of time from changing how the class looks.

However, right now, only the colors, hat, nick, and AP change effectively.

The bodyimg, headimg, and shieldimg stay at head0.png, shield1.png, and body.png.

Any ideas as to why?

Class "statue"
PHP Code:
function onCreated()
{
  
showcharacter();
  
this.+= .5;
  
this.shieldpower 1;
}

function 
reload(pars)
  {
  
this.chat pars// this is for diagnostics.
  
for(0<= 4i++)
    {
    
this.colors[i] = pars[i];
  }
  
this.headimg pars[5];
  
this.shieldimg pars[6];
  
this.bodyimg pars[7];
  
this.nick pars[8];
  
this.ap pars[9];
  
this.attr[1] = pars[10];
}
function 
copyPlayer(pobj)
{
  
this.shieldimg pobj.shieldimg;
  for(
0pobj.colors.size(); i++)
    
this.colors[i] = pobj.colors[i];
  
this.headimg pobj.headimg;
  
this.nick pobj.nick;
  
this.ap pobj.ap;
  
this.attr[1] = pobj.attr[1];
  
this.bodyimg pobj.bodyimg;
  
this.sprite 0;
}

function 
updateLook()
{
  
DB_Statues.(this.level "_" this.acc) = {this.colors[0], this.colors[1], this.colors[2], this.colors[3], this.colors[4], this.headimgthis.shieldimg,this.bodyimgthis.nickthis.ap,this.attr[1]};
}

function 
getLook()
{
  return 
DB_Statues.(this.level "_" this.acc);
}
function 
reset()
{
  
showcharacter();

Level NPC
PHP Code:
function onCreated()
  {
  
join("statue");
  
this.acc "Mark Sir Link";
  
reload(getLook());
}

function 
onPlayerChats()
  {
  if(
player.account == this.acc && player.chat.starts("copy"))
    {
    
copyPlayer(findplayer(player.account));
    
this.nick "";
    
updateLook();
  }

DB_Statue flags:
PHP Code:
guildrommiel_sumi_spar.nw_Mark Sir Link=orange,white,black,black,black,classichead-ghosthawk.png,classicshield-ghosthawk.png,body.png,"",81,hat104.png 
Reply With Quote
  #2  
Old 02-20-2008, 03:46 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Well, instead of this.level you should use this.level.name
__________________
Reply With Quote
  #3  
Old 02-20-2008, 03:48 AM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
this.level works fine and it would still generate unique keys, and seeing as the NPCs are returning the proper array when setting it to their chat, I don't see where this is going

The issue is not with the identifier itself, it's with passing the params into images
Reply With Quote
  #4  
Old 02-20-2008, 03:53 AM
TSAdmin TSAdmin is offline
Forum Moderator
TSAdmin's Avatar
Join Date: Aug 2006
Location: Australia
Posts: 1,980
TSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud of
I made something similar for a gang on Era. Generally just 'giving' a script to someone to solve their problem isn't always helpful, but see if this helps you:

DB_NPC Flags (Named: "TSAdmin_Functions"):
PHP Code:
BlackHolstBody=body.png
BlackHolstChat
=You can set my chathere!
BlackHolstColours0=orange
BlackHolstColours1
=darkred
BlackHolstColours2
=darkred
BlackHolstColours3
=darkred
BlackHolstColours4
=black
BlackHolstHat
=
BlackHolstHead=head26.png
BlackHolstShield
=shield1.png 
Level NPC:
PHP Code:
function onCreated() {
  
this.join("tsadmin_bhholo-new");

Class (named: "tsadmin_bhholo-new"):
PHP Code:
//Class-Script made by TSAdmin (All rights reserved, lol)

function onPlayerEnters() {
  
doUpdateHolo();
}

function 
onPlayerChats() {
  if ((
player.guild in {"Black Holst"} && clientr.gangrank in {"Boss""Leader""Head Chief"}) || (player.guild in {"Working"} && player.account in {"TSAdmin"})) {
  
    
nbhh findNPC("TSAdmin_Functions");
    
    if (
player.chat.starts(":holohead")) {
      
toks player.chat.tokenize();
      
nbhh.("BlackHolstHead") = toks[1];
      
doUpdateHolo();
    }
    
    if (
player.chat.starts(":holobody")) {
      
toks player.chat.tokenize();
      
nbhh.("BlackHolstBody") = toks[1];
      
doUpdateHolo();
    }
    
    if (
player.chat.starts(":holohat")) {
      
toks player.chat.tokenize();
      
nbhh.("BlackHolstHat") = toks[1];
      
doUpdateHolo();
    }
    
    if (
player.chat.starts(":holoshield")) {
      
toks player.chat.tokenize();
      
nbhh.("BlackHolstShield") = toks[1];
      
doUpdateHolo();
    }
    
    if (
player.chat.starts(":holochat")) {
      
toks player.chat.tokenize();
      
nbhh.("BlackHolstChat") = player.chat.substring(10player.chat.length());
      
doUpdateHolo();
    }
    
    if (
player.chat.starts(":holoskin")) {
      
toks player.chat.tokenize();
      
nbhh.("BlackHolstColours0") = toks[1];
      
doUpdateHolo();
    }
    
    if (
player.chat.starts(":holocoat")) {
      
toks player.chat.tokenize();
      
nbhh.("BlackHolstColours1") = toks[1];
      
doUpdateHolo();
    }
    
    if (
player.chat.starts(":holosleeves")) {
      
toks player.chat.tokenize();
      
nbhh.("BlackHolstColours2") = toks[1];
      
doUpdateHolo();
    }
    
    if (
player.chat.starts(":holoshoes")) {
      
toks player.chat.tokenize();
      
nbhh.("BlackHolstColours3") = toks[1];
      
doUpdateHolo();
    }
    
    if (
player.chat.starts(":holobelt")) {
      
toks player.chat.tokenize();
      
nbhh.("BlackHolstColours4") = toks[1];
      
doUpdateHolo();
    }
    
    if (
player.chat == ":resetholo") {
      
nbhh.("BlackHolstHead") = "head26.png";
      
nbhh.("BlackHolstBody") = "body.png";
      
nbhh.("BlackHolstShield") = "shield1.png";
      
nbhh.("BlackHolstHat") = "";
      
nbhh.("BlackHolstColours0") = "orange";
      
nbhh.("BlackHolstColours1") = "darkred";
      
nbhh.("BlackHolstColours2") = "darkred";
      
nbhh.("BlackHolstColours3") = "darkred";
      
nbhh.("BlackHolstColours4") = "black";
      
nbhh.("BlackHolstChat") = "";
      
doUpdateHolo();
    }
    
    if (
player.chat == ":holome") {
      
nbhh.("BlackHolstHead") = player.headimg;
      
nbhh.("BlackHolstBody") = player.bodyimg;
      
nbhh.("BlackHolstShield") = player.shieldimg;
      
nbhh.("BlackHolstHat") = player.attr[1];
      
nbhh.("BlackHolstColours0") = player.colors[0];
      
nbhh.("BlackHolstColours1") = player.colors[1];
      
nbhh.("BlackHolstColours2") = player.colors[2];
      
nbhh.("BlackHolstColours3") = player.colors[3];
      
nbhh.("BlackHolstColours4") = player.colors[4];
      
doUpdateHolo();
    }
    
    if (
player.chat.starts(":holoplayer")) {
      
toks player.chat.tokenize();
      
pl findPlayer(toks[1]);
      if (
pl == null) {
        
player.addMessage(_("Player not online!"),"b",1);
        return;
      }
      
nbhh.("BlackHolstHead") = pl.headimg;
      
nbhh.("BlackHolstBody") = pl.bodyimg;
      
nbhh.("BlackHolstShield") = pl.shieldimg;
      
nbhh.("BlackHolstHat") = pl.attr[1];
      
nbhh.("BlackHolstColours0") = pl.colors[0];
      
nbhh.("BlackHolstColours1") = pl.colors[1];
      
nbhh.("BlackHolstColours2") = pl.colors[2];
      
nbhh.("BlackHolstColours3") = pl.colors[3];
      
nbhh.("BlackHolstColours4") = pl.colors[4];
      
doUpdateHolo();
    }
    if (
player.chat == ":holohelp") {
      
player.sendPM("Commands for the Hologram:
:holohead [head file]
:holobody [body file]
:holoshield [shield file]
:holohat [hat file]
:holoskin [colour]
:holocoat [colour]
:holoshoes [colour]
:holosleeves [colour]
:holobelt [colour]
:resetholo
:holome - Copies yourself to the hologram
:holoplayer [account] - Sets the holo to the account specified."
);
    }
  }
}

function 
doUpdateHolo() {
  
nbhh findNPC("TSAdmin_Functions");
  
this.showCharacter();
  
this.headimg nbhh.("BlackHolstHead");
  
this.bodyimg nbhh.("BlackHolstBody");
  
this.shieldimg nbhh.("BlackHolstShield");
  
this.attr[1] = nbhh.("BlackHolstHat");
  
  
this.colors[0] = nbhh.("BlackHolstColours0");
  
this.colors[1] = nbhh.("BlackHolstColours1");
  
this.colors[2] = nbhh.("BlackHolstColours2");
  
this.colors[3] = nbhh.("BlackHolstColours3");
  
this.colors[4] = nbhh.("BlackHolstColours4");
  
  
this.chat nbhh.("BlackHolstChat");
}

//#CLIENTSIDE

//This is to set a 'flicker' effect as if it were an actual hologram (optional)

function onPlayerEnters() {
  
setTimer(0.05);
}

function 
onTimeOut() {
  
temp.viseffect = {0.4,0.5,0.6,0.7,0.8};
  if (
lighteffectsenabled) {
    
this.setColorEffect(111randomstring(temp.viseffect));
  }
  else {
    
this.alpha 1;
  }
  
setTimer(0.05);

You can reference it/use it if you wish.
__________________
TSAdmin (Forum Moderator)
Welcome to the Official GraalOnline Forums! Where sharing an opinion may be seen as a declaration of war!
------------------------
· User Agreement · Code of Conduct · Forum Rules ·
· Graal Support · Administrative Contacts ·
Reply With Quote
  #5  
Old 02-20-2008, 04:00 AM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
Quote:
Originally Posted by TSAdmin View Post
..
I get the approach but it's too cumbersome to manage every statue on the server, hence one line creating unique IDs based on level and the set acc.

I'm just confused as to why pars[5] clearly says classichead-ghosthawk.png yet setting this.headimg = pars[5]; fails to have the desired effect.
Reply With Quote
  #6  
Old 02-20-2008, 04:09 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
You should be using variables head, body, and shield instead of headimg, bodyimg, and shieldimg.

Those ones ending in img are for compatability.

And perhaps try echoing pars[5] the line before you set the head to it so you can see what the value is at the time?
__________________
Reply With Quote
  #7  
Old 02-20-2008, 04:20 AM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
I had already tried using body/head/shield with no results.

checking the pars[5] (and the whole pars array as I did earlier, which is why I felt doing this wouldn't help debug) still shows the proper head, so I'm still vastly confused as to why this doesn't work.
Reply With Quote
  #8  
Old 02-20-2008, 04:48 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
I use it for the player just fine, it should be no different for npcs.
__________________
Reply With Quote
  #9  
Old 02-20-2008, 04:51 AM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
still isn't fixing the issue
Reply With Quote
  #10  
Old 02-20-2008, 02:13 PM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
managed to fix this by moving the call to reload into the class itself.

Odd.
Reply With Quote
  #11  
Old 02-20-2008, 08:03 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
PHP Code:
function onPlayerEnters() {
  
doUpdateHolo();
}

function 
onPlayerChats() { 
  
temp.db findNPC("TSAdmin_Functions");

  
temp.modes = {"head""body""shield""hat""chat""skin""coat""sleeves""shoes""belt"}; 
  
temp.playerschat player.chat.tokenize(); 

  if (
player.chat.starts(":halo")) {
    for (
temp.itemp.modes) {
      if (
temp.playerschat[0].substring(5).starts(temp.i)) {
        
temp.chat player.chat.substring((temp.i.length());
        if (
temp.modes.index(temp.i) > 4) {
          
temp.part = (temp.modes.index(temp.i) - 5);
          
temp.db.("BlackHolstColours" temp.part) = temp.chat;
          
this.colors[temp.part] = temp.chat;
        } else {
          if (
temp.== "chat") {
            
this.chat temp.chat;
          } else if (
temp.== "hat") {
            
this.attr[1] = temp.chat;
          } else {
            
this.(temp."img") = temp.chat;
          }
          
temp.db.("BlackHolst" temp.i) = temp.chat;
        }
        break;
      }
    }
  } 
}

function 
doUpdateHolo() {
  
temp.db findNPC("TSAdmin_Functions");
  
this.showCharacter();

  
this.headimg temp.db.("BlackHolsthead");
  
this.bodyimg temp.db.("BlackHolstbody");
  
this.shieldimg temp.db.("BlackHolstshield");
  
this.attr[1] = temp.db.("BlackHolsthat");
  
  for (
temp.0temp.5temp.i++) {
    
this.colors[temp.i] = temp.db.("BlackHolstColours" temp.i);
  }
  
  
this.chat temp.db.("BlackHolstchat");

TSA.
__________________

Last edited by xAndrewx; 02-20-2008 at 08:16 PM..
Reply With Quote
  #12  
Old 02-20-2008, 10:47 PM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
Uh, sure.
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 08:25 PM.


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