Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Help with a item function (http://www.mysidiaadoptables.com/forum/showthread.php?t=4663)

Kyttias 12-11-2014 10:36 AM

So the end result everyone is wanting is:

normal && female && design A = use image A
alt && female && design A = use image B
normal && male && design A = use image C
alt && male && design A = use image D

But I'm guessing you don't just want one design, but, potentially, many designs? In the case above, if "design A" were "midnight sparkles" then you'd be able to have a pet with this design on both male and female pets, alternate or not.

It's like paintbrushes back on Neopets, only, you also have to take rarer alternate versions of a pet species into consideration, too. If a user is blessed with a rare alternate, they want it to still look just as special when it has its design applied!

I think what's going to need to be done is an entirely new approach. You'll want a new column in the database to hold the design names.

I'll see if I can look into this soon, but it may take a while. ^^ I was actually kind of wanting something similar.

parayna 12-11-2014 12:09 PM

Oh, OK. XD Yeah, I think that is kind of what people are wanting. So basically I think there would be 4 different images taken for one item... a male and female normal image, and an alt male and female image.. I think that's what it would be..

Kyttias 12-11-2014 12:42 PM

Because I've got the alternate gender mod working on my site, I don't have two types of females and two types of males, (alts that is), I just have females and males, and those are the alts.

female && design A = use image A
male && design A = use image B

Without the alt gender mod it would be possible, but you'd have to make each gender it's own species again. The alt gender mod just replaces the alt system... So I'd rather focus on this?

So I guess my first post there was misleading.

What it will actually be is just this:

normal && design A = use image A
alt && design A = use image B

In any case, it will work for people using the gender mod and not. But it won't magically make the gender mod have alts again. It'll just make sure the appropriate gender gets the appropriate image, just like it would make alt or not get the appropriate image.

parayna 12-11-2014 12:57 PM

Oh, alright. Now I understand C: Sounds good! ^_^

AndromedaKerova 04-24-2015 05:41 PM

Sorry to revive an older thread but I'm still interested in this.

I now use the alt gender mod so my alt images are only for males while females use the normal one.

I want to keep that obviously but it should be a single potion/brush paints the species a different one of two images according to alt/gender status.

With multiple items created this way, one could effectively have a lot of new designs/colours for that single species without needing to actually have a "many alt images" kind of mod.

kristhasirah 04-03-2017 10:17 AM

I know this is an old thread but wanted to update the code for a change of skin ^^
Probably not the best way of doing it but it works:

PHP Code:

function items_Skin($item$adopt){
  
$mysidia Registry::get("mysidia");
  
$type $adopt->type;
  
$currentLevel $adopt->currentlevel;
        if(
stripos($type"Dragon") !== FALSE){
           switch(
$type){
                case 
"Red Fairy Dragon"
        
$note "<h1>{$adopt->name} wont eat the food</h1><script>$(\"h1:contains('Action Completed!')\").remove();</script>{$adopt->name} turns in to ashes the food... Be prepared that look means that is planing to make you fall in a prank."; break;
                case 
"Moon Fairy Dragon"
        
$note "<h1>{$adopt->name} wont eat the food</h1><script>$(\"h1:contains('Action Completed!')\").remove();</script>{$adopt->name} blinds you... When you can once again see clearly {$adopt->name} cant be found..."; break;
                default: 
        
$note "<h1>{$adopt->name} wont eat the food</h1><script>$(\"h1:contains('Action Completed!')\").remove();</script>{$adopt->name} gives you a mean look, and turns in to ashes the food! Only the ponies eat that thing";
        }
        }
        else if(
$currentLevel 10){
            
$note "Your adoptable is not at level 10 yet.";
        }
        else if(
$type == "Fairy Pony"){
            
$note "Your adoptable is not chosen to use this skin.";
        }
else {
$delitem $item->remove();
  
$imageurl $mysidia -> db -> select ("owned_adoptables", array("imageurl"), "aid='{$adopt->aid}' and owner ='{$item->owner}'") -> fetchColumn();
        if(
stripos($type"Pony") !== FALSE){ 
                   switch(
$type){ 
        case 
"Starnight Pony"
        switch(
$gender){
                case 
"f"
                
$num rand(1,2);
                 switch (
$num) { 
                 case 
1$imageurl "http://yoursitegoeshere.com/picuploads/png/cc956394e43c60dc8df3be2e5557fe40.png"; break;
                 case 
2$imageurl "http://yoursitegoeshere.com/picuploads/png/65a41dd82fbcb9a7e269dcbdef7249ec.png"; break;  
                 }
                 break;       
        default: 
                
$num rand(1,2);
                 switch (
$num) { 
                 case 
1$imageurl "http://yoursitegoeshere.com/picuploads/png/cc956394e43c60dc8df3be2e5557fe40.png"; break;
                 case 
2$imageurl "http://yoursitegoeshere.com/picuploads/png/65a41dd82fbcb9a7e269dcbdef7249ec.png"; break;
                 }               
                  
$mysidia->db->update("owned_adoptables", array("imageurl" => $imageurl,), "aid ='{$adopt->aid}' and owner='{$item->owner}'");
$note "Success! The <b>{$item->itemname}</b> has worked its magic. {$adopt->name} now is using a new color.";
return 
$note;
}
//END Case starnight Pony
       
case "Fire Pony"
        switch(
$gender){
                case 
"f"
                
$num rand(1,2);
                 switch (
$num) { 
                 case 
1$imageurl "http://yoursitegoeshere.com/picuploads/png/cc956394e43c60dc8df3be2e5557fe40.png"; break;
                 case 
2$imageurl "http://yoursitegoeshere.com/picuploads/png/65a41dd82fbcb9a7e269dcbdef7249ec.png"; break;  
                 }
                 break;       
        default: 
                
$num rand(1,2);
                 switch (
$num) { 
                 case 
1$imageurl "http://yoursitegoeshere.com/picuploads/png/cc956394e43c60dc8df3be2e5557fe40.png"; break;
                 case 
2$imageurl "http://yoursitegoeshere.com/picuploads/png/65a41dd82fbcb9a7e269dcbdef7249ec.png"; break;
                 }               
                  
$mysidia->db->update("owned_adoptables", array("imageurl" => $imageurl,), "aid ='{$adopt->aid}' and owner='{$item->owner}'");
$note "Success! The <b>{$item->itemname}</b> has worked its magic. {$adopt->name} now is using a new color.";
return 
$note;
}
//END Case Fire Pony

        
default: 
        switch(
$gender){
                case 
"f"
                
$num rand(1,2);
                 switch (
$num) { 
                 case 
1$imageurl "http://yoursitegoeshere.com/picuploads/png/cc956394e43c60dc8df3be2e5557fe40.png"; break;
                 case 
2$imageurl "http://yoursitegoeshere.com/picuploads/png/65a41dd82fbcb9a7e269dcbdef7249ec.png"; break;  
                 }
                 break;       
        default: 
                
$num rand(1,2);
                 switch (
$num) { 
                 case 
1$imageurl "http://yoursitegoeshere.com/picuploads/png/cc956394e43c60dc8df3be2e5557fe40.png"; break;
                 case 
2$imageurl "http://yoursitegoeshere.com/picuploads/png/65a41dd82fbcb9a7e269dcbdef7249ec.png"; break;
                 }               
                  
$mysidia->db->update("owned_adoptables", array("imageurl" => $imageurl,), "aid ='{$adopt->aid}' and owner='{$item->owner}'");
$note "Success! The <b>{$item->itemname}</b> has worked its magic. {$adopt->name} now is using a new color.";
return 
$note;
}
//END Default
return $note;
}
//END Type 
}//END Stripos
}//END ELSE
return $note
}
//END Function 

How this code works? well is kind of simple :
PHP Code:

        if(stripos($type"Dragon") !== FALSE){
           switch(
$type){
                case 
"Red Fairy Dragon"
        
$note "<h1>{$adopt->name} wont eat the food</h1><script>$(\"h1:contains('Action Completed!')\").remove();</script>{$adopt->name} turns in to ashes the food... Be prepared that look means that is planing to make you fall in a prank."; break;
                case 
"Moon Fairy Dragon"
        
$note "<h1>{$adopt->name} wont eat the food</h1><script>$(\"h1:contains('Action Completed!')\").remove();</script>{$adopt->name} blinds you... When you can once again see clearly {$adopt->name} cant be found..."; break;
                default: 
        
$note "<h1>{$adopt->name} wont eat the food</h1><script>$(\"h1:contains('Action Completed!')\").remove();</script>{$adopt->name} gives you a mean look, and turns in to ashes the food! Only the ponies eat that thing";
        }
        }
        else if(
$currentLevel 10){
            
$note "Your adoptable is not at level 10 yet.";
        } 
        else if(
$type == "Fairy Pony"){
            
$note "Your adoptable is not chosen to use this skin.";
        } 

This part makes the selected adopt unable to get a skin change and also limit the use to pets that are level 10<-- you can change this to the max level you are using.
the second else if($type == "Fairy Pony"){ <-- makes unable that specific type of pony unable to use the potion
The type of my adopts always have "Pony" Or "Dragon" : if(stripos($type, "Dragon") !== FALSE){ <-- stripos is used for searching in type for the word "dragon" and makes those adopts unable to use the potion.
switch($type){
case "Red Fairy Dragon": <-- you can change this part for the full type of your creature if you want to give them a specific message.
default: <--- this is used for the rest of the adopts.

PHP Code:

else {
$delitem $item->remove();
  
$imageurl $mysidia -> db -> select ("owned_adoptables", array("imageurl"), "aid='{$adopt->aid}' and owner ='{$item->owner}'") -> fetchColumn();
        if(
stripos($type"Pony") !== FALSE){ 
                   switch(
$type){ 
        case 
"Starnight Pony"
        switch(
$gender){
                case 
"f"
                
$num rand(1,2);
                 switch (
$num) { 
                 case 
1$imageurl "http://yoursitegoeshere.com/picuploads/png/cc956394e43c60dc8df3be2e5557fe40.png"; break;
                 case 
2$imageurl "http://yoursitegoeshere.com/picuploads/png/65a41dd82fbcb9a7e269dcbdef7249ec.png"; break;  
                 }
                 break;       
        default: 
                
$num rand(1,2);
                 switch (
$num) { 
                 case 
1$imageurl "http://yoursitegoeshere.com/picuploads/png/cc956394e43c60dc8df3be2e5557fe40.png"; break;
                 case 
2$imageurl "http://yoursitegoeshere.com/picuploads/png/65a41dd82fbcb9a7e269dcbdef7249ec.png"; break;
                 }               
                  
$mysidia->db->update("owned_adoptables", array("imageurl" => $imageurl,), "aid ='{$adopt->aid}' and owner='{$item->owner}'");
$note "Success! The <b>{$item->itemname}</b> has worked its magic. {$adopt->name} now is using a new color.";
return 
$note;
}
//END Case starnight Pony
       
case "Fire Pony"
        switch(
$gender){
                case 
"f"
                
$num rand(1,2);
                 switch (
$num) { 
                 case 
1$imageurl "http://yoursitegoeshere.com/picuploads/png/cc956394e43c60dc8df3be2e5557fe40.png"; break;
                 case 
2$imageurl "http://yoursitegoeshere.com/picuploads/png/65a41dd82fbcb9a7e269dcbdef7249ec.png"; break;  
                 }
                 break;       
        default: 
                
$num rand(1,2);
                 switch (
$num) { 
                 case 
1$imageurl "http://yoursitegoeshere.com/picuploads/png/cc956394e43c60dc8df3be2e5557fe40.png"; break;
                 case 
2$imageurl "http://yoursitegoeshere.com/picuploads/png/65a41dd82fbcb9a7e269dcbdef7249ec.png"; break;
                 }               
                  
$mysidia->db->update("owned_adoptables", array("imageurl" => $imageurl,), "aid ='{$adopt->aid}' and owner='{$item->owner}'");
$note "Success! The <b>{$item->itemname}</b> has worked its magic. {$adopt->name} now is using a new color.";
return 
$note;
}
//END Case Fire Pony

        
default: 
        switch(
$gender){
                case 
"f"
                
$num rand(1,2);
                 switch (
$num) { 
                 case 
1$imageurl "http://yoursitegoeshere.com/picuploads/png/cc956394e43c60dc8df3be2e5557fe40.png"; break;
                 case 
2$imageurl "http://yoursitegoeshere.com/picuploads/png/65a41dd82fbcb9a7e269dcbdef7249ec.png"; break;  
                 }
                 break;       
        default: 
                
$num rand(1,2);
                 switch (
$num) { 
                 case 
1$imageurl "http://yoursitegoeshere.com/picuploads/png/cc956394e43c60dc8df3be2e5557fe40.png"; break;
                 case 
2$imageurl "http://yoursitegoeshere.com/picuploads/png/65a41dd82fbcb9a7e269dcbdef7249ec.png"; break;
                 }               
                  
$mysidia->db->update("owned_adoptables", array("imageurl" => $imageurl,), "aid ='{$adopt->aid}' and owner='{$item->owner}'");
$note "Success! The <b>{$item->itemname}</b> has worked its magic. {$adopt->name} now is using a new color.";
return 
$note

and this part is where the the image is changed
same as the first stripos this: if(stripos($type, "Pony") !== FALSE){ allows only the adopts that have pony in their type to use the potion
The switch($gender){
case "f": <-- this is used for checking if the adopt is female and give it the selected image, the default one is used for the male.

I combined parts of the codes that kyttias shared with us (gender change potion and shops items)

This part: $num = rand(1,2);
switch ($num) {
is for randomly chose the image the adopt will be using
and lastly:
case 1: $imageurl = "http://yoursitegoeshere.com/picuploads/png/cc956394e43c60dc8df3be2e5557fe40.png"; break;
case 2: $imageurl = "http://yoursitegoeshere.com/picuploads/png/65a41dd82fbcb9a7e269dcbdef7249ec.png"; break;
is where you add the image used for the adopt ^^

It dont matter if you are using the alternate image for the female. once the NULL is replaced with an url image, the adopt will stop using the alternate image and start using the new one.

For this code to fully work you need to edit the class_privateitem
and add
PHP Code:

         case "Skin":
            
$message items_Skin($this$owned_adoptable);
            break; 

and in your database search for adopts_items_function and copy any of the already there functions and change the name for skin and add a small description telling you what the item does.
in this post is the code for reversing the effect of the skin:
http://mysidiaadoptables.com/forum/s...3&postcount=19

i know the names i use for the items are lame, so change it to one that fit with your tastes ^^
Feel Free to change/edit the code so it can fit with your site, you can add more images by adding more case: and changing the rand.

Hope this can be useful for someone ^^


All times are GMT -5. The time now is 08:51 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.