When i use the attack verb infront of nothing it keeps making me attack myself.Like..
Raydar attacks Raydar for 100 damage.
You attack Raydar for 100 damage.
And i end up dying everytime. I problem isn't the attack verb i think.
mob/proc
Damage2(var/mob/M)
var/damage=Str//
M.HP-=damage
src<<"You attack [M] for [damage] damage!"
M<<"[src] attacks you for [damage] damage!"
This is a peice of how Damage is taken and given.
ID:2065216
Apr 5 2016, 1:50 pm
|
|
Apr 5 2016, 1:58 pm
|
|
You'd have to show your attack function and how it calls Damage2().
|
Damage(var/mob/M)
var/damage=Str// M.HP-=damage src<<"You attack [M] for [damage] damage!" M<<"[src] attacks you for [damage] damelage!" if(M.HP <= 0) M.DeathCheck(src) Punch() //set hidden=1 if(usr.Attacking) return var/mob/M=locate(/mob) in get_step(src,dir) if(M) Damage(M) usr.Attacking=1 spawn(4) if(usr) usr.Attacking=0 flick("attack",usr) Damage2(var/mob/M) var/damage=Str// M.HP-=damage src<<"You attack [M] for [damage] damage!" M<<"[src] attacks you for [damage] damage!" Punch2() var/mob/M=locate(/mob) in get_step(src,dir) if(M) Damage(M) usr.Attacking=1 spawn(4) if(usr) usr.Attacking=0 flick("attack2",usr) |
In response to DragonRador2
|
|
I'd highly recommend placing code into DM Forum-formatted structure using the dm and /dm tags surrounded by <>'s.
Like <#dm> Code goes here. <#/dm> without the #. It will look like this: Damage(var/mob/M) I also recommend not to copypasta code which is clearly visible from your code. There's use of usr and there's use of src, which is conflicting in code-grammar. Also, you may want to re-think your approach about this all. Damage() and Damage2() should all just be one procedure where you pass a /mob and a value, then return any result indicating the /mob dying and continue from there. |
@maximus: HTML entities:
< = < > = > & = & © = © Useful for letting people know about how to use HTML tags. |
the best way to do it/simplest for beginners.
mob/var |
In response to Hebrons
|
|
To be honest, I wouldn't even try to calculate damageAmount until after a target has been found. That's just extra logical power not needed. Also, unless there's a need to check if Health is < 0 elsewhere besides getDamage(), just include it within getDamage(). The only other instance I can think of deathCheck() would be used is debugging/moderation tools.
Also, if(M) for(M in get_step(src, dir)) is a wonky way of getting a possible target within a step from the user. |
In response to Ter13
|
|
Ter13 wrote:
Useful for letting people know about how to use HTML tags. Yeah. I knew they existed in theory but the memory of what they were just flew past me. |
as i said we are trying to build a foundation of something he can get a jist from.. not entirely throw everything at him.. heres a snippet of one of my actual Combat code's although i improved but here
punch(var/player/target)//seperate the melee_punch to different section's Cooldown(), Calc_dmg(), Check_Condtion(), now what's easier to understand?, exactly. but i understand your argument we dont want to teach him bad habit's that are harder to shake off later. |
So i should change my whole attack system and damage system?
|