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 08-08-2011, 11:21 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
I would recommend a DB NPC only because it will let you keep one copy of the data rather than keeping it in a class joined to many NPCs. As a general rule, I would recommend not storing data in classes.
__________________
Reply With Quote
  #2  
Old 08-09-2011, 12:26 AM
Adddeeee Adddeeee is offline
Registered User
Join Date: Aug 2011
Posts: 30
Adddeeee is on a distinguished road
Then we will try that solution

If we use a DB NPC named DB_Items we could store all the information regarding the items in that NPC.

But what happens with the clientside of the level NPC? Shall we have a copy of all the items information on the clientside? Because we can't read the DB NPCs information from the client side right?

Thank you
Reply With Quote
  #3  
Old 08-09-2011, 12:36 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 Adddeeee View Post
Then we will try that solution

If we use a DB NPC named DB_Items we could store all the information regarding the items in that NPC.

But what happens with the clientside of the level NPC? Shall we have a copy of all the items information on the clientside? Because we can't read the DB NPCs information from the client side right?

Thank you
triggerclient a weapon with the data you want to send, IE, have a class join the generic shop class, have that triggerserver the NPC when you want the shop to open, then have the NPC trigger a weapon the player has that opens the shop GUI with the information provided. Can have a trigger in the class as well to hide the shop should the player leave the level or get too far away.


PHP Code:
triggerserver("npc""DB_Items""getitems"//possibly level name as well to restrict what shops have what items

triggerclient("gui"shopweaponname"senditems"this.items); 
Reply With Quote
  #4  
Old 08-09-2011, 12:52 AM
Adddeeee Adddeeee is offline
Registered User
Join Date: Aug 2011
Posts: 30
Adddeeee is on a distinguished road
Thumbs up

Ah I see, will try this later on when I get the GUI to be more flexible Sorry for asking so many dumb questions, but I'm kind of stuck both on the DB NPC and on the GUI part!

Why doesn't this work:

PHP Code:
  this.listofitems = {{"Fireball""split_fireball""split_fireball.png""split_fireball_selected.png"30}, 
                      {
"Sword""split_sword""split_sword.png""split_sword_selected.png"20},
                      {
"Bow""split_bow""split_bow.png""split_bow_selected.png"10}
                     }; 
  new 
GuiShowImgCtrl(this.listofitems[0][0]) 
  {
    
20;
    
20;
    
width 32;
    
height 32;
    
    
this.imageselected this.listofitems[0][3];
    
this.imagenotselected this.listofitems[0][2];
    
this.image this.imageselected;
    
thiso.catchevent(this.name"onMouseDown""onItemSelected");
  }
  
Shop_Window.addControl(this.listofitems[0][0]);
  
Shop_Window.show(); 
when this works just fine:

PHP Code:
  this.listofitems = {{"Fireball""split_fireball""split_fireball.png""split_fireball_selected.png"30}, 
                      {
"Sword""split_sword""split_sword.png""split_sword_selected.png"20},
                      {
"Bow""split_bow""split_bow.png""split_bow_selected.png"10}
                     };

  new 
GuiShowImgCtrl(this.listofitems[0][0]) 
  {
    
20;
    
20;
    
width 32;
    
height 32;
    
    
this.imageselected "split_fireball_selected.png";
    
this.imagenotselected "split_fireball.png";
    
this.image this.imageselected;
    
thiso.catchevent(this.name"onMouseDown""onItemSelected");
  }
  
Shop_Window.addControl(this.listofitems[0][0]);
  
Shop_Window.show(); 
The only difference is that in the first code sample, I read the string from the array listofitems and in the second code sample I write the string directly.

Hmm...

Thank you
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 10:00 AM.


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