I finished all dialogue box features... It was a lot of work, but it was worth it : now I can make the dialogues of my dreams in a really simple way. Here's a video to sum it up.
Now I just have to change aaaaall the existing dialogues... It will be some work too . But on the other hand, once I finished that and since dialogue boxes are so easy to use, finishing the big city will be a lot simpler and faster.
So you can definitively expect next version this year.
New feature that will make my life (and yours !) waaaay simpler.
I was tired of using the chat box for displaying dialogue, and to display it with only a certain amount of time to read, and since my game has so many dialogue and is so oriented torward NPCs, this is something that I think was really missing.
It's not completely finished yet, I still want to be able to convey emotions with it for instance (by making the letter shaking, the text display slower or faster, by adding angry, sad, or joyful voices, ...), but that's the main thing.
The letters display one by one, but you can skip it by just clicking. It uses a whole new font that I had to create by making 1 jpg = 1 letter... It was really dull lol
Anyway now that this is done dialogues will be soooo much easier to implement.
Also : I don't know if you have any contact with the person who manage this website https://ryuum3gum1n.de/adventurecraft/index.php , but if you have can you pass the info that the .exe of the Adventure Craft version that's from the website is not working ?
I get the error : could not create the java virtual machine.
If I have this error, this means that other people will have it too, so maybe this can help him fixing it
Indeed now player.onGround works for me, don't know why it didn't work earlier
But... still the same problem :/
If you press space and release shift at the same time, the script doesn't enter the condition that says the player is running, and the player still get to jump with all the velocity...
The only fix I found is to put this line onUpdate :
if (!player.onGround) {
player.setVelocity(player.getVelocity().x*0.5,player.getVelocity().y,player.getVelocity().z*0.5);
}
But it does it also when walking, so it's not what we want x)
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
3
I finished all dialogue box features... It was a lot of work, but it was worth it : now I can make the dialogues of my dreams in a really simple way. Here's a video to sum it up.
Now I just have to change aaaaall the existing dialogues... It will be some work too . But on the other hand, once I finished that and since dialogue boxes are so easy to use, finishing the big city will be a lot simpler and faster.
So you can definitively expect next version this year.
1
That looks sooooooo good ! I love the cemetery and the graves, and the ghost, really nice work.
Is it out soon ?
1
Yes. Yes it is.
2
New feature that will make my life (and yours !) waaaay simpler.
I was tired of using the chat box for displaying dialogue, and to display it with only a certain amount of time to read, and since my game has so many dialogue and is so oriented torward NPCs, this is something that I think was really missing.
It's not completely finished yet, I still want to be able to convey emotions with it for instance (by making the letter shaking, the text display slower or faster, by adding angry, sad, or joyful voices, ...), but that's the main thing.
The letters display one by one, but you can skip it by just clicking. It uses a whole new font that I had to create by making 1 jpg = 1 letter... It was really dull lol
Anyway now that this is done dialogues will be soooo much easier to implement.
2
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 !
2
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).
1
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.
0
I don't see any member with this username on the discord you gave me.
Yet again, I'm a total newbie with Discord x)
0
Also : I don't know if you have any contact with the person who manage this website https://ryuum3gum1n.de/adventurecraft/index.php , but if you have can you pass the info that the .exe of the Adventure Craft version that's from the website is not working ?
I get the error : could not create the java virtual machine.
If I have this error, this means that other people will have it too, so maybe this can help him fixing it
Edit : so I tried these three steps to try and fix it : https://windowsreport.com/java-virtual-machine-fatal-error/ . The error doesn't show anymore, but Adventure Craft simply... doesn't launch o/
Edit 2 : Damn The map is not in english. Too bad
0
Wow it looks awesome ! Does the creator have a page ? Is it in english ?
1
I am working myself on a better inventory ! Nice work !
1
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.
0
Oh nice idea ! I'll tell you if this works
I have a question : how did you manage to remove the hearts that display your health from the bottom of the screen ?
1
Indeed now player.onGround works for me, don't know why it didn't work earlier
But... still the same problem :/
If you press space and release shift at the same time, the script doesn't enter the condition that says the player is running, and the player still get to jump with all the velocity...
The only fix I found is to put this line onUpdate :
But it does it also when walking, so it's not what we want x)
I will tell you if I find any fix for this
0
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