ID:138817
 
I will make a Dmg proc that i can use in each skill with dmg.
mob/var
SoulKnight=0//can hit soulmutant enemies and mutantguards
SoulMutant=0//can hit soulknight enemies and knightguards
Ghost=0//cant do anything
Enemies=0//can hit all
KnightNPCs=0//no stats no attack
MutantNPCs=0//no stats no attack
KnightGuards=0//can hit only soulmutant and mutantguard, maybe enemies
MutantGuards=0//can hit only soulknight and knightguard, maybe enemies
TeamMember=0//could be a problem. teammember cant attack teammember in another team??
Guildmember=0//could work no attack under guild member. maybe each guild a own var and only 3 guilds max. in beta


verb//proc
attack//DmgBalance
if(usr.Attacking) return
if(usr.Ghost==1) return
if(usr.SoulKnight==1)
usr.Attacking=1
spawn(4) if(usr) usr.Attacking=0
flick("Attack[usr.icon_state]",usr)
for(var/mob/Ghost/M in get_step(usr,usr.dir))//need something to make differnts between the var for more ways.
return
for(var/mob/SoulKnight/M in get_step(usr,usr.dir))
return
for(var/mob/KnightGuard/M in get_step(usr,usr.dir))
return
for(var/mob/Enemies/M in get_step(usr,usr.dir))
var/damage = src.Str-M.Def
damage=max(0,damage+rand(-1,1))
M.HP-=damage
M.DamageShow(damage,200,0,0)
M.DeathCheck(usr)
for(var/mob/SoulMutant/M in get_step(usr,usr.dir))
var/damage = src.Str-M.Def
damage=max(0,damage+rand(-1,1))
M.HP-=damage
M.DamageShow(damage,200,0,0)
M.DeathCheck(usr)
for(var/mob/MutantGuard/M in get_step(usr,usr.dir))
var/damage = src.Str-M.Def
damage=max(0,damage+rand(-1,1))
M.HP-=damage
M.DamageShow(damage,200,0,0)
M.DeathCheck(usr)
for//later TeamMember
for//later Guildmember
if(usr.SoulMutant==1)
for(var/mob/Ghost/M in get_step(usr,usr.dir))
return
for(var/mob/SoulMutant/M in get_step(usr,usr.dir))
return
for(var/mob/MutantGuard/M in get_step(usr,usr.dir))
return
for(var/mob/Enemies/M in get_step(usr,usr.dir))
var/damage = src.Str-M.Def
damage=max(0,damage+rand(-1,1))
M.HP-=damage
M.DamageShow(damage,200,0,0)
M.DeathCheck(usr)
for(var/mob/SoulKnight/M in get_step(usr,usr.dir))
var/damage = src.Str-M.Def
damage=max(0,damage+rand(-1,1))
M.HP-=damage
M.DamageShow(damage,200,0,0)
M.DeathCheck(usr)
for(var/mob/KnightGuard/M in get_step(usr,usr.dir))
var/damage = src.Str-M.Def
damage=max(0,damage+rand(-1,1))
M.HP-=damage
M.DamageShow(damage,200,0,0)
M.DeathCheck(usr)
else//Cause both soulknight and soulmutant ==0. later for open pvp area with npc change your class and later back if you go out
if(src.KnightGuard==1)//maybe for guards dmg
for

//will use npc attack too in it + KnightGuard and MutantGuard
//will change damage
//two of it one is meelee second is energy attacks
//maybe with var for meelee and one for energy
//i will make more a damage proc, that caculate the dmg.
//then i use in each skill this dmg proc


Its only my first try, my skills are noob like, but maybe someone can tell me my fails or could that work?
and i know it didnt work cause all var i need to make before in my project, but i mean the way i wrote this!


Could've just done this:
mob
proc
attacked(class)
Ghost
attacked(class)//<<--------------------------------------
if(class=="Soul Knight" || class=="Soul Mutant")// |
return // |
///and then define the behavior for each type etc...// |
// |
//then when you atack all you have to do is this:// |
verb // |
attack(dmgBalance) // |
if(Attacking || Ghost) return // |
Attacking=1 // |
spawn(4) Attacking =0 // |
for(var/mob/m in get_step(usr,usr.dir) // |
m.attacked(usr.class)//do this--------------------------

instead of a huge block of code. So instead of putting the behavior a monster or type exhibits inside of the attack verb you could put it inside of it's own procedure so that if you ever want to change the behavior of the monster you can just go back easily and change it, like say for instance you want all Ghost monsters to say "bwahaha, you cannot hurt me silly mortal" whenever they're attacked instead of having to change that for every class inside of the attack verb, you'd just do this:
mob
Ghost
attacked(class)
if(class=="Soul Knight" || class=="Soul Mutant")
view()<<"[src]: bwahaha, you cannot hurt me silly mortal."
return
In response to Ill Im
thx thats easier
In response to HerzogCasa
Attack()
set hidden=1
if(usr.Attacking) return
if(usr.MainClass=="Ghost") return
usr.Attacking=1
spawn(4) if(usr) usr.Attacking=0
flick("Attack[usr.icon_state]",usr)
if(usr.MainClass=="Soul Knight")
for(var/mob/M in get_step(usr,usr.dir))
if(M.MainClass=="Ghost") return
if(M.MainClass=="Soul Knight") return
if(M.MainClass=="Soul Mutant" || M.MainClass=="Monster" || M.MainClass=="Free")
var/damage = src.Str+src.HP-M.Def+M.M,MP
damage=max(0,damage+rand(-1,1))
M.HP-=damage
M.DamageShow(damage,200,0,0)
M.DeathCheck(usr)
if(usr:MainClass=="Soul Mutant")
for(var/mob/M in get_step(usr,usr.dir))
if(M.MainClass=="Ghost") return
if(M.MainClass=="Soul Mutant") return
if(M.MainClass=="Soul Knight" || M.MainClass=="Monster" || M.MainClass=="Free")
var/damage = src.Str+src.HP-M.Def+M.M,MP
damage=max(0,damage+rand(-1,1))
M.HP-=damage
M.DamageShow(damage,200,0,0)
M.DeathCheck(usr)



My new try.. did i wrote it right? can i use || ? and is return back to begin or it happens nothing?

i failed with the if statement-.-
pls help, then my first game is near beta status:)
In response to HerzogCasa
if(usr:MainClass=="Soul Mutant")


using : not .
In response to A.T.H.K
i fixed this bug and the bug with the dmg, but i have problems with the if statement.