In response to YMIHere
runtime error: list index out of bounds
proc name: look (/obj/Turret/proc/look)
usr: null
src: Turret (/obj/Turret)
call stack:
Turret (/obj/Turret): look()
Turret (/obj/Turret): New(the turf (10,1,1) (/turf))

var/list/mobs_in_oview=new
obj
Turret
icon='Turrets.dmi'
icon_state="Turret"
density = 1
New()
look()
..()
proc
look()
for(var/mob/M in oview(src,10))
mobs_in_oview.Add(M)
var/mob/M=pick(mobs_in_oview)
var/obj/Bullet/B=new
missile(B,src.loc,M)
Bullet
icon='Turrets.dmi'
icon_state="Bullet"
density = 1
white
icon='White.dmi'
mob
icon='Turrets.dmi'
In response to Skye Reaver
Why did you move that list outside of the proc? It should be right above the for loop. Anyway, you might want to make sure there are mobs is oview(src,10), and if there aren't quit the proc.
In response to YMIHere
Oh to hell with it, I give up on DM >_>
In response to Skye Reaver
Skye Reaver wrote:
Oh to hell with it, I give up on DM >_>

Nnnnuuu, don't. I used to be the worst nubbie ever. =/ I never gave up...and I got a quarter-way decent. :p
Just keep try on smaller things. :p
In response to Skye Reaver
Skye Reaver wrote:
Oh to hell with it, I give up on DM >_>

No! I put work in here to help you, and now you'll pay me back by getting it working. =P
In response to Hell Ramen
_> But I want to be able to do this!!! teheheh, I dun see whats wrong :( Tell meh what to change this too , to make it work...
obj
Turret
icon='Turrets.dmi'
icon_state="Turret"
density = 1
New()
look()
..()
proc
look()
var/list/mobs_in_oview=new
for(var/mob/M in oview(src,10))
mobs_in_oview.Add(M)
var/mob/M=pick(mobs_in_oview)
var/obj/Bullet/B=new
missile(B,src.loc,M)
Bullet
icon='Turrets.dmi'
icon_state="Bullet"
density = 1
white
icon='White.dmi'
mob
icon='Turrets.dmi'

Tank ya.
In response to Skye Reaver
Well, for starters, tell us what doesn't work about it. Not yet though, I just read up on the missle proc and it only needs a type path. You're doing extra work. =P

You won't be able to copy and paste this, but here's a fix for that.
look()
var/list/mobs_in_oview=new
for(var/mob/M in oview(src,10))
mobs_in_oview.Add(M)
var/mob/M=pick(mobs_in_oview)
missile(/obj/Bullet, src.loc, M)

Instead of creating the bullet yourself, you give the missle() proc a type path and it will create it for you.

Now let us know if anything is wrong, and what it is.
In response to YMIHere
runtime error: list index out of bounds
proc name: look (/obj/proc/look)
usr: null
src: Turret (/obj/Turret)
call stack:
Turret (/obj/Turret): look()
Turret (/obj/Turret): New(the turf (10,10,1) (/turf))

obj
Turret
icon='Turrets.dmi'
icon_state="Turret"
density = 1
New()
look()
..()
proc
look()
var/list/mobs_in_oview=new
for(var/mob/M in oview(src,10))
mobs_in_oview.Add(M)
var/mob/M=pick(mobs_in_oview)
missile(/obj/Bullet, src.loc, M)
Bullet
icon='Turrets.dmi'
icon_state="Bullet"
density = 1
white
icon='White.dmi'
mob
icon='Turrets.dmi'
In response to Skye Reaver
My guess is that there is nobody in oview(src, 10). That why you have to make this check in the proc.

if(!(locate(/mob) in oview(src,10))) // Nobody is there.
return // So there won't be anything to shoot at.



*Edit
Not sure about the order of preference here so I put in extra parenthesis.
In response to YMIHere
#define DEBUG
obj
Turret
icon='Turrets.dmi'
icon_state="Turret"
density = 1
New()
look()
proc
look()
var/list/mobs_in_oview=new
if(!locate(/mob) in oview(src,10))
return
else
for(var/mob/M in oview(src,10))
mobs_in_oview.Add(M)
var/mob/M=pick(mobs_in_oview)
missile(/obj/Bullet, src.loc, M)
Bullet
icon='Turrets.dmi'
icon_state="Bullet"
density = 1
white
icon='White.dmi'
mob
icon='Turrets.dmi'

That? I get no runtimes with that, but the turret doesnt shoot at all even when I get in view.
In response to Skye Reaver
Skye Reaver wrote:
#define DEBUG
> obj
> Turret
> icon='Turrets.dmi'
> icon_state="Turret"
> density = 1
> New()
> look()

>

That? I get no runtimes with that, but the turret doesnt shoot at all even when I get in view.

Hmm, for this line

        
New()
look()


Don't you need spawn() to call it?

So try this:

   New()
spawn()
look()


I might be wrong though.
In response to N1ghtW1ng
YAH0000! Total Worketh XDDD
In response to N1ghtW1ng
Another thing Id like it to do...
As long as the mob stays in view, repeat the look() (keep shooting till the mob is no longer in view)

#define DEBUG
obj
Turret
icon='Turrets.dmi'
icon_state="Turret"
density = 1
New()
spawn(10)
look()
proc
look()
var/list/mobs_in_oview=new
if(!locate(/mob) in oview(src,10))
return
else
for(var/mob/M in oview(src,10))
mobs_in_oview.Add(M)
var/mob/M=pick(mobs_in_oview)
missile(/obj/Bullet, src.loc, M)
Bullet
icon='Turrets.dmi'
icon_state="Bullet"
density = 1
white
icon='White.dmi'
mob
icon='Turrets.dmi'
In response to Skye Reaver
You have to be there when it's created because it's called from New(). =)

