Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Tutorials and Tips

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 01-26-2011, 03:12 PM
PTGigi's Avatar
PTGigi PTGigi is offline
Crazily Friendly~HoF
 
Join Date: Jul 2009
Location: Somewhere >.>
Posts: 370
Gender: Female
Credits: 26,267
PTGigi
Default Exploring System

EDIT (5/23/12) I am no longer updating this (seeing as I no longer am working on MM2+). But please note this tutorial is apparently outdated and may not work properly with the main script without lots of extra work.

Alright, so since MM2+ is heavily explore based I have to do this a lot XD So I figured I'd post up a tutorial to maybe help some people make their own systems! Now note:
MY EXPLORE SYSTEM IS NOT 100% COMPLETE

Thus, I will be posting this information as I go through.

Also:
I'm going to assume each part is long and will go over the limit per post (because my code kindly already does this XD) And it'll be easier to see each separate part. :D EDIT: Actually I just tested, it wouldn't go over this magical limit (hopefully) but it'll make it easier so I can link to the second/third post to save you the scrolling :3 The three parts of this tutorial will be:
-'Simple' NPC interactive with user-Complete
-Exploring, finding, seeking, etc-Nearly done
-Extra stuff (finding something, interacting with the environment, getting a new adoptable, etc, etc)-Not started? IDK

So now for PART 1!!!


Part 1--NPC Interaction

Your user is stuck in the randomness of empty space of the internet OH NO!!! But wait! There's a random person here too! Oh! IT'S AN NPC *shot*

NPC stands for Non-Person-Controlled. Basically it's a character who is not controlled by you, but can still interact (or not?) with their environment given user input.

So now we need some information before we make our code. We need to make this NPC. Here's some things to keep in mind:

Quote:
-Name-
Seriously, you need one. Unless it's some random dude who wears a cloak (not a Mewtwo reference) who you don't know who it is you can not have a name. But otherwise make a name. You could do something common like Bob, or Mary, or Chris, or Susan or something, so do something epical like Huyji, Frezro, etc. Also feel free to make up based upon stuff, like if you have a fire lizard go ahead with Char, Blaze, Fiora, etc as a name :3
-Species-
Is it a human? Is it a talking dog? Is it some magical made up creature? Make sure people know (images can do good or a quick discrete description)
-Looks-
whether you character looks like you might want to make clear so the user can visualize the situation. (Images are good once again). Maybe the person is tall and looms over peeps, maybe they're really small so you have to pick them up in your hand to speak to them.
-Speech-
How do they talk? Do they use proper grammar? Do they use slang? What about accents? Or occasionally shifting to their native language. NOTE: Under no means use chatspeak! It looks VERY unprofessional...
Here's some quick examples (all the same saying just different ways of saying it):
"Hello there!"
"Hiya!"
"Well hello there!"
"Howdy!"
"Hola!"
"Welcome stranger!"

And so on! If I can make one phrase in 6+ different ways you can make your characters speeches the same!

Now that we got our speech complete maybe we begin coding! But you need to plan! Where are these/this people/person? Are they in a snowy field, a volcano, a jungle?

For the sake of this example we'll be in a magical forest (shush). In this magical forest there are mysteries, so what would someone do in a new place? Ask for help!

Now we begin coding!

Part 1b--Beginning the code

So what you need to do is find a file in your main folder called "blank.php". On your computer, right click the file and go down to copy (yours might have a duplicate button, IDK), after you've copied it right click again (not on a file, on a blank space in your folder) and hit 'paste'. Your pasted document should be called "blank copy.php" If not it'll ask you to rename it or change it's name to "blank (2).php". Either way just accept that. Now rename your file to something you can remember, I suggest not 'explore.php' since you might want more explore areas. For this example we'll be using a fake file called "forest.php".

Now open up your file and go down to "Output to user". Underneath that we'll begin our quest! But first paste in:
PHP Code:
$act $_GET["act"];
$act preg_replace("/[^a-zA-Z0-9\\040.]/"""$act);
$act secure($act);

