obj/projectile
proc
projectile_fire(var/target_lock = FALSE)
//code homing system here
if(target_lock && owner.target)
while(owner)
if(get_dist(src, owner.target) > 1)
src.dir = get_dir(src, owner.target)
step(src, owner.target)
else src.Bump(owner.target)
sleep(world.tick_lag * src.delay)
else walk(src, src.owner.dir, world.tick_lag * src.delay)
spawn(duration) del(src)
ability/quincy/skill
klavier
name = "Klavier"
cooldown = 60
icon_state = "klavier"
perform(mob/a)
if(a.race.info != "Quincy") return
if(a.weapon != "Quincy Bow") return
var/obj/projectile/P1 = new/obj/projectile/quincy/arrow
var/obj/projectile/P2 = new P1.type
var/obj/projectile/P3 = new P1.type
P1.owner = a
P2.owner = a
P3.owner = a
P1.dir = a.dir
P2.dir = a.dir
P3.dir = a.dir
if(a.dir == NORTH || a.dir == SOUTH)
P1.loc = locate(a.x , a.y, a.z)
P2.loc = locate(a.x - 1 , a.y, a.z)
P3.loc = locate(a.x + 1 , a.y, a.z)
else if(a.dir == EAST || a.dir == WEST)
P1.loc = locate(a.x , a.y, a.z)
P2.loc = locate(a.x , a.y + 1, a.z)
P3.loc = locate(a.x , a.y - 1, a.z)
spawn() P1.projectile_fire()
spawn() P2.projectile_fire()
spawn() P3.projectile_fire()
Problem description: Greetings, there must be a better way to do this. This is nothing but repetitive code. In addition what if I want this to fire 3 more times? 3 Arrows every 2 seconds or so.
-Regards