ID:2448794
 
(See the best response by Kaiochao.)
Code:
Skill/Attacks/RockBlast
Difficulty=1
Experience=1
var/Master=0
icon='Asteroid.dmi'
desc="You throw a rock at your opponent and deal damage with your strength. When masterd this rock explodes!"
verb/Rock_Blast()
set category="Skills"
if(Master==0)
if(usr.RPMode) return
if((usr.icon_state in list("Meditate","Train","KO","KB"))||usr.Frozen) return
if(usr.attacking||usr.Ki<125) return
if(!usr.CanAttack(125,CD)) return
CD=(usr.Refire*2)/(max(0.7,Experience/100))
usr.Ki=max(0,usr.Ki-125)
usr.attacking=3
usr.Bandages()
spawn(usr.Refire) usr.attacking=0
if(Experience<100) Experience+=rand(4,9)
if(Experience>100) Experience=100
hearers(6,usr) << pick('Blast1.wav','Blast2.wav')
var/obj/ranged/Blast/RockBlast/A=new(get_step(usr,usr.dir),usr)
animate(A, transform = matrix()*2, time=3)
A.Radius=1
flick(usr,"Blast")
A.pixel_x=pixel_x
A.pixel_y=pixel_y
A.pixel_x+=rand(-6,6)
A.pixel_y+=rand(-6,6)
A.Belongs_To=usr
A.icon=icon
A.Damage=20*usr.BP*usr.Str*Ki_Power //200
A.Power=20*usr.BP*Ki_Power //200
A.Offense=usr.Off
if(Experience>=100)
animate(A, transform = matrix()*2, time=3)
A.Radius=2
A.Explosive=1
A.Shockwave=1
A.dir=usr.dir
A.loc=usr.loc
walk(A,A.dir)
spawn(12) del(A)


Problem description:

So, when the technique is Mastered, it gets larger and has an increased radius (As seen by A.Radius = 2).

The issue I am having is because of this increased Radius, the attack is hitting the User due to where the attack is spawning.

I am trying to figure out how to have the technique spawn 2 tiles away from the user direction when it is mastered (Under the if(Experience>=100)

Thanks!

Currently, you're using
get_step(usr,usr.dir)

for the initial location of A. This is one step from the user in the user's direction, because get_step(ref, dir) is one step from ref in the direction dir.

There are other ways to get this, but you can go one step further by simply calling get_step again:
get_step(get_step(usr, usr.dir), usr.dir)
Could I add get_step(get_step . . . under the if statement?
I also might need to do more than two get_step's, but if I try 3, it errors out saying it was expecting 2
In response to Chewyy
Best response
3 would have to look like
get_step(get_step(get_step(usr, usr.dir), usr.dir), usr.dir)

More readably,
get_step(
get_step(
get_step(
usr,
usr.dir),
usr.dir),
usr.dir)

At this point, might as well show one of the other ways:
/* e.g. get_steps(usr, usr.dir, 3)
the turf 3 steps from usr in usr's direction */

proc/get_steps(atom/ref, dir, dist)
var x = ref.x, y = ref.y // coords to be modified for dir and dist
if(dir & EAST) x += dist // dir includes east, go east
else if(dir & WEST) x -= dist // dir includes west, go west
if(dir & NORTH) y += dist // dir includes north, go north
else if(dir & SOUTH) y -= dist // dir includes south, go south
return locate(x, y, ref.z) // return turf at modified coords
Great! This is extremely helpful!

My last question would be how to have it so I can have an if statement where it'll have different step counts based on such