ID:263552
 
Code:
attack()
if(/mob/bug/ in oview(1))
usr << "You attack [src]!</BR></BR>"
var/Udamage = rand(1,10)
usr << "</B>[usr] deals [Udamage] damage!</BR></BR>"
src:HP -= Udamage
src:LadieBug()
..()
else
usr << "There is nothing for you to attack [usr]."


Problem description:


When I put the code through, everything was fine- no errors, no warnings, but when I ran the program, I could not attack the creatures, and I got the message, "There is nothing for you to attack [usr]."

I know it has to do with /mob/bug .. But I just don't know what to replace it with..

Help please? :(


mob/verb/attack()
//for(var/mob/bug/B in get_step(usr,usr.dir)) // will attack bug in your direction (Optional)
for(var/mob/bug/B in oview(1))// will attack any bug 1 tile away
usr<<"You attack [B]!</BR></BR>"
var/Udamage = rand(1,10)
view() << "</B>[usr] deals [Udamage] damage!</BR></BR>"
B.HP-=Udamage
B.LadieBug()
break// attack once and break the for loop


Woosh try that now beheehehe!!!.

- Dark Emrald
In response to Dark Emrald
What if I was using 'attack' as a verb, and LadieBug() as a proc?
In response to Elite_SnowMan
Here, allow me to clean that up for you.

mob
proc
attack(mob/M in oview(1)) //this already sets a varible for what you're attacking as well as a range
var/damage = rand(1,10) // set the damage
view(M) << "[src] attacks [M]!" //tells everyone that M can see what's going on
M.HP -= damage //take away health
M << "[damage] damage!" //I don't know if you want the viwe to know or not
M.Death() //I don't know what ladybug is, but after you attack you should call a basic death proc

Death()
if(src.HP <= 0) //if its less than/equal to 0
if(src.client) //if its a player
src.loc = locate(x,y,z) //set a new loc
else
del src //delete them
In response to Pyro_dragons
Here is my code.


mob
var
HP = 30
gold = 0
silver = 0
copper = 0
Login()
world << "[usr] has just joined our world!"
icon = 'player.dmi'
loc = locate(/turf/floor/start)

verb
say(msg as text)
world << "[usr]: [msg]"

attack() // Needs more work so that Monsters can each have their
if(/mob/bug/ in oview(1)) // own attack. The bug and bee are not being read as being
usr << "You attack [src]!</BR></BR>" // there, or 'visible', I guess.
var/Udamage = rand(1,10)
usr << "</B>[usr] deals [Udamage] damage!</BR></BR>"
src:HP -= Udamage
src:LadieBug()
..()
else
if(/mob/bee in oview(1))
usr << "You attack [src]!</BR></BR>"
var/Udamage = rand(1,10)
usr << "</B>[usr] deals [Udamage] damage!</BR></BR>"
src:HP -= Udamage
src:BumbleBee()
..()
else
usr << "There is nothing here to attack."
..()

mine(obj/R as obj in oview(1))
if(R in oview(1))
usr << "You start to mine the rock..</BR></BR>"
oview() << "[usr] starts to mine the rock.."
usr:Mine()
..()
else
usr << "There is no rock present to mine..</BR></BR>"
..()
Status_Check()
usr << "You currently have:</BR>[HP] Health,</BR>[gold] gold,</BR>[silver] silver,</BR>[copper] copper."
..()


bug
icon = 'bug.dmi'

bee
icon = 'bee.dmi'


proc
BumbleBee()
if (HP <= 0)
usr << "[src] dies!</BR></BR></BR></BR>"
else
var/damage = rand(1,5)
usr << "[src] deals [damage] damage!</BR></BR>"
usr.HP -= damage
usr:User()
..()
LadieBug()
if (HP <= 0)
usr << "[src] dies!</BR></BR></BR></BR>"
del(src)
else
var/damage = rand(1,3)
usr << "[src] deals [damage] damage!</BR></BR>"
usr:HP -= damage
usr:User()
..()
User()
if (HP <= 0)
usr << "You have died.</BR></BR>"





My problem, is that the /mob/bug and /mob/bee does not work the way I'd like it to. DM says there is no errors, but to me there are. :( Help?


( And if someone said the answer already- it's not making sense to me. :( -- so sorry if that's the case. :\ )
In response to Elite_SnowMan
Elite_SnowMan wrote:
Here is my code.

Yes, why post it, you already have. Its ugly. Don't abuse the : operator. Don't use needless checks. I recommend reading the resources here.

( And if someone said the answer already- it's not making sense to me. :( -- so sorry if that's the case. :\ )

Yes you've kind of been answered. Also, for general knowledge as well, look the following up in the DM Reference (you can easily access it by pressing F1 in Dream Maker):

-locate()
-istype()
-. operator
-arguments (verb)
In response to Kaioken
Harsh.. :(
In response to Elite_SnowMan
Honest... :P
In response to LastTroubadour
Yeah I figured that much. :P

I'm just not used to the whole n00b thing..

Been kind of long since I've done something drastically new..

But I'm putting a strong attempt toward the DM Guide..