I 'd like to move your map, but I need your authorization.
I'm not sure I understand... It's a chinese forum for minecraft ? What do you mean by "moving" my map ?
It's not that I don't want to, but I don't understand
Hey! I really love the map and i just want to know if you are planning to finish it? thanks!
Yes I plan to finish it
It'll take some time, but hey, we have all the time in the world !
It means that I want to move your map to our China Forum, but I need your authorization. I think our Chinese players also play with this map because this map is amazing!
The Meaning of Life, the Universe, and Everything.
Join Date:
7/6/2011
Posts:
281
Minecraft:
Gouloudrouioul
Member Details
Hello Pucky, I have a question : I still can't run the script to chose an answer while talking to an NPC.
The thing you told me to do works, and the screen doesn't refresh anymore, but only the black background appears, and no text at all.
However, selecting the options (even if not seing the text) seems to work.
Hello Pucky, I have a question : I still can't run the script to chose an answer while talking to an NPC.
The thing you told me to do works, and the screen doesn't refresh anymore, but only the black background appears, and no text at all.
However, selecting the options (even if not seing the text) seems to work.
What could be the cause of it ?
ok...i think the text consists of UILabels and at some point you clear the screen after you draw the labels...the script runs from top to bottom...so it first draws the Labels....but before it gets to the end of the OnUpdate script it gets cleared..and when the script is at its bottom the Labels are already cleared...it must be something like that...read the script from top to bottom and go trough the single steps it takes until it's at its last line....because the state that gets to the end of the script is the output of the script to your map/screen/etc......then you can find out where you clear it ^^
The Meaning of Life, the Universe, and Everything.
Join Date:
7/6/2011
Posts:
281
Minecraft:
Gouloudrouioul
Member Details
All right, so I got really interested in scripting these days, so I spent like the whole day making a multiple choices dialogue script. I've made my best for it to be easy to use, and it's prototype oriented, so you have to do very little to use it.
When activated, it will display a window with multiple options. You'll be able to make your choice by pressing the forward or backward keys, and to select the right choice by pressing enter.
If you want to use it for your own map, here's the code :
InteractiveDialogue.js :
function InteractiveDialogue(descriptionArray, choiceArray) {
displayCanonChoiceWindow = true;
pauseScreenClear = true;
this.firstTime = true;
this.keyLock = true;
this.t = 0;
this.descriptionArray = descriptionArray;
this.choiceArray = choiceArray;
this.choiceFollowUpArray = new Array();
this.initalizeUI();
player.setStunned(10000);
}
InteractiveDialogue.prototype.initalizeUI = function () {
this.choiceWindowWidth = 300;
this.choiceWindowHeight = 20 * this.choiceArray.length + 5 * this.descriptionArray.length + 2 * 20 + 15;
this.choiceWindowX = ui.getWidth() / 2 - this.choiceWindowWidth / 2;
this.choiceWindowY = ui.getHeight() / 2 - this.choiceWindowHeight / 2;
this.choiceWindow = UIRect(this.choiceWindowX, this.choiceWindowY, this.choiceWindowWidth, this.choiceWindowHeight, 0, 0, 0, 0.5);
this.UIArray = new Array();
this.currentPositionX = this.choiceWindowX + 30;
this.currentPositionY = this.choiceWindowY + 20;
for (var index = 0; index < this.descriptionArray.length; index++) {
var uiElement = UILabel(this.descriptionArray[index], this.currentPositionX, this.currentPositionY);
if (index != this.descriptionArray.length - 1) {
this.currentPositionY = this.currentPositionY + 5;
} else {
this.currentPositionY = this.currentPositionY + 30;
}
this.UIArray.push(uiElement);
}
for (var index = 0; index < this.choiceArray.length; index++) {
var uiElement = UILabel(this.choiceArray[index][0], this.currentPositionX, this.currentPositionY);
this.currentPositionY = this.currentPositionY + 20;
this.UIArray.push(uiElement);
}
};
InteractiveDialogue.prototype.checkCondition = function (condition, indexOfChoiceToRemove) {
if (!condition) {
this.choiceArray.splice(indexOfChoiceToRemove, 1);
}
this.initalizeUI();
};
InteractiveDialogue.prototype.refreshScreen = function () {
for (var index = 0; index < this.choiceArray.length; index++) {
if (this.choiceArray[index][1] == true) {
if (this.choiceArray[index][0].indexOf("->") == -1) {
this.choiceArray[index][0] = "-> " + this.choiceArray[index][0];
}
} else {
if (this.choiceArray[index][0].indexOf("->") != -1) {
this.choiceArray[index][0] = this.choiceArray[index][0].slice(3);
}
}
}
for (var index = 0; index < this.UIArray.length; index++) {
if (index >= this.descriptionArray.length) {
this.UIArray[index].text = this.choiceArray[index - this.descriptionArray.length][0];
}
}
}
InteractiveDialogue.prototype.choiceDown = function () {
var choiceArrayCopy = new Array();
for (var i = 0; i < this.choiceArray.length; i++) {
choiceArrayCopy = this.choiceArray.slice();
}
for (var i = 0; i < this.choiceArray.length; i++) {
if (choiceArrayCopy[1] == true) {
//chat.print(choiceArrayCopy[1]);
this.choiceArray[1] = false;
if (i == choiceArrayCopy.length - 1) {
this.choiceArray[0][1] = true;
//chat.print("backontop");
} else {
this.choiceArray[i + 1][1] = true;
//chat.print("down");
}
}
}
}
InteractiveDialogue.prototype.choiceUp = function () {
var choiceArrayCopy = new Array();
for (var i = 0; i < this.choiceArray.length; i++) {
choiceArrayCopy = this.choiceArray.slice();
}
for (var i = 0; i < this.choiceArray.length; i++) {
if (choiceArrayCopy[1] == true) {
//chat.print(choiceArrayCopy[1]);
this.choiceArray[1] = false;
if (i == 0) {
this.choiceArray[choiceArrayCopy.length - 1][1] = true;
//chat.print("backonbottom");
} else {
this.choiceArray[i - 1][1] = true;
//chat.print("up");
}
}
}
}
InteractiveDialogue.prototype.endInteractiveDialogue = function () {
displayCanonChoiceWindow = false;
pauseScreenClear = false;
player.setStunned(0);
}
InteractiveDialogue.prototype.startInteractiveDialogue = function () {
displayCanonChoiceWindow = true;
pauseScreenClear = true;
player.setStunned(10000);
}
InteractiveDialogue.prototype.checkChoice = function () {
for (var i = 0; i < this.choiceArray.length; i++) {
if (this.choiceArray[1] == true) {
if (i == this.choiceArray.length - 1) {
this.endInteractiveDialogue();
} else {
this.makeChoice(i);
}
}
}
}
InteractiveDialogue.prototype.setChoiceFollowUp = function(indexOfChoice, functionToExecute) {
this.choiceFollowUpArray.push(new Array(indexOfChoice, functionToExecute));
}
InteractiveDialogue.prototype.makeChoice = function (indexOfChoice) {
for (var index = 0; index < this.choiceFollowUpArray.length; index++) {
if (this.choiceFollowUpArray[index][0] == indexOfChoice) {
this.choiceFollowUpArray[index][1]();
}
}
}
InteractiveDialogue.prototype.displayInteractiveDialogue = function () {
if (displayCanonChoiceWindow) {
if (keyboard.isKeyDown(31)) {
if (!this.keyLock) {
//sound.playSoundUI("sound.dialogues");
this.choiceDown();
}
this.keyLock = true;
} else if (keyboard.isKeyDown(44)) {
if (!this.keyLock) {
//sound.playSoundUI("sound.dialogues");
this.choiceUp();
}
this.keyLock = true;
} else if (keyboard.isKeyDown(28)) {
if (!this.keyLock) {
//sound.playSoundUI("sound.dialogues");
this.checkChoice();
}
this.keyLock = true;
} else {
this.keyLock = false;
}
this.refreshScreen();
screen.clear();
this.choiceWindow.addToScreen();
for (var index = 0; index < this.UIArray.length; index++) {
this.UIArray[index].addToScreen();
}
}
}
NPC OnInteraction (the only file you have to modify) :
A simple example on how to use it :
script.runScript("InteractiveDialogue.js");
var interactiveDialogue;
// Text before the choice. You can put as many lines as you wish.
var descriptionArray = new Array(
"So, let's fire it up?" // description line 1
// description line 2
// description line 3
// etc...
);
// Choices. You can put as many choices as you wish. First choice must always be set to true, and following choices to false. Last choice must always be the option to leave.
var choiceArray = new Array(
new Array("Go to the sky", true), //0
new Array("Go to the palace", false), //1
new Array("Think about it a little before", false) //2
// etc...
);
interactiveDialogue = new InteractiveDialogue(descriptionArray, choiceArray);
And that's all! You have your interactive dialogue!
Now, if you want the choice the player make to perform an action when he presses Enter :
// 0 here is to indicate the position of the choice you want to apply an action to. So if it's first in the list, 0, if it's second, 1, if it's third, 2, etc...
interactiveDialogue.setChoiceFollowUp(0,function() {
//Your action here!
}
And if you want a specific choice to not appear for the moment because of a specific condition :
// passageToPalaceUnlocked is your condition (you can for example write "passageToPalaceUnlocked = false;" in your OnLoad file, then activate a script block via trigger whenever you want in the game and write "passageToPalaceUnlocked = true;" when you want it to be unlocked"). It's either true or false. If it's true, it will show the choice, if it's false, it will automatically hide it.
//1 is the position of the choice you want to apply this condition to. So if it's first in your list of choices : 0, if it's second : 1, if it's third : 2, etc...
interactiveDialogue.checkCondition(passageToPalaceUnlocked,1);
That's all! As I said it's very simple! Even the newbie that I was a few month ago could understand it ^^
Now, you can make interactiveDialogue lead to an other interactiveDialogue, and so on. Here's how to do it :
// So as we've seen, this will set up a action for one of the choices, here the first choice of the list
interactiveDialogue.setChoiceFollowUp(0,function() {
// You end the current dialogue using this line
interactiveDialogue.endInteractiveDialogue();
// You make a new description list
descriptionArray = new Array(
"Are you sure ?!" // description line 1
);
// You make a new choice list
choiceArray = new Array(
new Array("Go back to destination choice", true), //0
new Array("Eat a donut", false), //1
new Array("Eat a pizza", false), //2
new Array("Jump", false), //2
new Array("Brag", false), //2
new Array("Leave", false) //2
);
// And you activate the new dialogue with both lists
interactiveDialogue = new InteractiveDialogue(descriptionArray, choiceArray);
})
});
You can even go back to a previous dialogue ! This way :
// So as we've seen, this will set up a action for one of the choices, here the first choice of the list
interactiveDialogue.setChoiceFollowUp(0,function() {
// You end the current dialogue using this line
interactiveDialogue.endInteractiveDialogue();
// You make a new description list
descriptionArray = new Array(
"Are you sure ?!" // description line 1
);
// You make a new choice list
choiceArray = new Array(
new Array("Go back to destination choice", true), //0
new Array("Eat a donut", false), //1
new Array("Eat a pizza", false), //2
new Array("Jump", false), //2
new Array("Brag", false), //2
new Array("Leave", false) //2
);
// New line to add if you want to keep track of the previous dialogue
var oldInteractiveDialogue = interactiveDialogue;
// And you activate the new dialogue with both lists
interactiveDialogue = new InteractiveDialogue(descriptionArray, choiceArray);
})
// Now you're setting an action for the new dialogue, and this action will be to go back to the old dialogue
interactiveDialogue.setChoiceFollowUp(0, function() {
// You end the new dialogue
interactiveDialogue.endInteractiveDialogue();
// You set the old dialogue as the current dialogue
interactiveDialogue = oldInteractiveDialogue;
// And you restart it (since you ended it earlier)
interactiveDialogue.startInteractiveDialogue();
})
});
Now I'll be able to put lots and lots of interactive dialogues! Yeay! My dream come true
It means that I want to move your map to our China Forum, but I need your authorization. I think our Chinese players also play with this map because this map is amazing!
As long as you give the link to this thread and you give credit to me, yeah of course, go ahead
And thanks for saying this map is amazing
http://www.mcbbs.net/thread-840006-1-1.html
Hello Pucky, I have a question : I still can't run the script to chose an answer while talking to an NPC.
The thing you told me to do works, and the screen doesn't refresh anymore, but only the black background appears, and no text at all.
However, selecting the options (even if not seing the text) seems to work.
What could be the cause of it ?
I will take a look at it in about 2 weeks after my vacation ^^
My new "TLoZ - Tael's Tale" Forum page is here!
Newest TT showcase:
https://www.youtube.com/watch?v=pofGxxvMU1U
Let's make Adventurecraft great again! Development of AC continues!
Thanks, whenever you have time
JOJO!
ok...i think the text consists of UILabels and at some point you clear the screen after you draw the labels...the script runs from top to bottom...so it first draws the Labels....but before it gets to the end of the OnUpdate script it gets cleared..and when the script is at its bottom the Labels are already cleared...it must be something like that...read the script from top to bottom and go trough the single steps it takes until it's at its last line....because the state that gets to the end of the script is the output of the script to your map/screen/etc......then you can find out where you clear it ^^
My new "TLoZ - Tael's Tale" Forum page is here!
Newest TT showcase:
https://www.youtube.com/watch?v=pofGxxvMU1U
Let's make Adventurecraft great again! Development of AC continues!
Okay, thanks a lot for the tip, it made the problem more clear ^^
Soooooo.... Since minecraftforum is closing, you'll be able to see news about my map on theses pages :
Twitter : https://twitter.com/oudrouioul
Facebook : https://www.facebook.com/The-Curious-Tale-of-Momo-1213267655508356/
Reddit : (coming soon as well)
Fandom : https://adventurecraft.fandom.com/wiki/Jojo%27s_incredible_Adventure
Planet Minecraft : https://www.planetminecraft.com/project/1-12-adventure-craft-jojo-s-incredible-adventure/
CurseForge : https://minecraft.curseforge.com/projects/jojos-incredible-adventure
All right, so I got really interested in scripting these days, so I spent like the whole day making a multiple choices dialogue script. I've made my best for it to be easy to use, and it's prototype oriented, so you have to do very little to use it.
When activated, it will display a window with multiple options. You'll be able to make your choice by pressing the forward or backward keys, and to select the right choice by pressing enter.
If you want to use it for your own map, here's the code :
InteractiveDialogue.js :
OnUpdate :
NPC OnUpdate :
NPC OnInteraction (the only file you have to modify) :
A simple example on how to use it :
And that's all! You have your interactive dialogue!
Now, if you want the choice the player make to perform an action when he presses Enter :
And if you want a specific choice to not appear for the moment because of a specific condition :
That's all! As I said it's very simple! Even the newbie that I was a few month ago could understand it ^^
Now, you can make interactiveDialogue lead to an other interactiveDialogue, and so on. Here's how to do it :
You can even go back to a previous dialogue ! This way :
Now I'll be able to put lots and lots of interactive dialogues! Yeay! My dream come true
best adventurecraft map out there. keep up with the good work
Hello,Goulou,I think the best maps I've seen so far are them,So can i take to China MCBBS?And Can I open the download address in China?I know you are a handsome and smart man!Goulou
I am a porter from China, I hope I can have more maps to come to China.
Thanks !
I sure am
Of course you can ! Thanks for your interest in my map
Okay, after long months of not being able to work on this project, I'm kind of back to business.
I . WILL . FINISH . THIS.
Awesome! c:
My new "TLoZ - Tael's Tale" Forum page is here!
Newest TT showcase:
https://www.youtube.com/watch?v=pofGxxvMU1U
Let's make Adventurecraft great again! Development of AC continues!
Stay determined!
Hi everyone !
As a good year resolution, I chose to finish this version in 2020.
I'm still working on it, steedily. I would say it's 75% finished.
A sneak peak of the new inventory :
It's not finished at all yet, and will only be present in the version after the coming version.
It takes full screen and its size adapt to your screen (it's responsive).
That looks awesome
I'm curious how you will script its usability. ^^
My new "TLoZ - Tael's Tale" Forum page is here!
Newest TT showcase:
https://www.youtube.com/watch?v=pofGxxvMU1U
Let's make Adventurecraft great again! Development of AC continues!
Whoa that looks really cool! :0
Thanks both of you
Here's a video sneek peak of the next version :
Of course I'm showing very little on purpose, there's pleeeeenty of other stuff to see, plenty of secrets, plenty of sidequests !