ID:143947
 
Code:
mob
var
lolo = 0
cherios=0
kurois=0
vai1=0
vai2=0
vai3=0
vai4=0
vai5=0
vai6=0




mob/Vaizard/verb/Cero()
set category = "Combat"
usr.stamina -= 10
if(usr.stamina <= 5)
usr<<"<font color=red><B><small><B>Combat Info:</font><font color=white><B><small> You need to rest!"
if(usr.cherios==1)
sleep(20)
usr.cherios=0
else
third()

mob
proc
third()
var/obj/H = new/obj/Bakudo/Cero
view()<<sound('cero3.wav')
H.dir = src.dir
H.loc = src.loc
while(H)
step(H,H.dir)
var/turf/T = H.loc
if(T.density == 1)
del(H)
break
for(var/mob/M as mob in T)
if(M == src)
continue
if(src.reiatsu < M.reiatsu)
src<<"<font color=#0099ff><B><small><B>Combat Info:</font><font color=white><B><small> You don't phase [M]"
if(src.reiatsu > M.reiatsu)
var/damage = src.reiatsu - M.reiatsu + 2000
M:HP -= damage
src<<"<font color=#0099ff><B><small><B>Combat Info:</font><font color=white><B><small> You hit [M] for [damage] damage!</font>"
M:DeathCheck()
usr.Levelup()
usr.exp+=rand(50,300)
usr.gold+=rand(10,20)
del(H)
sleep(2)
usr.cherios=1


Problem description:
Alright,thats all my coding for a Cero attack im making on my bleach game and I wanted to know,how would I make it have like a trail? Like the same icon but just like 3 more that follow behind?For example i'll draw a picture/diagram XD lol

o=Myself -=Cero

Current Cero:

o-

Cero I want:

o----

