ID:145062
 
ive tryed and tryed but my attack system sucks! here ill show u.




mob/verb/Attack(M as mob)
set category="Commands"
if(M:key == usr.key)
usr<<"You cant attack yourself!"
else
usr.dam = rand(5,10)
usr.dam+=usr.level
usr.dam-=M:defense
usr.dam+=usr.attack
M:HP-=usr.dam
view() <<"[usr] attacked [M]! [usr.dam] damage!"
if(M:HP<=0)
switch(rand(1,10))
if(1,5,8)
new/obj/Gold_Coin
world<<"[usr] killed [M]!"
M:loc=locate(10,94,2)
M:verbs+=/mob/verb/Attack
usr.wins+=1
M:loses+=1
M:HP = 100
usr.experience+=10
if(usr.experience==100)
usr.experience=0
usr.level+=1
view() <<"[usr] got a level up! their current level is [usr.level]!"


and i dont have a deathcheck so my monsters (they are under mon >.<) die but go to the place of death for a nromal char. and i want them do be deleted and then respawned. i tryed to label monsters as NPC's but that dont work.... plzz help.

In response to A.T.H.K
thanks
In response to Pyro170
mob/verb/Attack(M as mob)
set category="Commands"
if(M == usr)
usr<<"You cant attack yourself!"
else
mob/var/tmp/dam=(usr.level-M:defence+usr.attack)
M:HP-=usr.dam
view() <<"[usr] attacked [M]! [usr.dam] damage!"
M.moncheck()
mob
proc
moncheck(M/mob)
if(M:HP<=0)
switch(rand(1,10))
if(1,5,8)
new/obj/Gold_Coin
world<<"[usr] killed [M]!"
if(typesof(/mob/whatever/))//just an example, replace it with what kind of thing your enemies are, EX mob/enemy blabla.....
del M
return
else
M:loc=locate(10,94,2)
M:verbs+=/mob/verb/Attack
src.wins+=1
M:loses+=1
M:HP = 100
src.experience+=10
if(src.experience==100)
src.experience=0
src.level+=1
view() <<"[src] got a level up! their current level is [src.level]!"
return
Not sure if this is gonna work, im at a friends house....
In response to Axerob
ok im holding.... but i dont have a deference betewwn a monster and a mob they both are set under the same catagory..
In response to Pyro170
look above, heres a more detailed example....
obj/enemy
enemyname()//then put your other sutff below...
In response to Axerob
ok i will try that
In response to Pyro170
it keeps saying undifined proc for moncheck. and i have 64 errors now
In response to Pyro170
He didn't tell the compiler that M is a mob.

mob/verb/Attack()
for(var/mob/M in get_step(usr,usr.dir)) // Will attack all mobs infront of you.
You need to stop abusing the : operator. Don't use it at all, since you don't know yet when not to. Instead, make sure your vars are given the correct type path.

Lummox JR