obj
Turret
icon='Turrets.dmi'
icon_state="Turret"
Bullet
icon='Turrets.dmi'
icon_state="Bullet"
density = 1
New()
look()
proc
look(mob/M in world)
var/obj/Bullet/B
missile(B,src.loc,M)
white
icon='White.dmi'
mob
icon='Turrets.dmi'
ID:268993
![]() Jan 13 2005, 4:24 pm
|
|
Why no worketh? :(
|
![]() Jan 13 2005, 4:25 pm
|
|
Uh, for starters, you need to add ..() to your new proc so it remaked the turret.
|
Your look() proc expects a mob as an argument, but you aren't sending one. Also, you declare a variable for the bullet, but you don't actually create it.
var/obj/Bullet/B=new |
YMIHere wrote:
Your look() proc expects a mob as an argument, but you aren't sending one. Also, you declare a variable for the bullet, but you don't actually create it. var/obj/Bullet/B=new What does that mean? :( Sowwy, I am t3h u63r newbie at coding. Sooo...Uhmm, I have this now >_>... obj No worketh :( |
The look() procedure wants a mob. You never give it a mob. Unlike a player, an NPC or whatever isn't smart enough to choose one. You have to do the choosing/finding.
|
YMIHere wrote:
By default, atom/New() doesn't do anything, so it shouldn't be a problem. =) Really? I believe when I didn't do ..() before...well, nothing happened. But, heck, I may be daydreaming, who knows. :p ~Issu |
If you have overwritten in multiple areas and don't call ..() you could run into problems. That may be what happened. You can see most procs' default action in the reference if you're not sure about one, though. =)
|
Jon88 wrote:
The look() procedure wants a mob. You never give it a mob. Unlike a player, an NPC or whatever isn't smart enough to choose one. You have to do the choosing/finding. How do I MAKE it choose/find one? O_o |
Who do you want it to shoot at? You need to send that mob to look() as an argument, or declare and find it in look() itself.
|
Well I think i made a working pick now... here is my code:
obj Still, no shooting turret :( |
I want it to shoot any mob within 10 tiles from the turret and del the bullet and only the bullet when it hits someone :/
obj |
No, pick() takes a list as an argument and return one of the things in the list at random. You're sending a null mob variable to it. If you want, you can make a list of all mobs in oview(src) and use pick() to grab one.
|
Can I see some type of code example? I know its not right to ask for code, but I just dont get things :/, I could probably understand it with some type of example >_>
|
Then first you'll need to make a list to hold the mobs in.
var/list/mobs_in_oview=new Now you can add mobs to the list. for(var/mob/M in oview(src,10) Notice that I sent src into oview as well. That's because the center argument for oview defaults to usr, but we want mobs within 10 tiles of the turret (src). Now we can pick one from the list at random, and set M to it so that we can shoot it. I'm going to declare M here because it shouldn't be an argument if nothing is being sent to look(). Make sure you take it out as an argument.
var/mob/M=pick(mobs_in_oview)
Hope that helps! =) |
I was prepared to give you an example, I just didn't know what you wanted. You explained it in the other post, though, and now you have an example. =)
|
oading Turrets.dme
Turrets.dm:13:M:warning: use of M precedes its definition Turrets.dm:14:M :warning: definition is here Turrets.dm:12:error:M :previous definition Turrets.dmb - 2 errors, 2 warnings (double-click on an error to jump to it) -_- obj |