I added the second enemy to my game, and it doesnt move at all just stands there, but my other one moves all over why is this? here is my code:
mob/Enemies/proc/Attack(mob/M) //We need to set this as the default for Attack.
flick("attack",src) //Flick the attack animation like this.
src.Preattacking(M) //This will do anything defined in the proc to M before everything else. This is most useful when lots of mobs are defined.
var/str = round(src.Strength / 4) //We now calculate the stats the same way as we do with PCs:
var/mindamage1 = src.Min_Damage + str
var/resist = M.Defense + M.AC
var/resist2 = round(resist / 2)
var/mindamage2 = mindamage1 - resist2
var/maxdamage1 = src.Max_Damage + str
var/maxdamage2 = maxdamage1 - resist2
var/chance = src.DEX + M.AGI
var/chance2 = rand(1,chance)
var/damage = rand(mindamage2,maxdamage2)
var/thevar = NORTH //Default for thevar. This is to see what dir the mob originally was, incase it gets changed in a different proc.
if(get_dir(src,M) == SOUTHEAST) //And now, for a visual effect, the mob will actually jkump into the tile that his opponent is in and hit them.
pixel_y -= 14 //We do this by making the object LOOK as if it is in the other tile. But really, it is just the icon file's coordinates being modified. Here we make the icon go down 14 pixels.
pixel_x += 14 //Ditto for the x.
thevar = SOUTHEAST
else //We will now check to see which direction the player is from the enemy again and again and set the icon to the right place.
if(get_dir(src,M) == SOUTHWEST)
pixel_y -= 14
pixel_x -= 14
thevar = SOUTHWEST
else
if(get_dir(src,M) == NORTHEAST)
pixel_y += 14
pixel_x += 14
thevar = NORTHEAST
else
if(get_dir(src,M) == NORTHWEST)
pixel_y += 14
pixel_x -= 14
thevar = NORTHWEST
else
if(get_dir(src,M) == SOUTH)
pixel_y -= 14
thevar = SOUTH
else
if(get_dir(src,M) == NORTH)
pixel_y += 14
thevar = NORTH
else
if(get_dir(src,M) == WEST)
pixel_x -= 14
thevar = WEST
else
pixel_x += 14
thevar = EAST
sleep(2) //This is set jsut right so it looks as if he also jumps back.
if(chance2 <= src.DEX)
if(damage <= 0)
damage = 1
view(usr) << "[src] hit [M] for \red[damage]\black points of damage."
M.HP -= damage
src.Postattacking(M)
else
view() << "[src] attacked [M], but missed."
src.Postattacking(M)
if(thevar == SOUTHEAST) //Now, this is the same concept as above, but this time, we are reseting him back to his original position.
pixel_y += 14
pixel_x -= 14
else
if(thevar == SOUTHWEST)
pixel_y += 14
pixel_x += 14
else
if(thevar == NORTHEAST)
pixel_y -= 14
pixel_x -= 14
else
if(thevar == NORTHWEST)
pixel_y -= 14
pixel_x += 14
else
if(thevar == SOUTH)
pixel_y += 14
else
if(thevar == NORTH)
pixel_y -= 14
else
if(thevar == WEST)
pixel_x += 14
else
pixel_x -= 14
M.DeathCheck()
mob/Enemies/proc/Wander(walking_delay) //We need to define this before hand as a default for Wander. In this, we made our own argument again.
if(walking_delay == null) //If you don't put anything in there when you call it, it will automaticly go to 5. This makes it so you don't need to type 5 every single time you define it again.
walking_delay = 5
if(walking_delay == 0)
walking_delay = 1 //0 walking delay is far too laggy, lets make it 1 if you accidently put 0.
while(src) //This means "While I am still in the world."
var/found = 0 //This we will use as sort of an "else" statement for the for proc.
for(var/mob/PC/M in oview(5))
found = 1
step_towards(src,M)
for(var/mob/PC/Mo in oview(1))
src.Attack(Mo)
break
break
if(found == 0) //If found is still 0, or "else".
step_rand(src)
sleep(walking_delay)
mob/Enemies/Were_Wolf
icon = 'werewolf.dmi'
//We don't need to define name because when we define Ankle_Bleeder as the type, the name will by default be set to Ankle Bleeder (without the underscore.).
HP = 10
MAX_HP = 10
MP = 0
MAX_MP = 0
Min_Damage = 2
Max_Damage = 1
Strength = 1
Defense = 0
AC = 0
AGI = 1
DEX = 3
Gold = 0
EXP = 0
EXP_To_Next = 0
EXP_Give = 15
Gold_Give = 12
New()
spawn()
Wander()
mob/Enemies/Thug
icon = 'thug_m1.dmi'
HP = 20
MAX_HP = 20
MP = 0
MAX_MP = 0
Min_Damage = 2
Max_Damage = 4
Strength = 2
Defense = 0
AC = 0
AGI = 1
DEX = 3
Gold = 0
EXP = 0
EXP_To_Next = 0
EXP_Give = 20
Gold_Give = 17
//Because this will use the default, we will not need to define this mob's Wander nor Attack procs.
ID:175290
May 12 2003, 3:22 pm
|
|
In response to DarkView
|
|
so what do i do?
|
In response to Nave
|
|
Think for a second.
If he said that you redifined the proc in /mob/monsters/Werewolf, then the thug doesn't know what to do. THat means you have to...? Its not that hard. Just re-define the proc in /mob/monsters. Get it? Its not that hard.. ¬.¬' |
In response to Draks
|
|
oooooooooh ok thanks so much!
|
Thats true, but you didnt re-define /mob/Enemies/New() you re-defined /mob/Enemies/Wearwolf/New(), so the Thug would have no clue of the changes made.