It looks like you're new here. If you want to get involved, click one of these buttons!
{ (if: $loverace is "human" or it is "half ogre")[(set: $loveagemodifier to 1)] (elseif: $loverace is "dwarf")[(set: $loveagemodifier to 5)] (elseif: $loverace is "elf" or it is "dark elf")[(set: $loveagemodifier to 10)] (elseif: $loverace is "half elf")[(set: $loveagemodifier to 1.75)] (elseif: $loverace is "gnome")[(set: $loveagemodifier to 4.5)] (elseif: $loverace is "halfling")[(set: $loveagemodifier to 2.5)] (elseif: $loverace is "half orc")[(set: $loveagemodifier to 0.75)] (set: $loveage to (round: ($pcage / (($pcagemodifier / $loveagemodifier) + ((random: 90,110) * 0.01))))) }
Comments
You barely provided any information so I had to some guess work and created an sample example that works you can edit and improve it:
First create one passage as so: then create another one like this You can add more links and edit it to your liking
Here are two test passages in which I simplify the process.
The first one does this, in order: It sets the longevity modifier of the player (at what age it reach different life stages, and the race of the love interest (her longevity autocalculates). It then displays the second passage, which I will explain later.
The third line multiplies the longevity modifier of the player and a random age I put in there to test it. For different races, their age of independence would be sooner or later than it is for humans.
And last, a simple "twine, show me your results" along with a link to retry and see what I get next.
Here you can see the different longevity multiplier of the different races (they have to stay in the. Just at the end of the passage, is that thing I can't solve by myself, because I'm horrible at math.
In one sentence, the problem is that his equation only generates love interests than are older than the player, never one that is a bit younger. It should generate love interests from 10% younger to 10% older, taking into account their race's longevity.
If I still didn't manage to explain myself, please tell me.
First you have to press both links the human and the half orc link before seeing lover's age 2nd general advice don't use {} in harlowe just delete it all together, you will see that if you copy paste the two passages I provided they will work perfectly as I have already created and tested them
The following shows how to randomly get a value that ranges from negative 10 percent to positive 10 percent, which when applied to an age can result in both a higher and lower second age.
damn I missed that I was only trying to implement the op's values in a way that it works that's probably why the values are not that different but the problem arises in how input a random age assuming the op wants the user to want to be able to enter their age I tried but it wouldn't work because it was a string, plus the op should really add more links to choose what race the player and the lover are but I'll assume that the op already did
Thanks!
And what about the equation itself, it is correct? It worked differently on excel.
(set: $loveage to ($pcage * $pcagemodifier) + ((random: -10,10) * ($pcage / 100)) * $loveagemodifier)