- Apr 30, 2019
- 61
- 67
Hello everyone.~
I have started work on something of my own, but I am at a little roadblock. I can do almost everything I have in mind fairly easy with two exceptions that, as it happens, are pretty important! Now, I can code in python and C# and would be able to do this fairly easily, alas javascript and whatever twine/sugarcube uses... not so much.
I can handle combat since that's a pretty simple loop of attack/magic/flee decisions and immediate variable changes in response with random numbers for rolls. What I am struggling with is getting to the combat. I want to be able to put together a group of variables for each monster type you'll encounter, name, stats, so on, into a list for each area. When you enter a new page, it should do a random roll to decide if you trigger an encounter. If you do, then it should roll again from a table of the monsters in that area to decide what you fight, and then pass that monsters information to the combat script.
So, in order it needs to:
Roll encounter chance (10%)
If an encounter is triggered, roll on monster table
use the result on the monster table to get the variables for that monster which need to be grouped together somehow (how do you do tuples in this damn thing?!)
and finally pass them to a combat script which then uses those for the combat loop.
Ideally, which of several monster tables (14 in total) are used should be determined via a local variable that tells which area the player is in, so that the same code can be referenced for every dungeon without needing to be changed.
I could do some of this easily enough with tuples in python but have not yet seen a way to make tuples in sugarcube.
I have started work on something of my own, but I am at a little roadblock. I can do almost everything I have in mind fairly easy with two exceptions that, as it happens, are pretty important! Now, I can code in python and C# and would be able to do this fairly easily, alas javascript and whatever twine/sugarcube uses... not so much.
I can handle combat since that's a pretty simple loop of attack/magic/flee decisions and immediate variable changes in response with random numbers for rolls. What I am struggling with is getting to the combat. I want to be able to put together a group of variables for each monster type you'll encounter, name, stats, so on, into a list for each area. When you enter a new page, it should do a random roll to decide if you trigger an encounter. If you do, then it should roll again from a table of the monsters in that area to decide what you fight, and then pass that monsters information to the combat script.
So, in order it needs to:
Roll encounter chance (10%)
If an encounter is triggered, roll on monster table
use the result on the monster table to get the variables for that monster which need to be grouped together somehow (how do you do tuples in this damn thing?!)
and finally pass them to a combat script which then uses those for the combat loop.
Ideally, which of several monster tables (14 in total) are used should be determined via a local variable that tells which area the player is in, so that the same code can be referenced for every dungeon without needing to be changed.
I could do some of this easily enough with tuples in python but have not yet seen a way to make tuples in sugarcube.