ID:262134
 
moving proc

client
North()
if(usr.blast == 1)
for(var/obj/beams/O in world)
if(O:owner == "[usr.key]")
O:dir = 1
else
..()
if(usr.hairon == 1)
for(var/obj/hairs/top/B in view(usr,5))
if(B:owner == usr.name)
B:x = usr.x
B:y = usr.y + 1
B:dir = usr.dir
if(usr.dradar == 1)
dballs(usr)
else
usr.hair2(usr)
for(var/obj/hairs/top/B in view(usr,5))
if(B:owner == usr.name)
B:x = usr.x
B:y = usr.y + 1
B:dir = usr.dir
if(usr.dradar == 1)
dballs(usr)
South()
if(usr.blast == 1)
for(var/obj/beams/O in world)
if(O:owner == "[usr.key]")
O:dir = 2
else
..()
if(usr.hairon == 1)
for(var/obj/hairs/top/B in view(usr,5))
if(B:owner == usr.name)
B:x = usr.x
B:y = usr.y + 1
B:dir = usr.dir
if(usr.dradar == 1)
dballs(usr)
else
usr.hair2(usr)
for(var/obj/hairs/top/B in view(usr,5))
if(B:owner == usr.name)
B:x = usr.x
B:y = usr.y + 1
B:dir = usr.dir
if(usr.dradar == 1)
dballs(usr)
East()
if(usr.blast == 1)
for(var/obj/beams/O in world)
if(O:owner == "[usr.key]")
O:dir = 4
else
..()
if(usr.hairon == 1)
for(var/obj/hairs/top/B in view(usr,5))
if(B:owner == usr.name)
B:x = usr.x
B:y = usr.y + 1
B:dir = usr.dir
if(usr.dradar == 1)
dballs(usr)
else
usr.hair2(usr)
for(var/obj/hairs/top/B in view(usr,5))
if(B:owner == usr.name)
B:x = usr.x
B:y = usr.y + 1
B:dir = usr.dir
if(usr.dradar == 1)
dballs(usr)
West()
if(usr.blast == 1)
for(var/obj/beams/O in world)
if(O:owner == "[usr.key]")
O:dir = 8
else
..()
if(usr.hairon == 1)
for(var/obj/hairs/top/B in view(usr,5))
if(B:owner == usr.name)
B:x = usr.x
B:y = usr.y + 1
B:dir = usr.dir
if(usr.dradar == 1)
dballs(usr)
else
usr.hair2(usr)
for(var/obj/hairs/top/B in view(usr,5))
if(B:owner == usr.name)
B:x = usr.x
B:y = usr.y + 1
B:dir = usr.dir
if(usr.dradar == 1)
dballs(usr)
Southwest()
if(usr.blast == 1)
return
else
return
Southeast()
if(usr.blast == 1)
return
else
return
Northwest()
if(usr.blast == 1)
return
else
return
Northeast()
if(usr.blast == 1)
return
else
return
Center()
if(usr.blast == 1)
return
else
return


Beam Code

obj
techniques
Ki_Blast

beams
var
power = 10
owner = ""
hit = 0
Ki_Blast
icon = 'kamehameha.dmi'
icon_state="head"
density = 1
power = 10
Bump(atom/M)
hit = 1
if(istype(M,/mob/))
var/damage = power
M:HP -= damage
M:deathcheck(M,src.owner)
for(var/mob/N in world)
if(owner == "[N.key]")
for(var/obj/beams/Trail/T in world)
if(T:owner == "[N.key]")
del T
M << "test"
N.blast = 0
N.client.eye = N
del(src)
else
..()

Trail
icon = 'kamehameha.dmi'
icon_state="body"
density = 1

proc
Moving(obj/O,mob/N,obj/F)
if(O:hit == 0)
sleep(1)
var/m = new /obj/beams/Trail(O:loc)
var/w = "[F:dir]"
m:dir = "[w]"
m:owner = F:owner
step(O,O:dir)
N.client.eye = O:loc
O:Moving(O,N,m)
else
N.blast = 0
for(var/obj/beams/Trail/T in world)
if(T:owner == O:owner)
del T
N.client.eye = N
del O

mob
verb
Blast()
if(usr.seltech == "Ki Blast")
if(usr.blast == 0)
var/t = new /obj/beams/Ki_Blast(usr.loc)
step(t,usr.dir)
t:owner = "[usr.key]"
t:dir = "[usr.dir]"
step(t,usr.dir)
var/w
var/n = new /obj/beams/Trail(usr.loc)
w = usr.dir
step(n,w)
n:owner = "[usr.key]"
n:dir = w
usr.blast = 1
t:Moving(t,usr,n)
else
usr << "You have already launched a attack."



