ID:147411
 
my attack verb doesnt seem to be working im not really sure why. the verb is there but nothing happens when you use it. if some could tell me where it went wrong that would be helpful.

mob
verb
Attack()
var/mob/M = locate(/mob/) in get_step(src,src.dir)
if (!M) return
Damage(M)
proc/Damage(mob/M)
var/hit = roll(1,20)
var/dodge = roll(1,20)+ usr.Dodge
var/damage = rand(usr.TATK_minimum,usr.TATK_maximum)
if (!usr.newbie == M.newbie)
return
if (usr.attack == "1")
return
if (usr.attack == "0")
if (usr.KeySkill == "ImprovedUnarmedStrike")
hit += usr.ImprovedUnarmedStrike
if (usr.KeySkill == "Swords")
hit += usr.swords
if (usr.KeySkill == "Guns")
hit += usr.Guns
if (hit >= dodge)
damage -= M.armor
if (damage > 0)
M.health -= damage
view(4) << "[usr.Name] hit for [damage]. [M] has [M.health] Health left."
deathcheck(M)
if (damage <= 0)
view(4) << "[usr.name]'s attack on [M] bounces off their armor!"
if (dodge > hit)
view() << "[usr.name] attempted to hit [M.name], but missed."
usr.attack = 1
sleep (usr.weaponspeed)
usr.attack = 0
Sleinth wrote:
my attack verb doesnt seem to be working im not really sure why. the verb is there but nothing happens when you use it. if some could tell me where it went wrong that would be helpful.

Don't use > in place of a tab. Use a few spaces. Nobody can read it the way you did it.

Lummox JR
In response to Lummox JR
Ok there I changed it.
the attack verb its self is ok but no check

Attack(mob/M in get_step(src,src.dir))
Damage(M)

but when you get to the Damage system you have set it to
a mob in the world when its allready getting info about the mob from the verb

so change this
proc/Damage(mob/M in world)
in to this
proc/Damage(mob/M)
In response to Madpeter
I changed it to proc/Damage(mob/M) but the same thing keeps happening, nothing
In response to Sleinth
mob
verb
Attack()
var/mob/M in locate(/mob/) in get_step(Player,Player.dir)
Damage(M,src)

mob
proc/
Damage(mob/M,mob/Player)
var/hit = roll(1,20)
var/dodge = roll(1,20)+ Player.Dodge
var/damage = rand(Player.TATK_minimum,Player.TATK_maximum)
if (Player.newbie != M.newbie)
return
if (Player.attack == "1")
return
if (Player.attack == "0")
if (Player.KeySkill == "ImprovedUnarmedStrike")
hit += Player.ImprovedUnarmedStrike
else if (Player.KeySkill == "Swords")
hit += Player.swords
else (Player.KeySkill == "Guns")
hit += Player.Guns
if (hit >= dodge)
damage -= M.armor
if (damage > 0)
M.health -= damage
view(4) << "[Player.Name] hit for [damage]. [M] has [M.health] Health left."
deathcheck(M)
if (damage <= 0)
view(4) << "[Player.name]'s attack on [M] bounces off their armor!"
if (dodge > hit)
view(4) << "[Player.name] attempted to hit [M.name], but missed."
Player.attack = 1
sleep (Player.weaponspeed)
Player.attack = 0


u qill need to re tab it.
In response to Madpeter
I tried changing it but there is an error in the line

var/mob/M in locate(/mob/) in get_step(src,src.dir)

the error is error:locate :unexpected 'in' expression
In response to Sleinth
Change the first "in" to an equals sign.

You'll also want to put in a check to see if M is null, in case there isn't anyone in front of the player. This is as easy as doing:

<code>if (!M) return</code>

just after the var/mob/M=blah line in attack().
In response to Crispy
well I changed it but nothing is happening still this doesnt seem to be an easy problem. I will modify the first post with any changes that have been made so you can look at it. I was thinking about adding something in the code so I could see where the problem is like an alert message for ever part that works or something.