Help with my combat system using some rand dierolls added to stats


Okay I wanted my combat system to consider a combination of stats and luck, meaning that I would select a numeric value needed to accomplish a task. For example, let’s say it takes a value of 80 to spy on someone. Values will change depending on the difficulty of the task.

The system would use a rand dieroll and then add that to the applicable stat. If the sum of those numbers exceeds a given number, in this example 80, the MC is successful. The problem is, how do I do this? Here is my code.

label dierollobserve
The girl named Origami continues to nervously flutter around the cloud. Wisps of smoke dissipate with each of her flaps. Crook scans the area again before waving his hand through the smoke. You can see them talking but they have wisely lowered their voices.
*if (analysis =“Listening Device”)
You slip in your ear bud and flip on your listening device. The small plastic dish on your collar attempts to capture more of their conversation.
*goto dierolllistendevice
*if (analysis !=“Listening Device”)
You cock your head and listen intently, trying to filter out the melodic chirping of nearby birds.
*goto dierolllistennodevice

*label dierolllistendevice
*rand dieroll 1 100
*if (rand dieroll + hmmm > 80)
You can make out some of the conversation. blah blah blah
*goto afterlisten
You can’t hear anything
*goto afterlisten


Okay I think I figured it out after a lot of trial and error.