Image Hosted by ImageShack.us


ok my problem is well when i shoot my beam it starts off Striaght but then when i turn it well you see what happends
ummm try making seprate icons like beam beam head beam left or try making a movie and then click 4 icon states and put a thing for each way u face i gues but im not to sure
In response to Mastergamerx
Why did you reply to this post? You have no idea what you are talking about.
Let's clear up some of the basic troubles first. You're using : indiscriminately all over that code, even in places where you clearly don't "need" it.

Example 1:
            for(var/obj/beams/O in world)
if(O:owner == "[usr.key]")
O:dir = 1

O is known to be an /obj/beam, so clearly it already has the owner and dir vars. The . operator is an infinitely better choice here.

Example 2:
                for(var/obj/hairs/top/B in view(usr,5))
if(B:owner == usr.name)
B:x = usr.x
B:y = usr.y + 1
B:dir = usr.dir

Again, B's type is known. Because it's an obj it will have x, y, and dir; I assume /obj/hairs/top has the owner var defined as well, or else you wouldn't be using it. So again, the . operator is correct here.

In fact you should change every instance of the : operator to . and use type casting anywhere you really need to.

Beyond that, the ==1 test for a truth value is bad programming practice. Never use if(var==1) when if(var) will suffice. It's cleaner and it won't bomb out if the var changes to 2 or "1" or something. (Likewise, use if(!var) instead of if(var==0).)

The deathcheck() proc, while not listed in your code, is either being called incorrectly or is defined incorrectly. Calling M.deathcheck() (and not M:deathcheck()!) is right, but you don't need to send M as an argument. By the time deathcheck() runs, what was M in the calling proc is now src inside deathcheck(), so the argument would just be the same. The only thing deathcheck() needs as an argument is the killer (and for some more advanced death systems, the weapon used).

And finally, for simplicity's sake this code is right out:
    Southwest()
if(usr.blast == 1)
return
else
return

Either way it's going to return, so just put in return and lose all the if/else stuff.

All that said, the way the beam is being moved and created doesn't seem to make a lot of sense, and that's the core of the problem you're having. When you turn it shouldn't change all the existing beams you've shot; those should keep moving until they hit a target. The flow of logic should look more like this:
// in a movement proc
if(usr.blast)
usr.dir = newdir
return
return ..()

// in a looped proc that handles the blasting
// remember src would be the mob here, not usr
var/obj/beam/B
for(B in get_step(src, dir))
if(B.owner == key) break
if(B)
// find the end of the beam and add onto it, or deliver damage
B.Extend()
else
// tell the new beam who fired; set its dir and such from there
B = new(get_step(src, dir), src)

Of course the tricky part from here is that then you have to figure out what to do with beams you've turned away from, or that got interrupted by another object stepping into the blast. This is a harder problem than it sounds like; it involves making the beam somewhat capable of handling this on its own. But that's a subject for another post.

Lummox JR
In response to Dranzer_Solo
Dranzer_Solo wrote:
Why did you reply to this post? You have no idea what you are talking about.

Replying with bitterness and cynicism certainly isn't going to put a nice face on you, which will more than likely dissuade people from helping you in the future.
In response to Malver
yeh sry about that im just kinda ticed off about this code
In response to Lummox JR
k thanks ill try it out in the murning im tired so im goin to bed
In response to Lummox JR
Actually, what you said about stepping into the beam's path is something so intelligent I'd only expect it from you, Lummox.

Dragonball games have a pattern of beam tails only being... decorative. In my opinion, it's the tail of the beam that is the most deadly.

Look at it this way, the head of the beam is a massive ball of energy, maybe 10-30% of the beam's energy. However, the player continues to pour energy from his body, thus the tail. The tail is not just a blur left by the head, but rather a deadly and much more controlled portion of the head. Once struck by the head, you still have 70%-90% of the energy to deal with.

In my opinion, the tail is what the beam gains its energy from. I think the head is a lossy portion of the tail, and loses about 1% of its heat energy as it passes on. Some of the tail again contributes to the head as it passes forward.


Another thing I don't understand about Dragonball. Why are all the more powerful attacks blinding? If the attack has more heat energy, it would be converting less energy to light. Ever seen white fire? No. Because it is PURE heat that you can feel from five feet away.
In response to Malver
but im not to sure

Well, he does have a point, Mastergamer's post was very unhelpful, and he obviously didn't know what he was talking about.