ID:263260
 
Code:
obj
Interactive
var
Hp
Defense
Boulder
Bump(mob/M)
if(istype(M,/mob/Player))
New()
src.step(src,M.dir)
..()


Problem description:
Interactive.dm:10:error:Proc definition not allowed inside another proc

You can't use New() inside that..It's not even needed there...Take it out.
What exactly are you trying to do? You are defining New() in the middle of another proc, you cannot define a proc in another proc!

My guess is that you are just lazy and didn't finish the part beneath that if() statement, and then accidently gave the New() too much indents. ... But that wouldn't make sense, at least, not to me. =/

Edit: Sorry, it's 23.15 here, and being very tired(been busy all frickin' day) I am, I didn't see the logical thing you were aiming at. This is probably what you meant to do:

        Boulder
Bump(mob/M)
if(istype(M,/mob/Player))
src.step(src,M.dir)
New()
..()


But then I have another question for you, why did you call New() if you aren't going to do anything with it anyway? Remove that. And again, sorry for me acting dumb... I'm sleepy...


O-matic
Also, to add to what Sniper and O-matic said, there is no "src.step()". step() is a proc without an owner. What you really want is step(src,M.dir).

Also, if that step causes the boulder to hit the player again, you'll have an infinate loop.
In response to O-matic
Ah, its ok. I haven't programmed for awhile, and I just got my computer back, and am learning to hack NDS ROMs(hehehe).
In response to O-matic
< The boulder doesn't move when I bump it...

        Boulder
icon_state = "Boulder"
density = 1
Bump(mob/M)
if(istype(M,/mob/Player))
step(src,M.dir)

Anything unusual?
In response to Dead_Demon
Dead_Demon wrote:
The boulder doesn't move when I bump it...

Bump is called when the object bumps into something else, not when something else bumps into the object. So you have two main options: Move that over to the player's Bump(), or make your own Bumped() proc and do it there.
In response to DarkCampainger
Oh, okay. Thanks. Can you help me with this? It wont "crush" the boulder. Sorry for all these Noobish questions ><i just haven't programmed in DM for awhile
<br/>
client
Center()
if(/obj/Interactive in oview(1))
for(var/obj/Interactive/Boulder/B in oview(1))
B.icon_state = "BoulderCrushed"
B.density = 0
In response to Dead_Demon
Remove that if() and you're golden.
In the future, if you want to check if an object of a certain type is in a list, use locate(). So something like this would work for your example:
"if(locate(/obj/Interactive) in oview(1))"

However, you don't need it since for() won't do anything if it doesn't find one.
In response to DarkCampainger
Oh, thankyou!
One more question for the day(sorry ><)

How do I make it so it destroys the boulder when the player is facing it?
for(var/obj/Interactive/Boulder/B in view(usr.dir))


That doesn't work...
In response to Dead_Demon
for(var/obj/something in get_step(some_mob, some_mob.dir))
In response to DivineO'peanut
DivineO'peanut wrote:
for(var/obj/something in get_step(some_mob, some_mob.dir))

If there's just one obj, then you'd probably want to just use locate() instead of for(). As well, if there were more than one, you'd probably want to pre-calculate the get_step(some_mob, some_mob.dir) statement, so it doesn't have to be re-calculated at each iteration.

Hiead
In response to Dead_Demon
Dead_Demon wrote:
One more question for the day(sorry ><)

One thing that is important if you want to get better at programming, is that you should not be afraid to ask questions. There are alot of people here that'd like to answer your questions!

O-matic