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.
|
In response to Hell Ramen
|
|
By default, atom/New() doesn't do anything, so it shouldn't be a problem. =)
|
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 |
In response to YMIHere
|
|
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 :( |
In response to Skye Reaver
|
|
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.
|
In response to YMIHere
|
|
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 |
In response to Hell Ramen
|
|
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. =)
|
In response to Jon88
|
|
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 |
In response to Skye Reaver
|
|
I think pick() does that. :p
|
In response to Hell Ramen
|
|
I tried pick(M) but it didnt work :O
|
In response to Skye Reaver
|
|
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.
|
In response to Skye Reaver
|
|
Well I think i made a working pick now... here is my code:
obj Still, no shooting turret :( |
In response to YMIHere
|
|
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 |
In response to Skye Reaver
|
|
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.
|
In response to YMIHere
|
|
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 >_>
|
In response to Skye Reaver
|
|
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! =) |
In response to Skye Reaver
|
|
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. =)
|
In response to YMIHere
|
|
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 |
In response to Skye Reaver
|
|
You've indent everything to go inside that for loop, but there is only supposed to be one line in it. Un-indent the other three lines. =)
|