Home Community Mys-Script Creative Off-Topic |
|
|
Thread Tools | Display Modes |
#1
|
||||
|
||||
Untradeable Single Species: How?
How would I go about making a species be untradeable? Basically, I'm going to give the user a free pet at the start, they only get one of this special kind, and it needs to be untradeable and unable to be pounded, because I'll be calculating their progression (for story-driven events) based on the level of that one, special pet. If they were to lose it... my system crumbles.
Do I just add a column in the database to hold a marker saying if its the starter pet? And when its first adopted from the special page, it will get that marker? I could always set it to 'not for trade' on its creation, right? And then check if its the starter pet, and disappear away the option to change its trade status, and the link to pound it, from the pet management page? Or is there a better way?
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it. |
#2
|
||||
|
||||
Yup, it's like that yes ^^ If you add a column to check if it's the starter pet, you can use just that variable to prevent the pet from leaving. Basically in every function that might try to change its trade status, pound it, etc. you need to check if it's the starter pet. Don't just make the options disappear btw, some people might try to access the link manually, so the verification has to be there before the database updates too
__________________
asp.net stole my soul. |
#3
|
|||
|
|||
Ooh this is a cool idea! If you're adding the column to the database, would it be INT or VARCHAR? I think I want to use something like this on my site too (since you start out with two fish to start your school).
|
#4
|
||||
|
||||
Anything works, but I woudn't use varchar. If you don't want/can't use boolean, I'd go with an enum of true and false or an int (1 or 0)
__________________
asp.net stole my soul. Last edited by IntoRain; 11-30-2014 at 04:53 PM. |
#5
|
||||
|
||||
Well an easier way is to do something similar to the items. For items they may be tradable or untradable depending on a value set in the database column 'tradable' in table prefix.items. The trade machine will scan for items that are not tradable, and block trade if this happens. Look for the code at trade.php and related class files such as class_trade.php and class_tradevalidator.php. They can give you some hint.
__________________
Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Not able to delete a pet species | Cremuex Levier | Questions and Supports | 4 | 04-03-2013 10:07 AM |
Adopt only one of each species | Niku | Questions and Supports | 1 | 08-13-2011 02:51 AM |
Species Names | Beaux | Questions and Supports | 5 | 05-09-2011 04:07 PM |
Is it possible not to display the species name of the adoptable in adopt center? | Hall of Famer | Questions and Supports | 3 | 03-07-2010 06:54 PM |
Single error when loading the page. | Squiddle | Questions and Supports | 1 | 09-06-2009 03:27 PM |
What's New? |
What's Hot? |
What's Popular? |