0 votes
by (250 points)

I am trying to create a system where the player's choices in the prologue will have an impact on their situation in the future, by adding to variables throughout the game ($sword_affinity, $shield_affinity, $spear_affinity, $sword_shield_affinity), but it doesn't seem to be working. Anyone know what's wrong with this?

 

(if: $sword_affinity > $shield_affinity and $sword_affinity > $spear_affinity and $sword_affinity > $sword_shield_affinity)[(set: $startingweapon to "Longsword")]

(if: $shield_affinity > $sword_affinity and $shield_affinity > $spear_affinity and $shield_affinity > $sword_shield_affinity)[(set: $startingweapon to "Shield")]

(if: $spear_affinity > $shield_affinity and $spear_affinity > $sword_affinity and $spear_affinity > $sword_shield_affinity)[(set: $startingweapon to "Spear")]

(if: $sword_shield_affinity > $shield_affinity and $sword_shield_affinity > $spear_affinity and $sword_shield_affinity > $sword_affinity)[(set: $startingweapon to "Sword and Shield")]

(if: $sword_affinity is $sheild_affinity and $spear_affinity < $sword_affinity and $spear_affinity < $shield_affinity)[(set: $startingweapon to "Sword and Shield")]

(if: $sword_affinity is $sword_shield_affinity or $shield_affinity is $sword_shield_affinity and $spear_affinity < $sword_affinity and $spear_affinity < $shield_affinity)[(set: $startingweapon to "Sword and Sheild")]

(if: $sword_affinity is $spear_affinity or $shield_affinity is $spear_affinity or $spear_affinity is $sword_shield_affinity)[(set: $startingweapon to "Broadsword")]

You are $name, the captain of the queen's royal guard! You have slain many monsters in defense of our nation's queen, and as such, are a master of the $startingweapon.

 

2 Answers

0 votes
by (6.2k points)
Nothing looks wrong with this. You should make sure that you're using Harlowe, or look for typos.
0 votes
by (8.9k points)
This code works!  Is the problem that you're getting "Broadsword" unexpectedly?

If so, the reason is that you're telling Twine to set $startingweapon to "Broadsword" if any two _affinities are equal. So if $sword_affinity is 20, but $spear_affinity and $shield_affinity are both 2...the $startingweapon will be set to "Broadsword".

It might possibly be better to go for an (else:) macro for Broadsword.
by (250 points)
Thanks! That helped a ton!
...