ID:157044
 
K i want to have a verb called 'Forage' which gives a percent chance to obtain certain items, strawberry's etc, and i would like (for now at least) to just have a variable, and it have a random value between 1-100, so kinda like this... (not exact, i know a fair amount of the Byond language, but not variables all too well [you need not explain variables, they are covered in the guide XD], it is just, this message need not be exact)

Forage()
var(A)=rand(1-100)
If()
var(A)=1-25
Strawberry >> usr.contents
else()
cherry >> usr.contents

Also, i really want to learn how to create, and develop skills and skill trees...
ok...why not just use the prob() proc...look it up in the guide if you don't know it
In response to Masschaos100
Masschaos100 wrote:
ok...why not just use the prob() proc...look it up in the guide if you don't know it

Agreed, prob() is so much useful for you:
if(prob(25))
This has a 25% chance of happening
else if(prob(50))
This has a 37.5% chance of happening (3/4 (from the else) * 1/2 = 3/8 = 0.375)

if(prob(95))
This has a 95% chance of happening


For future note, you are using rand)( wrong. Next time look up the procedure in the DM reference if you do not know how to use it:
rand(min, max)

ex: rand(4, 9) // Picks a # between 4 - 9
Considering you've just completely made up all of your syntax there, you really need to read some tutorials.
Wolfnova wrote:
K i want to have a verb called 'Forage' which gives a percent chance to obtain certain items, strawberry's etc, and i would like (for now at least) to just have a variable, and it have a random value between 1-100, so kinda like this... (not exact, i know a fair amount of the Byond language, but not variables all too well [you need not explain variables, they are covered in the guide XD], it is just, this message need not be exact)

> Forage()
> var(A)=rand(1,100)
> If(var(A)=1-25)
> usr.contents << "strawberry"
> else()
> usr.contents << "cherry
>
> Also, i really want to learn how to create, and develop skills and skill trees...
>

(Fixed the OP, in my quote...)

Yes i was typing quickly, because i had a extremely busy schedule, so syntax was wrong, very true Garthor XD

anyways thanks for the prob() So it would go, something along these lines?

<dm>
mob
player //Leaving out the details here, only for
verb //reference, etc...
Forage()
if(prob(25))
usr.contents << "Strawberry"
usr << "You got a strawberry"
/*Wrong syntax i know, i forgot the syntax, to put items into usr.contents...*/
elseif(prob(50))
usr.contents << "cherry"
usr << "You got a cherry"
else
usr << "You fail to find anything"


Also, just a different question, in the OP, i ask about skills, wouldn't they just use variables, and proc() 's? (Well, that probably goes with a number of things lol...)

And latest problem since this post is getting the Login() proccess, and learning how to, make it assign mob groups based on key... (But i am just going to post a seperate topic for that later...)