![]() |
Quote:
|
Quote:
Whereas if you store it twice, once on the server-side and once on the client-side. You have access to it on the client-side right away without sending it through your server-to-client data routing system. Then when his shop is working the way he wants, he can always go in after and setup a way to sync the shop data to the client. |
This is what we've got so far!
Although I'm interested in re-doing the shop with DB NPC's instead of putting all the item information in the shop class. Do you think that would be more efficient or is this a good solution? Don't really know how to set it all up using DB NPC's yet though. PHP Code:
|
You can use += and -= to add/subtract from a value (purely based on your preference, but most people do that).
Besides that, the only thing that sticks out is the way you're forming your array. Rather than looping through an array, use it like a hash map. PHP Code:
PHP Code:
|
Okay, thank you very much :)
So you don't think we need to re-build it using DB NPCs? We don't really know how to use a DB NPC properly but I understand that's the way the "pro's" are doing it? Thank you :) |
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.
|
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 :) |
Quote:
PHP Code:
|
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:
PHP Code:
Hmm... Thank you :) |
'this' refers to the GuiShowImgCtrl instead of the level npc or weapon. You have to use thiso to access your listofitems.
I would recommend doing.. new GuiShowImgCtrl("Split_ShopItem_" @ this.listofitems[0][0]) instead of just using the item's name as well. |
Omg, thank you! Getting a little tired ;D
|
To start with I want to thank you all for your replies and good support :) We're closing in on the main goal!
We don't have a DB just yet, but we're close to it...I think! This is what we've got so far: Class shop PHP Code:
Weapon -shopcontrol: PHP Code:
This is where the trouble starts. When I'm about to send the chosen item back to the npc something goes wrong. It seems like the triggeraction doesn't really do what I thought it would do. I thought it would trigger the npc closest to the coordinates given in the triggeraction (x, y, ...). But maybe I'm doing it all wrong? Also, it seems as if the NPC's shape is out of synch. The player touches it when the player is positioned at the top left tile of the NPC. Maybe there's something I've done with setshape that doesn't work? Thank you :) EDIT: I managed to get the data back to the NPC! So there's no problem with the triggeraction(npcx, npcy, ...) command :) But the NPC PlayerTouchsMe is still troubeling us. EDIT2: As stated above I managed to get the triggerserver and trigger client between the NPC and the weapon to work. I have now created a DB NPC named DB_Items: PHP Code:
|
Here's one way of doing it, you assign a shop id to your npc.
I.e: this.shop_id = "basicshop"; PHP Code:
PHP Code:
PHP Code:
|
Thank you :) I tried something similar just now, but failed because I didn't make the function getItems in the DB NPC public. I suppose it has to be public?
|
Quote:
|
| All times are GMT +2. The time now is 08:44 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.