Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Mys v1.3.x Mods (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=42)
-   -   Mys v1.3.4 Simple NPC Battle (http://www.mysidiaadoptables.com/forum/showthread.php?t=5143)

NobodysHero 09-13-2016 11:21 AM

Good news is, I partly found the answer to my question. For whatever reason, it can't pull from "currentlevel". Changing it to "AdoptLevel", "Level", and "CurrentLevel" allows the page to load, but doesn't allow me to battle, nor does it show my "favpet", insisting that my pet isn't level 1 or higher.

Looking at the error log after each save, seems like it keeps bumping on how to call the level of the pet. x.x So, now what?

Dinocanid 09-17-2016 09:38 AM

I can't get this to work either. I can get to the page just fine, but it keeps insisting that my favpet isn't level 3.

Abronsyth 09-20-2016 07:58 PM

Quote:

Originally Posted by NobodysHero (Post 34918)
Good news is, I partly found the answer to my question. For whatever reason, it can't pull from "currentlevel". Changing it to "AdoptLevel", "Level", and "CurrentLevel" allows the page to load, but doesn't allow me to battle, nor does it show my "favpet", insisting that my pet isn't level 1 or higher.

Looking at the error log after each save, seems like it keeps bumping on how to call the level of the pet. x.x So, now what?


I responded via PM but I'll paste this here for other's sakes:
Try going into class_ownedadoptable.php and changing the line here:
PHP Code:

    protected $currentlevel

to this:
PHP Code:

    public $currentlevel

Save, upload, and let me know if that fixes your issue :)

Everyone having the issue please make sure this has been done and then, once done, get back to me on it.

NobodysHero 09-21-2016 12:15 AM

THANK YOU! <3 Okay, so it didn't like that both the "currentlevel" and "name" were protected, instead of public. Changing that made it work for me!

NobodysHero 09-23-2016 05:53 PM

Now that I have this working, I'd like to add some graphics and such to make it more fun to look at and give their opponent a "face". So, my question here is, how would I go about perhaps using random images above the "random opponent side? I know how to post the image of the pet, but a random image code would be awesome. 8D Would be neat to also use this to make it seem like the "battleground" as changed. Just a thought!

Abronsyth 09-25-2016 12:32 PM

Oh yeah, that is totally doable! I actually originally had it set up that way but was having issues with aligning it in a way that looked really good...but the random opponent image isn't too difficult. You just need the images...so, where you add opponent stats add in this:
PHP Code:

$images rand(1,3); 

Change the 3 to suit whatever number of images you want possible. Then, below the stats add this:
PHP Code:

if($images 1) {
$opimage "<img src='IMAGE URL'/>";
}
elseif(
$images 2) {
$opimage "<img src='IMAGE URL'/>";
}
elseif(
$images 3) {
$opimage "<img src='IMAGE URL'/>";


Where it says IMAGE URL just change it to the image's url for the different opponent images. Then where you display the opponent's stats just add in {$opimage}. So, for example:
PHP Code:

<td width='40%' style='text-align:right;vertical-align:bottom'
{
$opimage}<br>                    
<
i>Opponent</i><br
                    <
b>Sense:</b> {$opsense}<br
                    <
b>Speed:</b> {$opspeed}<br
                    <
b>Strength:</b> {$opstrength}<br
                    <
b>Stamina:</b> {$opstamina}<br
                    </
td


Now I will note that I just wrote this without testing it at all, so I don't guarantee it'll work as is, but it should give you the general idea!

Abronsyth 10-13-2016 02:17 PM

Hey all! I updated the main post so that it now includes the training section! My method of training is very lazy at the moment, just spend some money, click a button, raise the stats.

I hope you all enjoy it <3

Abronsyth 11-26-2016 08:29 AM

Finally updated!

Now includes a Trophies section, and a little extras section :)

Ittermat 12-09-2016 09:33 PM

couple questions- I tried adding in the OP image coding but it keeps giving me errors... WHERE exactly do I put those? CAn you explain a little better please?

Also the trophies- where exactly and on which file do I put the calling code?

