mob
verb
Attack()
set category = "Battle"
set name = "Attack"
usr.random = rand(1,10)
if(usr.hp > 1)
if(usr.random == 1)
view(6) << "[usr.name] kicks [src.name]!"
src.hp -= usr.str/3
sleep(20)
deathcheck()
if(usr.random == 2)
view(6) << "[usr.name] punches [src.name]!"
src.hp -= usr.str/4
sleep(20)
deathcheck()
if(usr.random == 3)
view(6) << "[usr.name] misses [src.name]!"
// Nothing happens and no power is lost.
if(usr.random == 4 && src.agility >= usr.agility)
view(6) << "[src.name] is to fast for [usr.name] and he misses."
if(usr.random == 5 && usr.def>= src.def)
view(6) << "[src.name] is like a brick and [usr.name] attacks do nothing."
if(usr.random == 10 && src.luck >= usr.luck)
view(6) << "[src.name] seems like hes to lucky to be hit by [usr.name] so he misses."
mob
proc
deathcheck()
if(src.hp <= 0)
src << "You have died!"
dead = 1
if(src == evil && usr == good)
usr.good += 1
if(evil >= 0)
usr.evil -= 2
gecheck()
if(src == evil && usr == evil)
usr.good -= 2
if(evil >= 0)
usr.evil += 4
gecheck()
if(src == good && usr == good)
usr.good -= 5
if(evil >= 0)
usr.evil += 3
gecheck()
src.loc=locate(20,10,2)
mob/monsters
New()
Chase()
Bump(mob/M)
if (istype(M,/mob/player))
Attack(M)
mob/monsters
proc
Wander(mob/monsters as mob, lag as num)
while(monsters)
sleep(lag)
var/random_direction = pick(NORTH,SOUTH,EAST,WEST)
step(monsters,random_direction)
Chase(lag as num)
var/mob/player/P
while(src)
if(P in oview(5))
step_towards(src,P)
sleep(lag)
for(P in oview(1))
break
for(P in oview(2))
break
for(P in oview(3))
break
for(P in oview(4))
break
else
step_rand(src)
sleep(10)
for(P in oview(5))
break
sleep(5)
spawn(5)
Chase()
ID:172968
Mar 5 2004, 10:23 am (Edited on Mar 5 2004, 11:54 am)
|
|
i no this is gonna be a problem with usr, and src but i didndt no another way to do it...well everytime i hit a npc monster person it says my name is attacking my name....can some help thanks
|
In response to Lummox JR
|
|
yea i no that, but how would i do that then??
|
That's because you are calling yuor own verb. (You are the user, and the source.) Add this to the top of the verb:
set src in oview(1) |
In response to Yota
|
|
k thanks that worked that (1) means how many spaces right
|
In response to N1ghtW1ng
|
|
Pass an argument instead.
|
In response to Garthor
|
|
i might sound stupid....pass an arguement is....i probably no how 2 do it jus don no wat it means more or less....
|
In response to N1ghtW1ng
|
|
It means change 'Attack()' to 'Attack(mob/Trg as mob in view(1))', and change all 'src' to 'Trg', and all 'usr' to 'src'. It's a little more reliable.
Of course, be sure to check that 'Trg' isn't null at the beginning of the procedure. |
No put usr in proc. Ungh.
Lummox JR