mob
Player
icon = 'Player.dmi'
var
range
damage
speed
fired = 0
Carbine
icon_state = "Carbine"
range = 5
damage = 3
speed = 5
Rifle
icon_state = "Rifle"
range = 6
damage = 8
speed = 9
Sniper
icon_state = "Sniper"
range = 8
damage = 15
speed = 25
Bazooka
icon_state = "Bazooka"
range = 3
damage = 6
speed = 50
New()
src.AI()
proc
AI()
if(src.fired == 1)
spawn(5)
src.AI()
world << "1"
return
if(src.fired == 0)
world << "0"
for(var/mob/Enemy/X in range(src,src.range))
src.fired = 1
if(istype(src,/mob/Player/Carbine))
missile(/obj/Bullet/Carbine,src,X)
if(istype(src,/mob/Player/Rifle))
missile(/obj/Bullet/Rifle,src,X)
if(istype(src,/mob/Player/Sniper))
missile(/obj/Bullet/Sniper,src,X)
if(istype(src,/mob/Player/Bazooka))
missile(/obj/Bullet/Bazooka,src,X)
X.health -= src.damage
if(X.health<=0)
del X
spawn(src.speed)
src.fired = 0
spawn(5)
src.AI()
Problem description:
This might look a little newbie, but... a /mob/Player that has the AI() activated, will shoot ALL of the mobs in range at once. I want it so that the /mob/Player can pick only ONE target in the range and shoot at it, instead of shooting ALL enemies in the range. Why does this happen??Anyone has an idea of how to do it? I would appreciate any help. :)
I think this post should be moved to developer how to. I'm sorry about that... I posted on the wrong subject.