ID:204971
 
I need some helpe making a train system like you hit right arrow key u get points then a random arrows shows up and so on. i found this on the form put it doesnt work.
mob/verb
Train()
set name = "Train Reiatsu"
set category = "Training"
if(usr.reitraining >= 1)
src << "You are already training your reiatsu."
return
usr.frozen=1
usr.reitraining = 1
:next
var/direction = rand(1,4)
if(direction==1)
usr << "<BIG>\icon['Arrow1.dmi']</BIG>"
else if(direction==2)
usr << "<BIG>\icon['Arrow2.dmi']</BIG>"
else if(direction==3)
usr << "<BIG>\icon['Arrow3.dmi']</BIG>"
else if(direction==4)
usr << "<BIG>\icon['Arrow4.dmi']</BIG>"
sleep(20)
if(direction==1&&dir==NORTH)
goto next
else if(direction==2&&dir==SOUTH)
goto next
else if(direction==3&&dir==WEST)
goto next
else if(direction==4&&dir==EAST)
goto next
else
usr<<"<font color=blue><font size=2>Your concentration has broke !"
usr.frozen=0
usr.reitraining = 0
What you want to do is look at

client/North()
client/South()
client/East()
client/West()

And store a list of inputs they need to press in a specific time and just remove the input from the top of the list, or if it's not the correct input then bomb out.


Also, don't copy / paste code and expect it to work.
That code is specific to that game. You VERY RARELY can dra and drop code like that.
How about you take a look at the code itself, and figure out what it does and attempt to adapt it to your game (by writing it out fresh?)

Take a look at the DM Guide if you don't understand the basics of that snippet there.
Aghhh iv been messin with code none of its working for me
mob
verb
pushups()
set name ="Pushups"
set category = "Training"
if(reitraining)
reitraining = 0
src << "You stop doing pushups."
return
// you don't need else here if you're using return
// that do while loop was completly useless, it is better to use a proc in this case
reitraining = 1
ChangeArrows() // calls change arrows proc




client
North()
if(mob.reitraining)
if(mob.training == "Arrow1")
mob.ChangeArrows()
else
mob << "You stop doing pushups"
mob.reitraining=0
else ..()
South()
if(mob.reitraining)
if(mob.training == "Arrow2")
mob.ChangeArrows()
else
mob << "You stop doing pushups"
mob.reitraining=0
else ..()
East()
if(mob.reitraining)
if(mob.training == "Arrow3")
mob.ChangeArrows()
else
mob << "You stop doing pushups"
mob.reitraining=0
else ..()
West()
if(mob.reitraining)
if(mob.training == "Arrow4")
mob.ChangeArrows()
else
mob << "You stop doing pushups"
mob.reitraining=0
else ..()

mob/proc/ChangeArrows()
training= prob(25)?"Arrow1": prob(25)?"Arrow2": prob(25)?"Arrow3": "Arrow4"
src<< file("[training].dmi")

and something like this

mob/human/player/verb/pushups()
set name = "pushups"
set category = "Training"
PushUp()

mob/proc/PushUp(dir)
if(dir==pushups)
if(dir) hp-=5
pushups = 1 << rand(3)
src << file("[dir2text(pushups)].dmi")
else
pushups = null
src << "You stop doing push ups"

proc/dir2text(dir)
switch(dir)
if(NORTH)
return "north"
if(SOUTH)
return "south"
if(EAST)
return "right"
if(WEST)
return "left"
We're not going to write code for you.
I imagine you'll want some kind of loop.

Also, ChangeArrows() looks like you're having some trouble there.
Look around the Demo section for "hud demos" or something, that'll get you in the right direction.

Also, remember to vote up posts that you feel have answered your questions, thanks!
I now the basic of what i need to do i need to overide the move arguement so that when i hit the arrow keys the mob dont moves i know that i just cant figure it out(cant code it properly)
If you want to stop the mob from moving, you'll want to do something like this.

client/North()
if(mob.retraining) {
// do something
return 0
}
// ..() tells it to continue on with it's code, while returning stops it in it's tracks.
else {..()}
Thanks for trying to help me but its not what i was looking for dont worry bout it