Twine 2.0.11, Sugarcube 1.0.34
As a total code noob, I'm pretty sure I'm in out of my depth with this one, but I thought it wouldn't hurt to ask. Hopefully this makes sense.
In my game, NPCs are associated w/ objects that contain their stats. For instance, I use this for one NPC:
As the game progresses, these stats change depending on the actions of the player.
Later in the game, I'd like to have story branches that respond to which NPC character has the most wins. Does anyone have any thoughts on the easiest way to do this?
For what its worth, I was looking into putting each relevant NPC's stat into an array and using some kind of sort or compare function. Something like this:
Anyone know if I'm barking up the right tree here? Any thoughts?
As a total code noob, I'm pretty sure I'm in out of my depth with this one, but I thought it wouldn't hurt to ask. Hopefully this makes sense.
In my game, NPCs are associated w/ objects that contain their stats. For instance, I use this for one NPC:
<<set $miko= { Name: "Miko", HPMax: 80, HPNow: 80, Wins: 0, Losses: 0, }>>
As the game progresses, these stats change depending on the actions of the player.
Later in the game, I'd like to have story branches that respond to which NPC character has the most wins. Does anyone have any thoughts on the easiest way to do this?
For what its worth, I was looking into putting each relevant NPC's stat into an array and using some kind of sort or compare function. Something like this:
<<set $leaders = [["Miko",$miko.Wins], ["Elle",$elle.Wins], ["You",$player.Wins]] <<print $leaders.sort(function(a,b){return a[1] - b[1];})>>
Anyone know if I'm barking up the right tree here? Any thoughts?