![]() |
Will pay for this....
I want more excitement when clicking on pets. What I want is when you pull them from the database to show to a user for adoption, that some of them don't show up as often as the others, making them rare.
I will pay for someone to help me with this (Even Hof :P) Serious inquiries only please. |
Could you explain in a more clear fashion exactly what you are trying to accomplish?
If I understand in the slightest you're wanting that when a user clicks on an adoptable they have a chance of finding/adopting an adoptable for their own. And that some of the prize adoptables are more rare to find. Right. If this is kind of what you are wanting I may be able to help. I have a similar sort of random prize/adoptable getting system that works for me. There is just a random chance of stumbling across an adoptable just by browsing. It shouldn't be too hard to make so certain adoptables are more rare than others. |
Well not really, lol. But your idea may work. Can you explain your process a bit more?
|
First I added a column to the (prefix)_adoptables table. With a numeric value, I suppose a text/varchar would work too. This number decides whether or not the adotpable is available to be found randomly. You should be able to use a differnt number for a rarity system.
Then I created a random prize php page that you are redirected to if you have found something. I modified the random secure adoption mod code from the mod section to fix what I wanted. Once I had that working a added a piece of code that randomly picks a number and if the number I choose is generated it links to the page. I have an additional variable that I added to prevent people from cheating to get the prize. I think that's it in a nutshell. X3 So, what exactly are you trying to achieve? |
Well that went over my head!! lol
Ever played Dragon Cave? That's what I'm trying to do.. As you refresh the adoption page the adopts show up in threes randomly, and some of them don't pop us as often as the others.... Make better sense? |
Hasn't played Dragon Cave, but I think I better understand.
So on the actual page where you adopt pets from.(adopt.php) Show three random adoptables, some appearing less often than others. That more like what you mean? |
Exactly what I mean :) Mine already show three at a time... but randomly... simply by using "LIMIT 3 RAND()" Doesn't help me to show some fewer times than others.
|
Well then you could set up a column in your adoptables table for rarity. You could use numbers, text, or varchar. In numbers different rarities would be numbers like 1,2,or 3. Or with text/varchar it could actually be labeled common, uncommon, rare, ect. Then you would run a random number to select a query that would pull the rarity from the adoptable table, randomize which to choose and show it to the user. Do this for each adoptable you wish to show.
Something like that should work. I think I should go play with this to see if I can make it work for me before trying to present any code. |
I would love to have the code if it works!!
|
Okay so I got the rarity thing working pretty easily. But I only have it showing one adoptable. I could have it show three but with what I have it would show three of the same rarity. I'm still trying to come up with a way to run it so that it will work with 3.
|
*waits somewhat patiently* :)
|
I found a way to make the three adoptables have a random rarity but I am sure it is NOT the best way to do it. I just can't come up with a better way of doing it right now. :P
I can make the changes to the original adopts.php file and post it for you. Do you know how to add a column to your adoptables table? |
I do :) I'll give it a try and see how it works... do you want payment for this?
|
Okay. XD I don't need anything.
For the code below you will need to create a new column in the (prefix)_adoptables table with the name of rarity and type int(11). Rarity values(assign to the adoptables for their rarity) common = 0 uncommon = 1 rare = 2 ultrarare = 3 more can be added but you would have to add more statments to the code. Find (aaround line 25): PHP Code:
PHP Code:
That should do it. Let me know how it works for you or if you need help. :D *is still learning this stuff myself* |
Scratch that, lol... that was hard... Ok I had to pick through... is this right?
Code:
|
omg. It's working JUST like I needed it to!!! *bows to !Alive* You are amazing, my friend. How can I thank you? Seriously... I feel like I owe you... That is an amazing code.
|
That looks like it should work with the new 1.3 version. Though I have not messed with it at all as of yet. XP But it looks like you make the changes so it should work in the 1.3 version. XD
|
Read post above yours :)
|
^-^ I'm glad that it works for you. *blushes* Thanks, I'm happy that I was able to help even with my limited knowledge. X3
You don't owe me anything, seriously. I don't even know what I would ask for... |
Ok well if you EVER need anything... please don't hesitate to ask me. On one more note, do you know how to make it so that if two users click the same adopt at the same time, only one will get it? Not sure if I explained that one clearly either.
|
Alright, if I think of anything I'll let you know. X3
As for your question I get what you mean, but I am not sure how I would be able to accomplish that. |
Cool :) I'm so happy with this so it's totally cool! :bucktard::catfish::usedusedused:
|
Ok one more thing :) I think this may require a cron job or something... I think I'm more new to this than you.... but how can I only have the adopts available at certain times? Maybe a few minutes every hour?
|
I'm happy I was able to help. :smile::jay:
|
Added one more question in for you :) Sorry, lol
|
So you want the adoptables to only show/be available for a certain period of time? I'd have to see if I can come up with any simple ways. But in theory(in my head) it doesn't seem so hard. Though i have never done something like that.
|
I'm thinking I could just use something like I use for an adopt on my fox site. They are called twilight foxes and the sprite changes during twilight hours. So I could do something like...
Code:
|
Yeah, something like that should work. With the times changed to when you want dragons to be available.
|
Not sure how to say like >=5 && <= 5:30 lol... Ideas?
|
I played with it for a while and finally figured out a way to make it work. X3
$current_time = date('Gi'); if ($current_time >= 500 && $current_time < 530){ show adopts here }else{ There are no dragons here. } |
I'll try that a little later. The only problem with the rarity thing is that a rare will pop up all three at the same time. A user can then just open the links in different tabs and also get as many as they want. Which is why I want each egg to be unique. Then when you click one egg it can no longer be taken(adopted).
|
You have your adopt page set up to work differently than I have mine. I may be able figure out a solution if I see your code.
I have a few vague ideas of how this might be achieved. |
PHP Code:
|
Okay, since my adopting is set up different than yours I don't really have the ability to easily test this. The idea behind this code it to set a variable when the page is loaded and when one of the adoptables is clicked/adopted the value of that variable changes. And if the link is clicked a second time refresh the page so that it can't be adopted more than once.
Try this In the functions.php add this function: PHP Code:
Then change your adopt.php code to this modified version: PHP Code:
*is not sure if I did it right* |
I tried the function part first:
Parse error: syntax error, unexpected ';' in /home/taleofdr/public_html/functions/functions.php on line 117 |
Nevermind I figured out what was wrong. XP
Try this PHP Code:
|
Ok I think it's working :) I clicked on an egg and then tried to click it again and it said the id was invalid which means it can only be adopted once so that's good :) But... the rare and uncommon ones that I have still show up 3 at one time.
|
Have you assigned each adoptable with a rarity number?
|
Yes I have 5 dragon species available right now. Two are uncommon, One is uncommon, and the other two are rare.
|
Hmm... It just seems like an odd coincidence for multiple rare and uncommon to appear with the chances of them appearing....
I have only seen three kinds of egg in the lair. The shiny black and white, the one with two layers of scales and a colorful one. The black and white and scales one occur most often. |
All times are GMT -5. The time now is 07:17 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.