ID:156094
 
Ok i started off With a code that created obj arond the user and shot off the obj in each direction as a proc.

The code failed and it only shot 3 off in the fron and 1 on every other side. and it left 2 sitting next to him.

So what im asking is how would I make a code that does the same thing ,but in the best way possible.
And if you dont minde if you write a code could you put
//text explaining what each part does so I can also learn from what you have coded

Thank you if you help.

Here is the previous code I used.
mob
proc
push()
prejutsu()
if(cdelay2||swim||paralysed||dead||addled||buttonjam||resting||caught||seals||moving||dous||busy)return
if(!rinnegan)
src<<output("You must have Rinnegan activated.")
return
handseals(60,90)
if(!sealpass)return
cdelay2=1
for(var/obj/jutsu/pein/Push/M in src)M.overlays+='timer.dmi'
view(8)<<output("<font color=purple><b>[usr]: Push!","infobox")
var/K=new/obj/pushblast(loc)
K:dir=dir
K:owner=src
walk(K,dir)
var/K2=new/obj/pushblast(loc)
K2:dir=dir
K2:owner=src
var/K3=new/obj/pushblast(loc)
K3:dir=dir
K3:owner=src
var/K4=new/obj/pushblast(loc)
K4:dir=SOUTH
K4:owner=src
var/K5=new/obj/pushblast(loc)
K5:dir=SOUTH
K5:owner=src
var/K6=new/obj/pushblast(loc)
K6:dir=SOUTH
K6:owner=src
walk(K6,dir)
var/K7=new/obj/pushblast(loc)
K7:dir=EAST
K7:owner=src
walk(K7,dir)
var/K8=new/obj/pushblast(loc)
K8:dir=EAST
K8:owner=src
walk(K8,dir)
var/K9=new/obj/pushblast(loc)
K9:dir=EAST
K9:owner=src
walk(K9,dir)
var/K10=new/obj/pushblast(loc)
K10:dir=WEST
K10:owner=src
walk(K10,dir)
var/K11=new/obj/pushblast(loc)
K11:dir=WEST
K11:owner=src
var/K12=new/obj/pushblast(loc)
K12:dir=WEST
K12:owner=src
if(dir==NORTH||dir==SOUTH)
K2:x--
K3:x++
if(K4:dir==EAST&&K5:dir==EAST)
K4:y--
K5:y++
if(K11:dir==WEST&&K12:dir==WEST)
K11:y--
K12:y++
if(dir==WEST||dir==EAST)
K2:y--
K3:y++
if(K4:dir==EAST&&K5:dir==EAST)
K4:x--
K5:x++
if(K11:dir==WEST&&K12:dir==WEST)
K11:x--
K12:x++
walk(K2,dir)
walk(K3,dir)
walk(K4,dir)
walk(K5,dir)
walk(K11,dir)
walk(K12,dir)
var/sdelay=600
if(skillspeedmast)sdelay=sdelay*(1-0.15*skillspeedmast)
if(curseseal==2)sdelay=sdelay/1.5
if(curseseal==3)sdelay=sdelay/2
spawn(sdelay)
for(var/obj/jutsu/pein/Push/M in src)M.overlays-='timer.dmi'
cdelay2=0
I suggest you erase the Dragonball Z source code, that is badly done by the way, and start fresh. I didn't do this the most efficient way, but it is proper syntax-wise, which is much better than the system you're using.

obj
wave
icon = 'wave.dmi' //all objects below will use this file
density = 1 //make it dense for collisions
north
icon_state = "north"
south
icon_state = "south"
east
icon_state = "east"
west
icon_state = "west"
north_east
icon_state = "north_east"
south_east
icon_state = "south_east"
north_west
icon_state = "north_west"
south_west
icon_state = "south_west"
Bump()
flick("hit_state",src) //flick a hitting state
sleep(1)
loc = null //delete it

mob/verb/Ki_Attack()
var/obj/wave/north/N = new
var/obj/wave/south/S = new
var/obj/wave/east/E = new
var/obj/wave/west/W = new
var/obj/wave/north_east/NE = new
var/obj/wave/south_east/SE = new
var/obj/wave/north_west/NW = new
var/obj/wave/south_west/SW = new

N.loc = locate(x,y+1,z)
S.loc = locate(x,y-1,z)
E.loc = locate(x+1,y,z)
W.loc = locate(x-1,y,z)
NE.loc = locate(x+1,y+1,z)
NW.loc = locate(x-1,y+1,z)
SE.loc = locate(x+1,y-1,z)
SW.loc = locate(x-1,y-1,z)

walk(N,NORTH,1)
walk(S,SOUTH,1)
walk(E,EAST,1)
walk(W,WEST,1)
walk(NE,NORTHEAST,1)
walk(NW,NORTHWEST,1)
walk(SE,SOUTHEAST,1)
walk(SW,SOUTHWEST,1)


There are articles that can help you learn how to program, piece by piece, in an entertaining form:

http://www.byond.com/developer/articles/start
In response to OrangeWeapons
Not a DBZ source. xD lolz wish it was cause that would give me new skills to use.

But that code was achually written by me. I learned from a souce I had but yea it was written by me.

Thx for the tip on learning
In response to OrangeWeapons
Loops are good.
obj
wave
icon = 'wave.dmi'
density = 1
Bump()
flick("hit_state",src)
sleep(1)
loc = null

mob/verb/Ki_Attack()
for(var/i = 0, i <= 7; i++)
var/direction = turn(NORTH, 45 * i)
var/stepLocation = get_step(src, direction)
if(stepLocation)
var/obj/wave/theWave = new(stepLocation)
walk(theWave, direction, 1)


Pretty sure this will still let ki blasts stick to the edge of the map. Still room for refinement XD.
In response to Vermolius
well i use the second explain because it short but i understood the first one better but how would i make it so that i could shot out 3 blast one the dir of the usr = north lets say then one NW and one NE well here how i edited

obj
Phoenix_Fireball_Jutsu
icon = 'Phoenix Fireball Jutsu.dmi'
density = 1
Bump()
flick("hit_state",src)
loc = null

mob
verb
Phoenix_Fireball_Jutsu()
for(var/i = 0, i <= 3; i++)
var/direction = turn(usr.dir, 45 * i)
var/stepLocation = get_step(src, direction)
if(stepLocation)
var/obj/Phoenix_Fireball_Jutsu/PhoenixFireballJutsu = new(stepLocation)
walk(PhoenixFireballJutsu, direction, 1)