ID:263298
 
Fixed.
DBZ game or what?
Interesting way of training. Let me see what I can find:


Sup3r 17 wrote:
Code:
> mob/var/rockshooting=0             
> obj
> shooterrock
> icon='TrainingObjs.dmi'
> icon_state="rock"
> density=1
> Click()
> flick("blast",usr)
> usr<<"You got it."
> del(src)
>
>
> obj
> rockshooter
> icon='TrainingObjs.dmi'
> icon_state="rock shooter"
> density=0
> verb/Rock_Shooter()
> set category="Training"
> set src in oview(5)
> if(usr.resting==1||usr.flying==1)
> usr<<"you are already doing something."
> return
> if(usr.energy<=0)
> usr<<"You must rest."
> return
> else
> if(usr.rockshooting)
> usr<<"You are already using this machine."


Here's one problem. You never set usr.rockshooting. Although, I would suggest finding another way of doing that instead of defining a variable for each mob. Maybe give the variable to the machine so only one player can use it at a time?

>               else
> var/obj/H = new/obj/shooterrock
> spawn(100)
> del H
> H.dir = usr.dir
> H.loc = usr.loc


The new process allows you to set the location by passing it as the first argument, no need to do it manually. Also, you're going to get errors from that "del H" line. What if the player clicks and destroys the rock before 10 seconds are up? You should add an "if(H)" in there.


>                   while(H)
> step(H,H.dir)
> var/turf/T = H.loc
>
> for(var/mob/M as mob in T)
> if(M.dead == 1)
>
> del(H)
> return
> else
> M.pl=M.pl/2
> death(M)
> M<<"You got hit by the rock!"
> del(H)
>
>



Ok, a few problems here, including your freezing problem. First off, the way you're checking for players to get hit by the rocks is a bit of a workaround. I would suggest moving the damage part under /obj/shooterrock/Bump(), then Dream Seeker will handle the rest. Now, the freezing problem appears because you have a loop without a sleep. So the loop just runs and runs as fast as it can, freezing your computer. Now, to fix this, you can add a sleep() under the loop, or in this case you could remove the loop entirely. If you move the damaging part under /obj/shooterrock/Bump(), then all that leaves under the loop is step(). You can then replace the step() with the walk() process, which will loop for you, and remove the while().

Sorry if any of that sounded confusing, I just woke up. If you need an explainations or if anything doesn't seem to work, just post back here and I'll see what I can do to help :)
In response to DarkCampainger
obj/rock
Click()
if(ismob(usr) && istype(usr.loc,/turf/destroyrocks))
missle(...)
del(src)


?
In response to DivineO'peanut
I don't understand, what is your question/opinion/statement that you're trying to convey?

Also, why would the usr be anything but a mob? Last time I checked, client.mob could only be set to /mob.
In response to DarkCampainger
Oh, whoops, I thought this was in Dev How-To, and that he was asking how to do such a system. Sorry. :p
In response to DarkCampainger
Thanks, i fixed the freezing problem. But i just realized that i made the rock start from the user, so it looks like the user is shooting rock out, which is not what i wanted. becuase i put usr.loc so its starting off were the usr is. How would i make it start from the machine so that it is shooting out of the machine. cuase i cant put like H.loc= (machines loc)
In response to Sup3r 17
Well, think about it for a second. What is the machine in this process? It's the parent, the container, the source of the verb.
In response to DarkCampainger
ah! the src, i never even thought about that. DarkCampainger, thank you byond needs more people like yourself who actually help the person out. Most other people just post useless stuff. But you actually helped me. Thanks again.