HOME | DD

legioKat — RANDOM convo tut

Published: 2013-12-24 05:07:24 +0000 UTC; Views: 3847; Favourites: 52; Downloads: 93
Redirect to original
Description This is a tutorial on how to do the "random conversation effect" where instead of having an original dialogue path with a character, you have a variety of things that will randomly show up when you "talk" to them. If you have no idea what that means, go check out ~Pacthesis's Number Days or Memory Days. That type of "talking" is what I am trying to teach you guys how to do!


  I Do recommend you download it (It's a free download! Yay, you're welcome, don't steal) so you can see code easier  


 ALSO: TO GET EXP WITH THIS ADORABLE DUDE, YOU MUCH CLICK HIM. DO NOT CLICK HIM UNTIL YOU HAVE TRIED OUT THE CONVERSATIONS WITH LESS THAN 50 EXP 

(I got this dude from google images (Check out it's original source! cyriloneous.tumblr.com/post/42… I do not own this guy although I wish I did because he's so freaking cute)

---------------------------------------------------------------------------------------------------------------


 GUYS: I got this info from a fellow Deviant, ~KittyKatHitUWithABat. So go over and thank, give points, llamas, etc to them!  

--------------------------------------------------------------------------------------------------------------


  Also, some notes, It's kind of obvious, but just in case:


  When the code says to _root.gotoAndPlay("talk1"), we are all going to assume that frame (talk1) has the choices that the player picks from to gain exp. I say this because I usually go over that really quick in my tutorials, but I didn't this time.

 Yes, I gave you guys a bunch of hp, I just wanted to make sure you saw how the code decreased it by 10**

 The example, even when you have 50 or more exp often goes back to the "so, what's up?" which was only meant for if you had less than 50 exp. Why it does this, I don't know. If you can figure it out, I'd love to know why! (Some points will be awarded to the deviant who figures it out and tells me first!)

--------------------------------------------------------------------------------------------------------------


 Play Number Days? www.deviantart.com/art/Number-…

 Play Memory Days? www.deviantart.com/art/Memory-…

 Visit KittyKatHitUWithABat's page! kittykathituwithabat.deviantar…

 Check out my other tutorials on my page! legiokat.deviantart.com/


 EDIT: On the frame that has the talk button, it'll say "there's 3 options" or something. That is partly true. There are 3 options if you have less than 50 exp with the dude, and then there are 3 more options if you have greater than or equal to 50 exp 


I am so sorry for this mile long list of edits and such... I just really don't want to resubmit this thing. But there is one more thing...

*On the code that is copy and paste, the first one (the simple, without the different level of convo), there should be one more bracket. So there are two brackets at the very end of the code** 






Related content
Comments: 15

Fensijo [2016-08-02 16:53:37 +0000 UTC]

Thank you so much for this tutorial! Helped me a lot ^^ However, I think you placed a } on the wrong place... I had to move it to make the code work all the time.
This made the code work for me ^^


on(release){
if(hp>=10 && exp<= 0){
hp-= 10;            
                                                                      <-------  Instead of here....
var randomNumber = Math.floor(Math.random()*3)
if (randomNumber==0){
gotoAndPlay("talk1");
}
if(randomNumber == 1){
gotoAndPlay("talk2");
}
if(randomNumber == 2){
gotoAndPlay("talk3");}                                    <------ I think it's supposed to be here...
}else if(hp>=10 && exp>= 50){
 hp -= 10;
var randomNumber = Math.floor(Math.random()*3)
if (randomNumber==0){
gotoAndPlay("talk4");
}
if (randomNumber==1){
gotoAndPlay("talk5");
}
if (randomNumber==2){
gotoAndPlay("talk6");
}
}
}

👍: 0 ⏩: 0

NightWitch14 [2015-08-15 03:22:21 +0000 UTC]

What actionscript did you used for this???

👍: 0 ⏩: 0

Nyu-Neon [2015-06-23 17:34:41 +0000 UTC]

This actually made feel good about myself in addition to the fact that I learnt how to randomize conversations :3

👍: 0 ⏩: 0

Mangakido [2015-06-22 19:11:42 +0000 UTC]

Would anyone happen to know the code for just random scenes that has nothing to do with HP?

I want to be able to click one button an it being able to jump to 3 or more different scenes randomly.

👍: 0 ⏩: 0

Kikip45 [2015-04-08 21:43:03 +0000 UTC]

This helped a lot.
Also, nice Sup guy.

👍: 0 ⏩: 0

HetaliaGirl20 [2014-10-23 11:45:07 +0000 UTC]

Will this work on Ren'py?

👍: 0 ⏩: 1

legioKat In reply to HetaliaGirl20 [2014-11-23 20:04:32 +0000 UTC]

I'm sorry I'm not very experienced in Ren'py; I couldn't tell you if it works

👍: 0 ⏩: 0

TheLezh [2014-10-18 19:28:08 +0000 UTC]

Extra tidbit for people using this tutorial

For the Math.floor part, you can also use Math.ceil and Math.round
as all of them are different ways to round things.

Math.floor "flattens" like, even if a number is 3.99, it'll still make it 3.

Math.ceil does the opposite. 0.1 would be turned into 1.

Math.round does it normally. 0-4 goes down, 5-9 goes up.

Ceil sort of makes it so that you'll never get 0 as a number thus eliminating
you being mindful of what range you choose.

Floor and Ceil can basically offset numbers.

Also, if you want to shift a range slightly to something to get more of an
exact range somewhere. You can do this:

Math.floor(Math.random()*4) + 4;

Start from zero. Add 4.
That's where you are now as the range can
now be anything from 4 to 9.

If I wanted to make it specifically 4 to 5,
I would do this:

Math.floor(Math.random()*1) + 4; 

Start from zero, plus 4.
Now that I made the range two, (0-1)
I can only choose between 4-5.

Just experiment a bit with it.

👍: 0 ⏩: 1

Mangakido In reply to TheLezh [2015-06-22 21:56:55 +0000 UTC]

Would you happen to know how to edit this random conversation code and make it where a button generates random multiple scenes?

I would like random conversation without the "Hp dating Sim part". So a button code that when released randomly chooses a scene to play would be great.

Thanks.

👍: 0 ⏩: 1

TheLezh In reply to Mangakido [2015-07-20 23:25:11 +0000 UTC]

Sorry for the late reply. 

From looking at the code, here's my guess since I use AS3:

First off, remove the if (the one with hp>=10) statement's parentheses and braces"{}" along with any contents.
Remove all that pertains to hp. The braces that are with on(release) should have the first one by it and the other one
as at the very end. Like this for example:

on(release){

randomstuff

}

And then, however you do it in AS2, attach on(release) to the button you want to use.

I'm not sure if I've been 100% clear but that's how I think it should go.

👍: 0 ⏩: 1

Mangakido In reply to TheLezh [2015-08-08 22:04:09 +0000 UTC]

It's all right, I'm just glad you replied.

Unfortunately, I won't be able to try it anytime so but I wanted to say thanks! ^_^

👍: 0 ⏩: 1

TheLezh In reply to Mangakido [2015-08-15 05:13:26 +0000 UTC]

You're welcome.

👍: 0 ⏩: 0

asdronin [2014-01-11 06:54:53 +0000 UTC]

Its great discovery you made , thanks a lot for making it all clear for us, I know some of Pacthesis early games were like one dialogue after another but as you pointed in the later its random dialogue, and the result is great like that of course, nobody really notices so when playing (I know some convo are repeated of course but you know what I mean)

👍: 0 ⏩: 0

xinshin [2013-12-29 06:10:13 +0000 UTC]

l've been looking for something like this for so long ;w;

Thank you so much for making this!! >A<

👍: 0 ⏩: 0

KittyKatHitUWithABat [2013-12-24 05:51:13 +0000 UTC]

Aw thank you so much for adding me in this! I didn't even know that I was that helpful! I'm honoured really

👍: 0 ⏩: 0