ID:158175
 
Ok hello all, im a beginner BYOND coder, so my question should be easy.

How do you change the rate that something happens?
For example say if i had a "train" verb, for a game, and the more you trained..say the higher your strength got?

Also, is there a way to create files in the resources?
For example, i recently made a code in which when a player opens the door, a sound plays.I lost it but the basis of the code was:

usr << Sound('')
However it would freeze either the player or the whole game up, im not exactly sure.

And also last, i also forgot how to even put sound files Dream Maker....so ya....

Please reply.Thanks.

to put files into rsc all you gotta do is add it to the enviornment's folder

eg:your making a game "hi, im paul" it would be on your desktop, put the file into the "hi, im paul" folder

and use it in your coding somehow

eg:
mob
icon = 'blah.png'//dot png... i like dots

and it gets added to the rsc.

Same thing goes with sounds except using icon with a sound is asking to have a blue-screen :P

now for your train you would need to make a few variables.

mob
var
rate = 1//gain one per time you train
strength = -5//start out worse than muh mom

You also need to define a verb so that we can train
     verb //we state that the following will be verbs
Train()//we gonna train if we click this
set category = "GIRLS JUST WANNA HAVE FUN"//well they do, sets the verb panel they show up in

you also need to increase your strength in that verb
               usr.strength+=rate

then, since you want a rate......
               rate+=1//train a little faster next time
src.verbs-=/mob/verb/Train
sleep(5)
src.verbs+=/mob/verb/Train
//helps avoid cheaters

In response to Gigimoi
Adding a sleep() to the end of a verb does absolutely nothing to "help avoid cheaters".
In response to Garthor
oops, forgot to take away verb, sry
In response to Gigimoi
Screwing around with adding/removing verbs is just annoying and ugly. Simply lock it out for half a second if you really need to.

Ideally, you'd just fundamentally have a system where mashing the same command ad nauseum is not beneficial.
In response to Garthor
Lol,ok. Thanks you both.

But uhm...now i'd like to know how you would go about adding percents.
Such as,let's say i wanted the play to train until their energy was at about 5% of it's original value, which im gonna say was 100%.

In response to Ant305
Percents are simply decimals. 100% = 1, 5% = 0.05.
In response to Garthor
Ok the putting the soudn file into the folder with the environment, and such didnt work. Because it didnt show up,does it have to be a specific format?
In response to Ant305
Nevermind i found out. Though does anyone know a audio converter?
In response to Ant305
Look up "Goldwave"