ID:879760
 
I need help finding out why my code does not make smooth beams. the head of the beam seems to stay 1 unit behind at all times. I need help figuring out how to fix it. Thanks in advance.
mob/var/Kame_Charge = 'Kamehameha Charge.dmi'
mob/var/firing = 0
obj
var
mob/owner = null // This var will be set as the owner of the beam being fired.
total = 0 // The total number of spaces the beam's head is allowed to move
moved = 0 // The number of spaces the beam's head has moved
list/Beam = list() // A simple list to keep track of the beam's body


Kame_Beam_1
icon = 'Kamehameha.dmi'
density = 1
icon_state = "kamea"



Kame_Beam_2 // The Beam's body
icon = 'Kame Tail.dmi'
icon_state = "kameb"
density = 1

proc/beam_add()
var/obj/Body = new/obj/Kame_Beam_2(src.loc)
src.Beam.Add(Body)
Body.dir = src.dir
moved++
if(moved == total)
if(src)
for(var/obj/O in src.Beam)
del(O)
del(src)
..()

mob/learn/
verb
Kamehameha() // Verb used for firing the beam
set category = "Techniques"

if(src.doing)
src << "You are already doing something!"
return

if(src.buku)
return

if(src.wrapped)
src << "Your MP has been contained in the goo!"
return

if(src.dead)
return

if(src.MP_lock)
src << "Cannot use this Technique at his time"
return

var/MP_cost = round(src.MP_max * 0.25)

if(src.MP >= MP_cost)
if(!src.doing)
usr.doing = 1
src.overlays += Kame_Charge
view(6) << "<font color = white>[src]:</font> Ka..."
sleep(8)
view(6) << "<font color = white>[src]:</font> Me..."
sleep(8)
view(6) << "<font color = white>[src]:</font> Ha..."
sleep(8)
view(6) << "<font color = white>[src]:</font> ME..."
sleep(8)
view(6) << "<font color = white>[src]:</font> HA!!!"
src.overlays -= Kame_Charge
usr.doing = 0
Kame_Shoot()


mob/proc
Kame_Shoot()

var/obj/H = new/obj/Kame_Beam_1

var/MP_damage = round(((usr.MP_skill / usr.MP_skill_max) * usr.level) + usr.HP_max * 0.35)
var/MP_cost = round(src.MP_max * 0.24)

if(src.MP >= MP_cost)
if(!src.doing)
src.doing = 1
src.MP -= MP_cost
spawn(5) src.doing = 0
spawn(5) src.frozen = 0
if(src.dir == 1)
H.loc = locate(src.x,src.y+1,src.z)
if(src.dir == 2)
H.loc = locate(src.x,src.y-1,src.z)
if(src.dir == 8)
H.loc = locate(src.x-1,src.y,src.z)
if(src.dir == 4)
H.loc = locate(src.x+1,src.y,src.z)
H.dir = src.dir
H.loc = src.loc
H.total = 10
H.owner = usr
while(H)
step(H,H.dir)
H.beam_add()
if(!H)break
var/turf/T = H.loc
if(T.density)
del(H)
break
for(var/mob/M as mob in T)

if(M == src)
continue

if(!M.dead && !M.safe)
M.HP -= round(MP_damage)
usr << "\blue Your Kamehameha slams into [M.name]."
if(prob(30))
M << "\blue [usr.name]'s Kamehameha slams into you"
src.doing = 0
src.frozen = 0
return
del(H)
sleep(1)
or you could just tell me the simple fix...
Or you could learn to do it yourself by reading the thread he linked to instead of being a lazy little brat.

If you're just going to rip and come here demanding that we fix your broken sources, you won't get any help. It's a waste of our time to help someone who doesn't want to learn because they will never contribute anything worthwhile to the community.
I need help with the variables. I need damage to reflect stats and at this point I can't incorporate it into any beam.
but instead of just helping me, you tell me to learn myself? Hey dumb ass I am trying to learn myself that's why I asked, I learn by example and someone sitting here telling me to go learn when their completely ignorant is ridiculous. I AM trying to learn that's why I asked. The laser snippet doesn't help me at all for the damage to reflect stats. I'm new to this, obviously I don't know everything but I'm trying.
Well if your trying to learn go to the byond guide or reference or have a look at tons of the libraries available. NO ONE has to help you here and using a ripped source isnt going to help you at all but its your choice. Also one more reason no one is helping you is that your request is extremely simple to do and shows how in-expierenced you are.
THIS TELLS YOU HOW TO CREATE A BEAM AND THATS IT NO MORE
http://www.byond.com/forum/?post=157546#comment667260
Alright, well thanks Dovis. I am very inexperienced and only using the source as a learning guide but I agree it doesn't help much and I'm starting to look more into the references. I'm making the effort to try and learn and appreciate the input.
Using that terribly programmed source is the worst way you can possibly learn to program.