Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

5
How to assign a variable a random integer
Post Body

So, I'm working on a character that someone else has made, doing a few edits and tweaks to make it play a little better. One of this character's moves means that the other player has to struggle to get free. Every time they struggle, the struggle counter goes up by 1. Previously, when the struggle counter reaches 8, the player would be released. I thought this was a bit streamlined and wanted to be able to randomise the amount of struggles someone had to do before they could escape. My main issue is that most of what I have found on here tells you how to assign a variable a random number, but I want the number of struggles needed to escape to be random, rather than the number of struggles, if that makes any sense.

The main part of the code that I'm focussing on is this:
[state 1004] ;release
type = changestate
triggerall = numtarget
triggerall = target, alive
trigger1 = var(4) = 8 && (var(5) = 1)
trigger2 = roundstate = 3
value = 1012

Var(4) is the variable dealing with the number of struggles. Therefore, "trigger1 = var(4) = 8" is saying "when the amount of struggles reaches 8, they will be released". The 8 is therefore the integer that I want to be randomised but, pretty much all my methods have been unsuccessful. I have managed to find out how to generally make the integer random, simply by doing this: "trigger1 = var(4) = random". This provided me with a random number of struggles needed to escape, but I would really like to define the range of numbers that can be picked, 1-16. I have tried lots of different things and either the game will be unable to load the character or the other player is released instantly without struggling. If anyone has any idea how I can set it so that var(4) = a random integer between 1-16 that would be fantastic!

Also, I should probably mention that I am not great at coding :(. Though, I'm definitely better than someone who's never coded in their life

Author
User Disabled
Account Strength
0%
Disabled 2 weeks ago
Account Age
7 years
Verified Email
Yes
Verified Flair
No
Total Karma
26,066
Link Karma
7,777
Comment Karma
18,198
Profile updated: 6 hours ago
Posts updated: 11 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
6 years ago