I have a feeling you want this to run every couple of seconds or so, though, so I'm in head of you. =P

Some notes first, you don't need the return and the else, but now that I think about it, it can be done better with just one if and letting the rest fall through.
look()
if(locate(/mob) in oview(src,10))
var/list/mobs_in_oview=new
for(var/mob/M in oview(src,10))
mobs_in_oview.Add(M)
var/mob/M=pick(mobs_in_oview)
missile(/obj/Bullet, src.loc, M)


Now, to make this procedure run indefinitely we can just put the whole thing in a while loop and add a sleep() in there. =)
look()
while(1) // This loop will never end.
if(locate(/mob) in oview(src,10))
var/list/mobs_in_oview=new
for(var/mob/M in oview(src,10))
mobs_in_oview.Add(M)
var/mob/M=pick(mobs_in_oview)
missile(/obj/Bullet, src.loc, M)
sleep(50) // Go through the loop every five seconds.

In response to Skye Reaver
Use spawn(), and break. Make if()'s to make sure there is a mob still in the screen when you call it again. So at the bottom do something like

   [Code]
spawn(30)
look()


Make sure you check to see if there is a mob though...I might be terribly wrong and just causing a giant infinite loop though.
In response to N1ghtW1ng
Oh, I overlooked that. That spawn is definitely handy when I changed look() into an infinite loop. If I had to guess, though, I'd say the reason it worked for him is probably because the turret was created before his mob, and that spawn slowed down the calling of the look() proc just enough for him to be created. =)
In response to YMIHere
One more thing and ill leave yall alone XD
I want it to output a message to the usr when they are hit with a bullet...
obj
Turret
icon='Turrets.dmi'
icon_state="Turret"
density = 1
New()
spawn(10)
look()
proc
look()
while(1)
if(locate(/mob) in oview(src,10))
var/list/mobs_in_oview=new
for(var/mob/M in oview(src,10))
mobs_in_oview.Add(M)
var/mob/M=pick(mobs_in_oview)
missile(/obj/Bullet, src.loc, M)
sleep(10)
Bullet
icon='Turrets.dmi'
icon_state="Bullet"
density = 1
Bump(obj)
usr << "u got shot!111!!"
white
icon='White.dmi'
mob
icon='Turrets.dmi'

Obviously thats not working so ... how? XD and the shooting works perfectly, thanks alot.
In response to Skye Reaver
No put usr in proc. Ungh.

Lummox JR
In response to N1ghtW1ng
To do it that way would require another proc, but it's an acceptable way to do it also.
something
New()
spawn()
LoopingProc()

proc/LoopingProc()
ProcToBeLooped()
spawn(30)
LoopingProc()

proc/ProcToBeLooped()
world << "I've said it once, and I'll say it again..."


In response to Skye Reaver
As Lummox said, usr is innappropriate here (it may look like caveman speak to you, but that's just the filters. =P). When atom/movable/Bump() is called, the atom that got bumped into is the argument.

Bump(atom/A)
if(ismob(A)) // Only display the message if A is a mob.
A << "Did that hurt?"
Page: 1 2 3