As well as How would I get my fave pets image for battling as well? {$Favepet} does not seem to work lol (And how would I flip the images so they're actually facing each other?)

EDIT: one more question- how would I make it so that they actually recieve items for winning? whether random or not so random lol...

(Apologies as I am a super noob at this)

Abronsyth 12-10-2016 08:10 AM

1. In the battleview.php file find this:
PHP Code:

 /*Random Opponent Stats*/ 
        
$opsense rand(1,100); 
        
$opstamina rand(1,100); 
        
$opstrength rand(1,100); 
        
$opspeed rand(1,100); 

Insert the image code right below that, so it looks like this:
PHP Code:

 /*Random Opponent Stats*/ 
$opsense rand(1,100); 
$opstamina rand(1,100); 
$opstrength rand(1,100); 
$opspeed rand(1,100); 
$images rand(1,3);  
if(
$images 1) {
$opimage "<img src='IMAGE URL'/>";
}
elseif(
$images 2) {
$opimage "<img src='IMAGE URL'/>";
}
elseif(
$images 3) {
$opimage "<img src='IMAGE URL'/>";


The image url needs to start with http:// and end in .jpg, .jpeg, .png, or .gif

2. You put the calling code wherever you want to display the trophies. So if you want to display it for the owner of a pet when they go to manage it, you can go to myadoptsview.php and add it within the manage function. This works best if you already have "profiles" set up. But for a quick example, here is the manage function with it added in:
PHP Code:

    public function manage(){
        
$mysidia Registry::get("mysidia");
        
$aid $this->getField("aid")->getValue();
        
$name $this->getField("name")->getValue();
        
$image $this->getField("image");

        
$trophies $mysidia->db->select("owned_adoptables", array("trophies"), "aid = '{$adopt->getAdoptID()}'")->fetchColumn();

        
$document $this->document;        
        
$document->setTitle("Managing {$name}");
        
$document->add($image);
        
$document->add(new Comment("<br><br>This page allows you to manage {$name}.  Click on an option below to change settings.<br>
<center>
{$name} has {$trophies} trophies!</center><br>"));
        
        
$document->add(new Image("templates/icons/add.gif"));
        
$document->add(new Link("levelup/click/{$aid}"" Level Up {$name}"TRUE));
        
$document->add(new Image("templates/icons/stats.gif"));
        
$document->add(new Link("myadopts/stats/{$aid}"" Get Stats for {$name}"TRUE));
        
$document->add(new Image("templates/icons/bbcodes.gif"));
        
$document->add(new Link("myadopts/bbcode/{$aid}"" Get BBCodes / HTML Codes for {$name}"TRUE));
           
$document->add(new Image("templates/icons/title.gif"));
        
$document->add(new Link("myadopts/rename/{$aid}"" Rename {$name}"TRUE)); 
        
$document->add(new Image("templates/icons/trade.gif"));
        
$document->add(new Link("myadopts/trade/{$aid}"" Change Trade status for {$name}"TRUE)); 
        
$document->add(new Image("templates/icons/freeze.gif"));
        
$document->add(new Link("myadopts/freeze/{$aid}"" Freeze or Unfreeze {$name}"TRUE)); 
        
$document->add(new Image("templates/icons/delete.gif"));
        
$document->add(new Link("pound/pound/{$aid}"" Pound {$name}"TRUE)); 
    } 

3. The base code for displaying it is this:
PHP Code:

<img src='{$favpet->getImage()}'/> 

But you also need to include this information to make it callable:
PHP Code:

$profile $mysidia->user->getprofile();
$favpet = new OwnedAdoptable($profile->getFavpetID()); 

As for flipping, not sure, I googled it and apparently this works (I have not tested it):
PHP Code:

$opimage "<img src='IMAGE URL' style='-moz-transform: scale(-1, 1);-webkit-transform: scale(-1, 1);-o-transform: scale(-1, 1);transform: scale(-1, 1);filter: FlipH;' />"

4. To directly insert an item into a user's inventory you use this string:
PHP Code:

$item "ItemName"

PHP Code:

$newitem = new StockItem($item);  
$newitem->append(1$mysidia->user->username); 



All times are GMT -5. The time now is 01:57 AM.

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