mob/proc/Knocked_out(mob/M as mob in get_step(src,usr.dir))
if(M.hp == 0)
view(6) << "[M] has been knocked out!"
mob
verb
Attack(mob/M as mob in get_step(src,usr.dir)) //the verb name, look no var/mob/M in oview(1)
if(M.hp <= 0 ) //if the mobs hp is less than or equal to 0
usr.attacking = 1
M.attacking = 1
M.move = 0
M.ko = 1 //sends M to death proc
else if(prob(70))//You got a 70% chance of it continueing and not going to the else
usr.attacking = 0
M.attacking = 0
M.move = 1
M.ko = 0 //sends M to death proc
var/damage = usr.strength - M.defense //assigns a random number between 1 and 5 to damage
src<<"You attack [M] for [damage] damage!" //says you attack
M<<"[src] attacks you for [damage] damage!" //tells the mob (in case that mob is another player) you attacked them
M.hp -= damage //the mobs hp is subtracted by the number in damage
M.Knocked_out(M)
else //if you didn't hit
src<<"You attempt to attack [M] but miss!" //says player miss
M<<"[src] attempts to attack you but misses!" //tells the M player missed
sleep(7) //code sleeps for 7/10 of a second.
usr.attacking = 0 //attacking goes to 0, now the usr can attack again
Problem description: Ok, Basically my problem is that I am trying to either A.) Create a proc that is able to be used in a verb(In this case Attack would be that verb) and allow it to run so that when the hp of a mob reaches 0 it will tell the user that the mob has been knocked out, but not repeat.. I am really assuming this is an easy fix, but its just slipping my mind... Or B.) Simply just add something to my attack code that allows the text not to repeat...
And now my next problem, umm ok, I am not sure exactly what this issue is or where its occuring as the last time I ran my project everything worked fine, now for some reason when I updated Byond I got a warning saying that cKey has been phased out, replace with cKeyEx, and before and after that it would not allow me to click on my login screen.... And it kinda bugs my map up where my login screen is and when I put these codes in here
turf
New
Click()
icon = 'New.dmi'
icon_state = ""
usr.CreateCharacter()
Continue
Click()
icon = 'Continue.dmi'
icon_state = ""
usr.ChooseCharacter()
Delete
Click()
icon = 'Delete.dmi'
icon_state = ""
usr.DeleteCharacter()
The "as" and "in" keywords don't actually do anything in process arguments, that's only for verb arguments.
if(M.hp == 0)
Because you're using the '==' operator, this check will fail if M's health falls below 0 (ie is negative). You should use '<=' like you did in the Attack() verb.
The center of view() defaults to the usr, which in this case is usually the one who knocked-out the mob. That should be view(6, src) (I'll get to why it should be src and not M in a bit)
For your Attack() verb, don't mix and match usr and src. src holds what you want, so you might as well stick to that.
You also need to check that damage isn't negative, or weak players will actually heal stronger enemies. You can use var/damage = max(usr.strength - M.defense,0) to keep the damage at or above 0.
Okay, this is silly, and here's why: you're passing 'M' to a process that it owns, which means 'src' already holds the value you want. Most people would pass 'src' to a Kocked_out/Death process in this situation, so it knows who caused it. Here's how I would suggest writing it:
As for your second question, the map editor changed a bit in recent version. Now to overlay two turfs on top of one another, you have to CTRL+Click when placing the second turf. To change this behavior so you "insert" above instead of "replace" the existing turf, go to your map, and go into Option->Click Behavior.
If you're login screen looks all messed up (like the image is repeated a bunch), that's a result of the change from the old TILED_ICON_MAP to the new TOPDOWN_MAP map_format. There are two ways to fix this.
I recommend simply deleting and replacing your login screen (and any other multi-tiled turfs/objects placed in the old versions, however be aware that only one tile will actually have the density, so you may need filler objects if your multi-tiled object is dense).
However, you can also revert to the old map_format (which disables big icons and some other new features):
Also, for your buttons, you may want to do mouse_opacity = 2.