ID:163626
 
hi i need something that can make a monster.. or w.e attack back when someone fights it...so like i already got the attack verb and everything now all i need is for the monster to fight back and also if ur below lvl 5 it attacks u it self like it comes after u at lvl 5 plz plz help here are some procs u might need



mob
proc
DeathCheck(mob/M)
if (src.Hp <= 0)
world << "[src] dies at the hands of [M]!"
del(src) //delete whatever just died
src.Hp = 30
src.loc= locate(1,1,2)




mob
var/Str = 5
var/Def = 5
var/maxHp = 100
var/maxReiatsu=100
var/Endurance = 5
var/Hp= 100
var/Reiatsu= 100
var/wealth=100
var/maxStr=5
var/maxDef=5
var/Level=1
var/Rank="Starter"
var/inventory[0]






if u need more plz tell me
I wonder if anybody told you this or not but whenever posting snippets, place them in the <DM></DM> tags!

Eg: <DM>obj/var/apple</DM> =
obj/var/apple
This makes it much more readable.

Also, take your time to type out everything so we have a better chance of understanding what you want (and no begging please).

Now, the snippet you have provided is useless to the topic in question; a suitable snippet you could have shown us is your AI code.

Essentially, you make an infinite loop which should be spawn()ed when it is created, making it search for opponents. If the mob's level is <=monster.level-5 && mob.level>=5, it should walk towards that mob, attacking and such.
In response to GhostAnime
but can u show me one i dunno how to make it
In response to Agrey123
Learn, I am not going to give you anything on a silver platter... but I guess I can help start you off:
  1. The following are a FEW ways to make infinite loops:
    while(1)
    for()

    Use either of the two in your AI procedure.
  2. Now we need it to look for mobs within a certain distance, a combination of for() and oview() or view() will do this.
  3. If it finds a mob, we need to check if it's level is within the range to be attacked. if() and && are useful here.
  4. Next, we may want to move the AI towards the mob, walk(), walk_to(), etc is useful here.
  5. Next, set up any relevant damaging ystem.. eg: if the mob is one step away (get_dist() helps here), the AI punches it. If it is three steps away, it spits at it :P.


That's merely ONE way to set up an attacking AI procedure... or you can just search the forum for any past examples or even search for a demo of one.