hey,
sould anyone offer me help on making it s that a character in my game must be facing a monster in order to attack it?
ive tried and i just dont know how to do it...
i would be eternaly greatful to anyone who can offer me help in regards to this...
ID:172304
Jun 1 2004, 3:25 pm
|
|
Jun 1 2004, 3:26 pm
|
|
Rewrite your attack verb so that it attacks whatever is in the turf in front of you (gotten through get_step()).
|
In response to Garthor
|
|
thank you
ill try now |
In response to GunRunner
|
|
verb/Primary_Attack(mob/M in oview(5))
set category = "Battle" var/damage = rand(1/2) if(usr.playPWeapon == "") alert("no primary weapon equiped") else if(M.client) usr << sound(primarySound) M.playHP -= damage M.death_check(src) else usr << sound(primarySound) M.playHP -= damage usr << sound(M.attackSound) M.death_check(src) ummm im a dummy and this is my Primary_Attack verb... how do i change it so that it uses the get_step() proc so that it will only attack an enemy the character is facing? |
In response to GunRunner
|
|
verb/Primary_Attack(mob/M in get_step(src,src.dir)//one step infront of the src.
set category = "Battle" var/damage = rand(1/2) if(usr.playPWeapon == "") alert("no primary weapon equiped") else if(M.client) usr << sound(primarySound) M.playHP -= damage M.death_check(src) else usr << sound(primarySound) M.playHP -= damage usr << sound(M.attackSound) M.death_check(src) |
In response to Xallius
|
|
thank you sooo very very much!!
|
In response to GunRunner
|
|
no problem, good luck on the game. ;)
|
In response to GunRunner
|
|
is ther any way to make this piece of code work so you can attack from more than one square away but only in the direction you are facing? (i.e if i was using a rifle as a weapon i can only attack in the direciton i am facing but i will have a range of greater than one square)
verb/Primary_Attack(mob/M in get_step(src,src.dir) set category = "Battle" var/damage = rand(1/2) if(usr.playPWeapon == "") alert("no primary weapon equiped") else if(M.client) usr << sound(primarySound) M.playHP -= damage M.death_check(src) else usr << sound(primarySound) M.playHP -= damage usr << sound(M.attackSound) M.death_check(src) |
In response to Xallius
|
|
is ther any way to make this piece of code work so you can attack from more than one square away but only in the direction you are facing? (i.e if i was using a rifle as a weapon i can only attack in the direciton i am facing but i will have a range of greater than one square)
verb/Primary_Attack(mob/M in get_step(src,src.dir) set category = "Battle" var/damage = rand(1/2) if(usr.playPWeapon == "") alert("no primary weapon equiped") else if(M.client) usr << sound(primarySound) M.playHP -= damage M.death_check(src) else usr << sound(primarySound) M.playHP -= damage usr << sound(M.attackSound) M.death_check(src) |
In response to GunRunner
|
|
//This can be done by checking if the src is facing M:
verb/Primary_Attack(mob/M in oview(src)) set category = "Battle" if(src.dir=get_dir(src,M)) var/damage = rand(1/2) if(usr.playPWeapon == "") alert("no primary weapon equiped") else if(M.client) usr << sound(primarySound) M.playHP -= damage M.death_check(src) else usr << sound(primarySound) M.playHP -= damage usr << sound(M.attackSound) M.death_check(src) |
In response to Xallius
|
|
u are my new best friend...
THANK YOU SOOO MUCH!! it all seems so simple now... dummy me though ah well thank thank thank you!!! |
In response to GunRunner
|
|
don't hesitate to come back with new issues.
|
In response to Xallius
|
|
thank you very much
|
In response to Xallius
|
|
Well hell, if you're just going to go ahead and spoon-feed him faulty code and undermine anyone's efforts to actually TEACH him anything, you shouldn't even be here.
|