Ok it's done. in the zip folder i've provided the plugin along with a couple of shop parallaxes i made out of battlebacks. There's no setup required, just active the plugin in the plugin manager.
How to use:
In the event that handles your shop, add the following call script
JavaScript:
$gameSystem.setShopConfig({
ownerPicture: "People1_5", // Picture file in img/pictures/
ownerPictureX: 430, // X position of the shopkeeper picture
ownerPictureY: 106, // Y position of the shopkeeper picture
parallax: "Shop1", // Parallax background file in img/parallaxes/
music: "Town8", // Background music file in audio/bgm/
defaultChat: "Welcome to my shop!", // Default message shown in the chat window
chatOptions: [ // Array of chat options
{ text: "How's business?", response: "It's been great lately!" },
{ text: "Any special deals?", response: "Check out my rare items!" },
{ text: "Tell me about yourself", response: "I'm just a humble merchant..." }
]
});
This is just a basic example. You can have as many chat options as you want just add
{ text: "CHAT_OPTION", response: "RESPONSE_TEXT_HERE" }
just make sure all but the last line has a comma at the end your you'll get syntax errors.
Further more, you can get more fancy with the chat options. Specific chat options have the ability to turn on/off switches and control variables. (just be careful not to divide by zero)
JavaScript:
chatOptions: [
{
text: "How's business?",
response: "It's been great lately!",
variable: { id: 1, value: 1, operation: "set" }, // Sets variable 1 to 1
switch: { id: 1, value: true } // Sets switch 1 to true
},
{
text: "Any special deals?",
response: "Check out my rare items!",
variable: { id: 1, value: 2, operation: "multiply" } // Multiplies variable 1 by 2
},
{
text: "Tell me about yourself",
response: "I'm just a humble merchant...",
variable: { id: 1, value: 1, operation: "add" } // Adds 1 to variable 1
}
]
And even more advanced, and a bit experimental, are event triggers. Makes things happen when you leave the shop if certain criteria are met. For example, if you spend X amount of gold, or buy a certain item you can trigger a specific common event once you leave the shop. This feature may still be in need of more testing. Paste this after the chatOptions.
JavaScript:
events: [
{ condition: { totalGoldSpent: 500 }, eventId: 1 }, // Trigger event 1 when 500 gold is spent
{ condition: { itemBought: { type: 0, id: 1 } }, eventId: 2 }, // Trigger event 2 when item ID 1 is bought
{ condition: { variable: { id: 1, value: 1 } }, eventId: 3 }, // Trigger event 3 when variable 1 is 1
{ condition: { switch: { id: 1, value: true } }, eventId: 4 } // Trigger event 4 when switch 1 is true
]
You can have as many as you want, just always make sure to add a comma at the end of each bracket except for the last one.
And finally, here's an example of the whole call script set up as a visual aid.
Code:
$gameSystem.setShopConfig({
ownerPicture: "SHOP_OWNER_PICTURE",
ownerPictureX: 430,
ownerPictureY: 106,
parallax: "PARALLAX_IMAGE_FILE",
music: "BGM_FILE",
defaultChat: "DEFAULT_CHAT_WHEN_ENTERING_SHOP",
chatOptions: [
{
text: "CHAT_OPTION_1",
response: "OWNER_RESPONCE_1",
variable: { id: 1, value: 1, operation: "set" }, //example variable handle
switch: { id: 1, value: true } //example switch handle
},
{
text: "CHAT_OPTION_2",
response: "OWNER_RESPONCE_2",
variable: { id: 1, value: 2, operation: "multiply" }
},
{
text: "CHAT_OPTION_3",
response: "OWNER_RESPONCE_3",
variable: { id: 1, value: 1, operation: "add" }
},
{
text: "CHAT_OPTION_4",
response: "OWNER_RESPONCE_4",
variable: { id: 1, value: 2, operation: "divide" }
}
],
events: [
{ condition: { totalGoldSpent: 500 }, eventId: 1 }, // Calls common event 001 if you spend 500 gold.
{ condition: { variable: { id: 1, value: 1 } }, eventId: 3 } //Calls common event 003 if Variable 001 == 1
]
});
Message me if you have any questions