Try a forum search for beam attacks. That should bring up quite a few helpful hits. A lot of them are for DBZ energy attacks, so be sure to check those out.
In response to Loduwijk (#1)
Alright thanks
In response to Ryoka_Productions (#2)
Well I just checked and it didn't help that much :/ Either that or i'd need to convert/edit one of the codings to suit my game
In response to Kinotsu (#3)
I still can't figure it out :/
In response to Kinotsu (#4)
Alright, I'll see what I can do then.

First of all, it depends on what exactly you are looking for. I'm assuming you just want a tail to follow along behind the attack all in a line. I'll also assume that the tail is not purely visual, that it can effect things as well.

To put it simply, as the "head" of the beam moves you create additional "tail" units at the source location until it is the desired size. Here is the simplest example.
obj/beam
density = 1
var
initialLoc //keeps track of source for creating tail parts
obj/beam/next //next beam in the line after this one
length = 1; maxLength = 5 //My example includes the head in the length count
delay = 1 //I only set delay for the head, so it doubles as a head-identifier
atom/owner
New(loc, Dir, setDelay, setOwner)
initialLoc = loc
dir = Dir
if(setDelay != null)
delay = setDelay
beam() //if it's the head, then start moving
owner = setOwner
Move()
var/oldLoc = loc
.=..()
if(.)
if(next)
//make tail units follow
next.Move(oldLoc)
if(delay && length < maxLength)
//if it's the head and isn't long enough, add more tail units
var/obj/beam/last = src
while(last.next) last = last.next
last.next = new type(initialLoc)
last.next.dir = last.dir
length += 1
proc/beam()
//just makes it move in its direction, nothing more
while(1)
sleep(delay)
step(src, dir)
Bump(atom/A)
var/outputName = owner?"[owner.name]'s [name] beam":"A beam"
world << "[outputName] struck [A]"
del(src)
Del()
//if it gets deleted, delete tail units
if(next) del(next)
..()

Then the following example uses the above to create a lightning attack. The lightning beam is modified from the base /obj/beam type to allow it to do damage.
obj/beam/lightning
icon = 'lightning.dmi'
maxLength = 10
Bump(atom/A)
if(ismob(A))
var/mob/M = A
M.damage(10, owner)

mob
verb/shoot_lightning()
new /obj/beam/lightning(loc, dir, 1, src)
proc
damage(amount, source)
health -= amount
if(health <= 0)
die(source)
die(mob/source)
source.experience += 1

There are a lot of ways you can modify that to make the beams behave differently too, and you can find lots of cool effects. Speaking of which, this makes me want to write a demo for this, as this post has been fun.

(edit)
Bah, I just tried it out, and the recursive Move call gets caught by the maximum recursion level. I'll changing it to just use a loop within the head's Move function rather than recursively call next.Move
In response to Loduwijk (#5)
Is it possible that you can change my coding to make it do that since I did what you told me to and it just gives errors when it hits an enemy. Also,I only want the "head" of the beam to do damage or else it'd be way too overpowered o.o
In response to Kinotsu (#6)
Depending on how long it is, since you want the tail to be purely visual you could use overlays. If the tail is from 1 to 3 tiles long...
obj/beam
var/delay
New(Dir, setDelay = 1, length = 3)
var
offsetX = 0; offsetY = 0
dX = 0; dY = 0
if(Dir&NORTH) dY = -32
if(Dir&SOUTH) dY = 32
if(Dir&EAST) dX = -32
if(Dir&WEST) dX = 32
delay = setDelay
dir = Dir
for(var/index = 1 to length)
offsetX += dX; offsetY += dY
var/obj/O = new
O.icon = icon; O.icon_state = icon_state
O.dir = dir
O.pixel_x = offsetX; O.pixel_y = offsetY
overlays += O
spawn() beam()
proc/beam()
while(1)
sleep(delay)
step(src, dir)
Bump()
//whatever you want the beam to do on impact
del(src)

If the tail is longer than 3 units, you'll have to go back to using extra objects again, but the objects just won't have any functionality of their own other than the ability to play follow the leader.
In response to Loduwijk (#7)
Ok I added it in so now heres my coding

mob/Vaizard/verb/Cero()
set category = "Combat"
usr.stamina -= 10
if(usr.stamina <= 5)
usr<<"<font color=red><B><small><B>Combat Info:</font><font color=white><B><small> You need to rest!"
if(usr.cherios==1)
sleep(20)
usr.cherios=0
else
third()

mob
proc
third()
var/obj/H = new/obj/Bakudo/Cero
var/obj = new/obj/Bakudo/beam
view()<<sound('cero3.wav')
H.dir = src.dir
H.loc = src.loc
while(H)
step(H,H.dir)
var/turf/T = H.loc
if(T.density == 1)
del(H)
break
for(var/mob/M as mob in T)
if(M == src)
continue
if(src.reiatsu < M.reiatsu)
src<<"<font color=#0099ff><B><small><B>Combat Info:</font><font color=white><B><small> You don't phase [M]"
if(src.reiatsu > M.reiatsu)
var/damage = src.reiatsu - M.reiatsu + 2000
M:HP -= damage
src<<"<font color=#0099ff><B><small><B>Combat Info:</font><font color=white><B><small> You hit [M] for [damage] damage!</font>"
M:DeathCheck()
usr.Levelup()
usr.exp+=rand(50,300)
usr.gold+=rand(10,20)
del(H)
sleep(2)
usr.cherios=1


obj/beam
var/delay
New(Dir, setDelay = 1, length = 3)
var
offsetX = 0; offsetY = 0
dX = 0; dY = 0
if(Dir&NORTH) dY = -32
if(Dir&SOUTH) dY = 32
if(Dir&EAST) dX = -32
if(Dir&WEST) dX = 32
delay = setDelay
dir = Dir
for(var/index = 1 to length)
offsetX += dX; offsetY += dY
var/obj/O = new
O.icon = icon; O.icon_state = icon_state
O.dir = dir
O.pixel_x = offsetX; O.pixel_y = offsetY
overlays += O
spawn() beam()
proc/beam()
while(1)
sleep(delay)
step(src, dir)
Bump()
//whatever you want the beam to do on impact
del(src)

obj
Bakudo
Cero
icon = 'bakudo.dmi'
icon_state = "cero"
beam
icon = 'bakudo.dmi'
icon_state = "cero"


And I get this error
Vai Verbs.dm:87:obj :warning: variable defined but not used
That error leads me towards this line
            var/obj = new/obj/Bakudo/beam

How would I fix it?
In response to Kinotsu (#8)
Firstly, I gave you a beam-projectile demonstration, not a mini plug-n-play library, so it does not mesh with what you already had. Taking what I showed and pasting it into what you already had creates a nasty conflict of code that just won't work.

Also, the "error" you showed is a warning. Warnings are not errors; the compile is still successful and the program will still run if you have a warning. A warning is just alerting you to something that the compiler thinks you might not have meant to do and it is just reminding you about it. That specific error just means what it says, that you have a variable that you don't use.
mob/verb/attack(mob/M in oview(src))
var/damage = 5

The above example would give the same warning. Notice how it defines a variable for damage but then it never actually uses it. It's legal to do, but it doesn't accomplish anything.

Anyway, you asked for help and I just gave you some examples on decent ways to do beam-projectiles. It really helps if you seperate that action from the other parts of your code. Either way though, whether you take my suggestions and make a beam-system or whether you just try to pile all the beaming functionality into the function that the original action takes place in, you do one or the other. If you do seperate it though, I think you will find that makes it much easier to track down problems.

If you do want to leave it as you had it and just modify that further, and assuming you want to take that overlay route, then you would just take the overlay addition part and merge it into the function you already had.