I'm making an RPG, and in this RPG there are various crimes you can commit to put a bounty on your head. The more crimes you commit, the higher your bounty. If the guards catch you, you have the choice of paying off your bounty with your money, or serving a jail sentence. Just like in Oblivion.
The penalty for serving a jail sentence is that your skills decrease, and the amount of skills that decrease depends on your bounty. I want to be able to summarise the amount of skills that decrease in a single string.
My code is like this:
times_to_repeat=floor(bounty/100)
number_of_strings=0
repeat(times_to_repeat)
{
aa=ceil(random(2))
if aa=1
{
number_of_strings+=1
msg_string[number_of_strings]='Skill1 has decreased by 1'
skill1-=1
}
if aa=2
{
number_of_strings+=1
msg_string[number_of_strings]='Skill2 has decreased by 1'
skill2-=1
}
}
I have more than 2 skills, and they're obviously not called skill1, skill2, etc...
I just used that as an example.
And the message code I currently use is this:
if number_of_strings>0
{
for(n=1;n<=number_of_strings;n+=1)
show_message(string(msg_string[n]))
}
But the problem with this is it displays an individual message for each skill decreased.
I'd want the message to be like this:
Skill1 has decreased by 1
Skill2 has decreased by 1
All in the same message.
So what I want is a way to pool all strings from 1 to n into a single variable.
In maths the formula would look like this:
string=msg_string[1]+msg_string[2]+msg_string[3]+ ... +msg_string[n]
But you can't do that in GM, or at least I don't know how.
Sorry if that's unclear, and any help would be greatly appreciated.
Edited by Andyh444, 19 September 2010 - 03:44 PM.











