diogaoo wrote: Sat Sep 04, 2021 2:13 pm
I've been looking to make encounters more fluid and and less repetitive, adding a metronome would go against that
See:
SimpleBeats. You can make a metronome as fluid and non repetitive as you'd like.
diogaoo wrote: Sat Sep 04, 2021 2:13 pm
Graham Bubblefish wrote: Fri Sep 03, 2021 7:42 pm
I'm joining in on the guy who had issues with getting the dagger recipe to drop from Lisa. I beat did her 14 times and still no dice.
I dunno know what to say to you guys
I haven't played your tease, so I don't know if I'm looking in the right place (looked in all the pages containing "Lisa" in the
version linked in the first page), but glancing over your code out of curiosity, I honestly couldn't figure out how/where you're getting/setting a variable randomly or otherwise to indicate reception of this dagger recipe.
On that random front: If players are running into a long run of misses, it can be helpful to treat things like this more like a deck of cards by creating an array at the start of the game, shuffling it, then pulling from that array on each try. This allows you to more precisely set, say, 1 in 8, chances than a Math.random(...) or page.goto('bla*') will give you -- without the possibility of missing well over 8 times.
There's 1001 ways to do it, but for example:
Code: Select all
// Define base deck in Init Script
var deck1 = [
{text: 'Got Dagger Recipe', action: function(){pages.goto('myGotDaggerRecipePage')}},
{text: 'Got Baddie #1', action: function(){pages.goto('baddie1')}},
{text: 'Got Baddie #2', action: function(){pages.goto('baddie2')}},
{text: 'Got Baddie #3', action: function(){pages.goto('baddie3')}},
{text: 'Got Something Else #1', action: function(){pages.goto('somethingElse1')}},
{text: 'Got Something Else #2', action: function(){pages.goto('somethingElse2')}},
{text: 'Got Something Else #3', action: function(){pages.goto('somethingElse3')}},
{text: 'Got Something Else #4', action: function(){pages.goto('somethingElse4')}},
// and so on...
]
// Define our deck state storage object in Init Script (this could be saved/restored to/from tease storage if needed)
var decks = {}
// Define shuffle function in Init Script
function shuffleArray(a) {
var j, x, i
for (i = a.length - 1; i > 0; i--) {
j = Math.floor(Math.random() * (i + 1))
x = a[i]
a[i] = a[j]
a[j] = x
}
return a
}
// Define a function that will get a card from a named deck in Init Script
function drawCardFromNamedDeck(deckName, resuffleOnEmpty) {
var baseDeck = window[deckName]
if (!baseDeck) {
console.error('No global deck variable found named:' + deckName)
return
}
function _doNewDeckShuffle() {
// Add deck index
decks[deckName] = baseDeck.map(function(c, i){return i})
// Shuffle the hell out of it
shuffleArray(decks[deckName])
shuffleArray(decks[deckName])
shuffleArray(decks[deckName])
}
function _getCard() {return baseDeck[decks[deckName].shift()]}
if (!decks[deckName]) {
// Haven't used this deck yet. Initialize it.
_doNewDeckShuffle()
}
var card = _getCard()
if (!card) {
if (!resuffleOnEmpty) return null // Deck is empty, and we were not asked refresh it. Return null
_doNewDeckShuffle()
card = _getCard()
}
return card
}
// Now, throughout the game, in Eval actions, we can do things like:
var card = drawCardFromNamedDeck('deck1', false) // get a card, but if the deck is empty, we'll get null
// if we wanted to get a new deck+card on empty, we could do: card = drawCardFromNamedDeck('deck1', true)
if (card) {
// Got a card
console.log('Drew card', card) // Debug
card.action.call(card) // Run card's action, whatever that may be.
} else {
// Deck was empty, and we didn't ask for a new deck.
console.warn('Deck empty') // Debug
pages.goto('myDeckEmptyPage')
}