Ok can someone out there PLEASE tell me what is wrong with this program I wrote? It is supposed to make a shield icon in every direction around the mob and then follow him around. What it is doing is making a single shield in front of the mob, making black spaces everywere else where other shileds should be, and it wont move with him. Heres the code.turf/shield1
icon = 'sspell.dmi'
icon_state = "1"
density = 1
turf/shield2
icon = 'sspell.dmi'
icon_state = "2"
density = 1
turf/shielde
icon = 'sspell.dmi'
icon_state = "3"
density = 1
turf/shieldw
icon = 'sspell.dmi'
icon_state = "4"
density = 1
mob/verb/shield()
new/turf/shield1(locate(x,y+1,z))
new/turf/shield2(locate(x,y-1,z))
new/turf/shielde(locate(x+1,y,z))
new/turf/shieldw(locate(x-1,y,z))
spawn(20)
for(var/turf/shield1/S in view())
del S
for(var/turf/shield2/W in view())
del W
for(var/turf/shielde/E in view())
del E
for(var/turf/shieldw/W in view())
del W
Can someone please fix this? I cant think of anything else I
could try and right now I've basicly given up hope. So someone please help?
ID:147206
Aug 9 2004, 2:52 pm
|
|
In response to DarkView
|
|
Ok. This may be a little hard to get your head around, so feel free to ask any questions.
/* |
In response to DarkView
|
|
Thanks man. I've completely got it figured out now. Also thanks for the tip about the html tag thing. In short: Thanks
|
First, the shields shouldn't be turfs. I recommend using objs, although a mob could do the job it's not really right for the job.
You've got a spawn(20) in there. I'm not sure what you've tried to do there. You've either tried to use spawn() instead of sleep(), or you've forgotten to indent the stuff after spawn(). Ie.
A sleep() would work exactly as you have it except with spawn(20) replaced with sleep(20).
You're also failing to properly track the shields. Instead of scrolling through the stuff in oview(), wouldn't it be easier to just have variables pointing to the specific objects you created?
Now this isn't going to follow the player around. It'll actually stop the player from moving (because they'll bump into the dense objs surrounding them).
I'll try and quickly write you up a demo explaining some techniques that you'd use. I'll reply with it as soon as possible.
Also, when on the forums you should make use of the <dm> HTML tag when showing code (as I did above). If you don't know HTML just put a <dm> tag at the start of the code snippet, then a </dm> tag at the end of the snippet.
The tags are only used on BYOND Forums but it makes it much easier for the people who help out here to help you.