$num $_GET["num"];
$num preg_replace("/[^a-zA-Z0-9\\040.]/"""$num);
$num secure($num); 
Act is for the action, and Num is for speech (you'll see in a bit)

Now we can't just throw ourselves into a conversation! Introduce the area, what do you see?
So now we add:
PHP Code:
if ($act == ""){
$article_title "Magical Forest!";
$article_content "You find yourself in a Magical Forest. Many small   dragons dance about in the sunlit air (blah, blah, add more  description,  don't take mine please) Oh look a dragon! It seems  friendly want to go  talk to it?<br><br>
<a href='/forest.php?act=talk'>Talk to the dragon!</a><br>
<a href='/forest.php?act=enter'>IGNORE FOR NOW (part 2)</a>"
;

So the $act == "" is just saying when nothing is defined. But wait! My first link has defined an $act for us! It's called 'talk'.

So we need to define this conversation, but we don't just jump right in! We need to introduce the situation

So in order to do that we must define $act == talk! Let's do that now:
PHP Code:
else if ($act == "talk"){
$article_title "Talking";
$article_content "You head over to take to the dragon, but as you do   so another dragon and a puppy come over as well. 'Hello there!' shouts   the purple, serpentine female dragon, 'Can we help you with something?   My name is Lavendra, and this is my mate Kyto. That's Fluffy.'  She  says  this while pointing to the dragon first, then the puppy. She  smiles at  you and waits for a response. The orange male watches you,  not sure if  he trusts you. The puppy honestly doesn't care and is just  rolling  around in the grass.<br><br>
<a href='/forest.php?act=lavendra&num=0'>Talk with Lavendra</a><br>
<a href='/forest.php?act=kyto&num=0'>Talk with Kyto</a><br>
<a href='/forest.php?act=fluffy'>Pet Fluffy</a><br>
<a href='/forest.php?act=enter'>IGNORE FOR NOW (part 2)</a>"
;

So now we add even more areas we need to define! We have two characters to speak with, and a single character to interact with! The bottom link is for those people who want to explore but we're not there yet

So the conversation for Lavendra and Kyto is exactly the same, excluding what they say exactly and how they say it. Since they are the same I'll walk you through Lavendra and assume you can do others as well after this

So now we start with a simple definition of $act == lavendra and $num==0:
PHP Code:
else if ($act == "lavendra"){
$article_title "Lavendra";
    if (
$num == "0") {
    
$article_content "Lavendra: 'What can I do for you?'<br><br>";
    }
    else {
    
$article_content "Lavendra: 'I'm sorry I don't understand, what can I do for you?'<br><br>";
    }
    
$article_content $article_content."<a href='/forest.php?act=talk2'>You: 'Nevermind.'</a>";


Now you see the two extra elements I added? Since the 'greeting' is in 0 and we are defining conversation by number, what if the user wants to be sneaky or an error occurs and a wrong number is entered? Just make the character not understand.

The last bit is to end the conversation, you need this so you can...well...stop talking XD You see it's called 'talk2' I'll explain that in a second.

But that's boring, a simple "How can I help you" then stop talking? No! We need to talk! Let's now define a question, how about we ask them about Kyto? He's an interesting guy.
PHP Code:
else if ($act == "lavendra"){
$article_title "Lavendra";
    if (
$num == "0") {
    
$article_content "Lavendra: 'What can I do for you?'<br><br>";
    }
    else if (
$num == "1"){
    
$article_content "Lavendra: 'Oh Kyto? He's my mate!' She smiles at   this, 'We've been together for over one hundred years. I've heard this   is a long time for you humans. He isn't very human-friendly though, he   was attacked as a child you see...Anyway, can I help you with  something  else?'<br><br>";
     }
    else {
    
$article_content "Lavendra: 'I'm sorry I don't understand, what can I do for you?'<br><br>";
    }
    if (
$num != "1"){
    
$article_content $article_content."<a   href='/forest.php?act=lavendra&num=1'>You: 'Tell me about   Kyto.'</a><br>";
     }
    
$article_content $article_content."<a href='/forest.php?act=talk2'>You: 'Nevermind.'</a>";


Right, so now I've added in two key areas. We've added in the conversation about Kyto and a link to this conversation. Now you may have noticed the "if ($num != "1") " around the Kyto question link. This is because we do not want to re-ask the question we are on! So if we are on 'num=1' we do not want a link for 'num=1'. For those who did not know != means 'does not equal'.

Now we can add as many more topics as we want! Just remember to make a link to each one and make each a new number. So here's our example again after adding some more!

PHP Code:
else if ($act == "lavendra"){
$article_title "Lavendra";
    if (
$num == "0") {
    
$article_content "Lavendra: 'What can I do for you?'<br><br>";
    }
    else if (
$num == "1"){
    
$article_content "Lavendra: 'Oh Kyto? He's my mate!' She smiles at   this, 'We've been together for over one hundred years. I've heard this   is a long time for you humans. He isn't very human-friendly though, he   was attacked as a child you see...Anyway, can I help you with  something  else?'<br><br>";
     }
    else if (
$num == "2"){
     
$article_content "Lavendra: 'Fluffy is the cutest, lil' puppy   ever! And that's all you need to know! Can I help you with something   else?'<br><br>";
      }
    else if (
$num == "3"){
     
$article_content "Lavendra: 'This forest is a MAGICAL forest.   Serious, what more do you need to know than that?...Anyway, can I help   you with something  else?'<br><br>";
      }
      else {
    
$article_content "Lavendra: 'I'm sorry I don't understand, what can I do for you?'<br><br>";
    }
    if (
$num != "1"){
    
$article_content $article_content."<a   href='/forest.php?act=lavendra&num=1'>You: 'Tell me about   Kyto.'</a><br>";
     }
    if (
$num != "2"){
     
$article_content $article_content."<a   href='/forest.php?act=lavendra&num=1'>You: 'Tell me about  Fluffy.'</a><br>";
      }
     if (
$num != "3"){
     
$article_content $article_content."<a   href='/forest.php?act=lavendra&num=1'>You: 'Tell me about this  forest.'</a><br>";
      }
     
$article_content $article_content."<a href='/forest.php?act=talk2'>You: 'Nevermind.'</a>";


There, now we see a bit more of the world beginning to develop! You can add as much conversation topics as you want too. You can also add follow-up questions by setting the "if ($num == "#")" the # being the number of the conversation you are responding to

Once again you can add as many characters as you want interacting in this fashion. The only thing you need to change is the "else if($act == "name")", "$article_title", and the actual answers.

But what about a non-speaking NPC who just reacts? Like say...A PUPPY!!! What if we want to go ahead and pet the cute puppy! Well let's do that shall we?

Part 1c-Petting The Puppy (etc)

Now if you remember our talk page one of the links was Pet Fluffy! (see the third link?):
PHP Code:
else if ($act == "talk"){
$article_title "Talking";
$article_content "You head over to take to the dragon, but as you do   so another dragon and a puppy come over as well. 'Hello there!' shouts   the purple, serpentine female dragon, 'Can we help you with something?   My name is Lavendra, and this is my mate Kyto. That's Fluffy.'  She  says  this while pointing to the dragon first, then the puppy. She  smiles at  you and waits for a response. The orange male watches you,  not sure if  he trusts you. The puppy honestly doesn't care and is just  rolling  around in the grass.<br><br>
<a href='/forest.php?act=lavendra&num=0'>Talk with Lavendra</a><br>
<a href='/forest.php?act=kyto&num=0'>Talk with Kyto</a><br>
<a href='/forest.php?act=fluffy'>Pet Fluffy</a><br>
<a href='/forest.php?act=enter'>IGNORE FOR NOW (part 2)</a>"
;

Now you should notice something right away. There is no "&num=0". This is because it is not necessarily needed. If you want to add more interactions once you select to interact with the puppy just follow the above but paste in our finished code (excluding the $num !=)

So first we need to define the actual subpage of our puppy:
PHP Code:
else if ($act == "fluffy"){
    
$rand rand(0,1);
    
$article_title "Fluffy";
    if (
$rand == 0){
    
$article_content "Fluffy just keeps rolling on the grass and ignores you.";
    }
    else if (
$rand == 1){
    
$article_content "Fluffy lets you pet him. He barks happily while you do so.";
    }
    else {
    
$article_content "Fluffy completely ignores you and walks away.";
    }
    
$article_content $article_content."<br><br>
    <a href='/forest.php?act=fluffy'>Pet Fluffy again</a><br>
    <a href='/forest.php?act=talk2'>Stop petting Fluffy</a>"
;

Now you'll see I actually just finished the whole code for you! Shocking isn't it? Now what do we have here? Well I'll explain.

First, you are defining to new subpage of Fluffy. Fluffy is subpage worthy

Secondly, you are defining a rand number with this statement:
PHP Code:
     $rand rand(0,1); 
This specific statement will create a random number between 0 and 1 (ie, 1 or 0) and make the variable $rand equal that number.

Next we define the article title, pretty boring? XD

Fourth, we are defining all the random actions this puppy could do. For simplicity I only added 3. The first two are actions the puppy does while the 3rd is just in case of an error we have our backs covered.
PHP Code:
    if ($rand == 0){
    
$article_content "Fluffy just keeps rolling on the grass and ignores you.";
    }
    else if (
$rand == 1){
    
$article_content "Fluffy lets you pet him. He barks happily while you do so.";
    }
    else {
    
$article_content "Fluffy completely ignores you and walks away.";
    } 
And at long last we end with an option to continue petting this cute bundle of fur or to just stop. (the <br><br> right after our random action is to prevent the first link from latching onto the end of our random paragraph)

NOTE: When working with random outcomes it's always good to keep in mind a couple times.
1) The less options you have the higher chance of a repeat. Since I only have two that chance is extremely high.
2) Every time you add a new outcome MAKE SURE to change the second number in the $rand to be equal to that of your highest number, that'll make sure all your options work.

Now you may ask: Are we done now? NO! We still have to make the 'talk2', 'talk3' and 'enter' work!

Part 1d-Talk2, Talk 3, and Enter

Okay, so now we have already defined links for 'talk2' and 'enter', but what are these exactly? We'll begin with Talk2 and Talk3.

Now if you remember 'talk' is when we first met these dragon, we don't know who they are, we just got there. But after chatting with them you do know them a bit better, also they'll be standing there and not walking into the picture.

'talk2' is just like 'talk' because it lists the people you can converse with but it changes the $article_content because the people are already there and we know them a bit better. So just to put simply your talk2 should look a bit like:
PHP Code:
else if ($act == "talk2"){
 
$article_title "Talking";
 
$article_content "After chatting, you turn back to the main group.  Fluffy is just rolling around at the feet of Lavendra and Kyto, while  those two both watch you. What will you do?<br><br>
 <a href='/forest.php?act=lavendra&num=0'>Talk with Lavendra</a><br>
 <a href='/forest.php?act=kyto&num=0'>Talk with Kyto</a><br>
 <a href='/forest.php?act=fluffy'>Pet Fluffy</a><br>
 <a href='/forest.php?act=enter'>IGNORE FOR NOW (part 2)</a>"
;
 } 
See? easy! Just like before!

But now you must wonder why we need ANOTHER talk. 'talk3' is for when you return from your valiant exploration!

PHP Code:
else if ($act == "talk3"){
 
$article_title "Talking";
 
$article_content "You come back from exploring to find the group in the same place. What will you do?<br><br>
 <a href='/forest.php?act=lavendra&num=0'>Talk with Lavendra</a><br>
 <a href='/forest.php?act=kyto&num=0'>Talk with Kyto</a><br>
 <a href='/forest.php?act=fluffy'>Pet Fluffy</a><br>
 <a href='/forest.php?act=enter'>IGNORE FOR NOW (part 2)</a>"
;
 } 
And there! Done! Easy right?

But what is this 'enter'? Why is it so special? Well that actually has to wait for part 2 XD

BUT! Keep thinking of a few things!

-What areas are there to explore? Yeah, yeah it's a forest, but what's IN the forest? Maybe a thicket, maybe deeper in the forest, maybe a stream, or whatnot! These 'subareas' will be defined in part 2, as well as what you can find/interact with while exploring!
-What can you find? Pets, items, money, nothing, new areas, etc! And yes I just stated everything I will cover XD (note: items is not, item items, because I do not know that YET. It's just items as in OMG I FOUND A BOTTLE *action**action**action*)
-How can you interact with your environment?
-What does the landscape look like? Yes, you'll need to make images for part 2
-How should the page be set up? More will come later but basically it'll have an Event, an Image, and a Description of the Event.
__________________


"I see now that the circumstances of one's birth are irrelevant; it is what you do with the gift of life that determines who you are."~Mewtwo
My Adoptables|Nuzlocke Webcomic

Last edited by PTGigi; 05-23-2012 at 06:43 AM.
Reply With Quote
  #2  
Old 01-26-2011, 03:13 PM
PTGigi's Avatar
PTGigi PTGigi is offline
Crazily Friendly~HoF
 
Join Date: Jul 2009
Location: Somewhere >.>
Posts: 370
Gender: Female
Credits: 26,267
PTGigi
Default

<post saving section for part 2--Exploring-exploring>

Gah sorry for taking so long D: Okay before we start please note, I'm sure there is a faster and more efficient way to do whatever I post and you may happily do that! (ie iframes for whatnot) But as Gigi I tend to find a simple, yet effective way to do things XD Also I tend to find a way that involves a lot of rand(); I love random stuff 8D

Being worked on

-Random Search System
-Finding and gaining Money (works with multiple currencies)
-Finding random 'items' (not item-items, but stuff you can interact with)
-Finding nothing (durr easy XD)
-Finding a new path
-Multiple areas within one area (i.e. Within the magical forest a stream area, a mushroom area, and maybe just a deeper part of the forest)
-Background image for location
-Overlayed image for the event (i.e. a pile of coins or an adoptable or whatnot on top of your image of the background for the location)
__________________


"I see now that the circumstances of one's birth are irrelevant; it is what you do with the gift of life that determines who you are."~Mewtwo
My Adoptables|Nuzlocke Webcomic

Last edited by PTGigi; 02-22-2011 at 04:40 PM.
Reply With Quote
  #3  
Old 01-26-2011, 03:14 PM
PTGigi's Avatar
PTGigi PTGigi is offline
Crazily Friendly~HoF
 
Join Date: Jul 2009
Location: Somewhere >.>
Posts: 370
Gender: Female
Credits: 26,267
PTGigi
Default

<post saved for part 3--Extra add-ons>

Will/Might include:
-Design of Explore Page
-Save Points
-Quest Log
-Adventure ideas?
-Riddles
-Guest Block
-Area Block
-Pet Block (?)
-Possible 'Mini' battles (not full since I haven't gotten there yet X3)
-Possible page redirect for when you FAIL
-Possible change of images by time of day (yeah I like this time of day stuff from my Javascript-ness )
-Possible Random bg images
-Different style of exploring (just the look of the page, nothing massive)
__________________


"I see now that the circumstances of one's birth are irrelevant; it is what you do with the gift of life that determines who you are."~Mewtwo
My Adoptables|Nuzlocke Webcomic

Last edited by PTGigi; 02-22-2011 at 04:37 PM.
Reply With Quote
  #4  
Old 01-26-2011, 03:17 PM
Tequila's Avatar
Tequila Tequila is offline
The Grim One
 
Join Date: Jan 2009
Location: Souther Tier, New York State
Posts: 1,356
Gender: Female
Credits: 97,196
Tequila is on a distinguished road
Default

*watches*

This looks rather useful.
__________________
Artist. Designer. Gamer. Mother.
[portfolio] [tarot] [Rune Hollow] [freebies]
Reply With Quote
  #5  
Old 01-26-2011, 05:21 PM
PTGigi's Avatar
PTGigi PTGigi is offline
Crazily Friendly~HoF
 
Join Date: Jul 2009
Location: Somewhere >.>
Posts: 370
Gender: Female
Credits: 26,267
PTGigi
Default

Thank you :D

Hopefully I can get more done in the next couple days but with midyear exams it might be hard D:
__________________


"I see now that the circumstances of one's birth are irrelevant; it is what you do with the gift of life that determines who you are."~Mewtwo
My Adoptables|Nuzlocke Webcomic
Reply With Quote
  #6  
Old 01-26-2011, 05:36 PM
RoconzaArt's Avatar
RoconzaArt RoconzaArt is offline
Member
 
Join Date: Jan 2011
Location: NJ Shore (and proud of it)
Posts: 479
Gender: Female
Credits: 45,874
RoconzaArt is an unknown quantity at this point
Default

It's really cool your doing this gigi maybe it can find a use on my puppy site.
__________________
Reply With Quote
  #7  
Old 01-26-2011, 07:41 PM
HIddenPanda's Avatar
HIddenPanda HIddenPanda is offline
I Am... Da Sheep
 
Join Date: Jul 2010
Posts: 52
Gender: Male
Credits: 5,328
HIddenPanda
Default

I was pretty sure NPC stood for Non-Player-Character... I guess its the same principle just a different word

Looks good, btw, I'd like to see more :D
__________________
dasheep.tk
Reply With Quote
  #8  
Old 01-26-2011, 08:19 PM
PTGigi's Avatar
PTGigi PTGigi is offline
Crazily Friendly~HoF
 
Join Date: Jul 2009
Location: Somewhere >.>
Posts: 370
Gender: Female
Credits: 26,267
PTGigi
Default

Oh really? I thought it stood for Non-Person Controlled [Character] X3 Lolz but you're right it's the same thing XD

Thank you both of you :D I do hope it helps ^-^ The second part should be the most helpful X3
__________________


"I see now that the circumstances of one's birth are irrelevant; it is what you do with the gift of life that determines who you are."~Mewtwo
My Adoptables|Nuzlocke Webcomic
Reply With Quote
  #9  
Old 01-28-2011, 07:00 PM
The Codfin Keeper's Avatar
The Codfin Keeper The Codfin Keeper is offline
A Codfin draws near!
 
Join Date: Jan 2011
Location: Either CT or the Slug's house
Posts: 91
Gender: Male
Credits: 11,355
The Codfin Keeper is on a distinguished road
Default

Yeah, I guess there's multiple definitions, since I've known it as Non-Playable-Character. But it doesn't really matter.

Awesome guide, looking forward to parts 2 and 3.
__________________

Yacker
Quote:
Originally Posted by Mankey Pokemon Card when another one is on top of it
([33) Ka\______
Does 40 damage\___
counter on Mankey. \______
Reply With Quote
  #10  
Old 01-29-2011, 11:54 PM
PTGigi's Avatar
PTGigi PTGigi is offline
Crazily Friendly~HoF
 
Join Date: Jul 2009
Location: Somewhere >.>
Posts: 370
Gender: Female
Credits: 26,267
PTGigi
Default

Thank you :D

Okay, I am ALMOST done with my explore system. Though me being me I just doubled my work by wanting to add a whole new area >.> So....IDK XD

When I go to type up part 2 that might take me 1-2 days because I have a MASSIVE chunk of code to sort through and attempt to explain XD I expect this to go over 2,000 lines (though lines don't mean much it just means it's A LOT ._.)
__________________


"I see now that the circumstances of one's birth are irrelevant; it is what you do with the gift of life that determines who you are."~Mewtwo
My Adoptables|Nuzlocke Webcomic
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mys v1.3.3 Personality System Hwona Mys v1.3.x Mods 15 12-18-2016 09:13 PM
Trade System Kyttias Questions and Supports 4 05-29-2016 12:29 AM
Abandon system bokkun Mys v1.1.x Mods 30 11-16-2010 10:19 PM
Trade System? sensacion Questions and Supports 5 08-20-2010 11:36 AM
Trade System? SieghartZeke Questions and Supports 1 12-28-2009 07:06 AM


All times are GMT -5. The time now is 02:09 AM.

Currently Active Users: 9593 (0 members and 9593 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636