ID:158125
 
Alright, I have an attack animation. I want it to display, with overlays, when I attack. Here's the code: (I copied from Scizzees system because I'm going to edit and adapt after the animations are done)

verb
Attack(mob/M as mob in get_step(src,src.dir)) // the mob has to be facing you to attack
set category="Armor/Weapons"/// you all know wut this is.
if(istype(M,/mob/)) // if it a Mob they we're attacking continue.
if(attackable == 0)
var/damage=round(usr.str-M.def/2) /// define a damage var. user's str vs. M's defence divided by two. you can edit this to your liking.
if(damage <= 0)// if the damage is less or equal to 0 make it 1 damage.
damage = 1//change it :P
M.hp-=damage//remove the damage from M's HP.
range()<<"[name] punched [M] with his fists inflicting <b>[damage]</b> damage!"/// tell the people in ranged M's being attacked.
usr.DeathCheck(M)//see if M is dead.
else
src<<"You can't attack this NPC!"
else
return


Help Please!

Tman1114
Tman1114 wrote:
Alright, I have an attack animation. I want it to display, with overlays, when I attack. Here's the code:

I don't completely follow you here. I don't see anything related to attack animations in there. Are you saying that you took that generic attacking verb and don't have anything related to animations in it and you want us to write up some code for you to paste into that? Especially without us knowing anything about your animation - which you made sound anything but generic ("I want it to display, with overlays," what is "it"? Do you have an object type to represent it and you're making it a new object that shows something?)

Based on what little you've said and given, the best I can say is the following.

Have your animation object type use New() to add the overlays to itself that it needs and locate itself to your location (or the location of the defender, or whatever is appropriate). You could have New() accept an argument for its position.
In response to Loduwijk
I have a char.dmi file with the animation "mattack" and "fattack" in it. I would like to know a verb or proc that would allow me to change the mob with its overlays to the attack animation, and then change it back again.
In response to Tman1114
flick()?
That was a poor choice for something to copy-and-paste. Off the top of my head, it is conflating usr, src, and M, has a backwards DeathCheck() proc, and is very poorly commented.

I'd suggest starting with a tutorial.