ID:149627
 
The key numlock off 9 is usually a proc that makes a pc move diagonal. instead of a movement proc i want it to be a attack. How would I accomplish this?
replace the default macro for Northeast()

client.Northeast()
Attack()
In response to Foomer
Wait i found a way to make it work but i need the person not to move. How do i disable diagonal movement?
In response to Tazor07
If you don't include the default behavior (..()), then it won't move them.
In response to Foomer
client.Northeast()
src.HP -= damage
sleep(10)
src.DeathCheck()
This code doesnt work, why?
In response to Tazor07
Tazor07 wrote:
client.Northeast()
src.HP -= damage
sleep(10)
src.DeathCheck()
This code doesnt work, why?

When dealing with client you need to use mob, and also you lack the var for damage I think you want.

client/Northeast()
var/damage=src.mob.power
src.mob.hp-=damage
sleep(10)
src.mob.DeathCheck()
In response to Super16
client/Northeast(mob in oview(1))
var/damage= 5
src.mob.HP-=damage
src.mob.PCDeathCheck()
sleep(10)

When i press it and no one is near me i attack myself. Also Now i want to make it say i used flick proc with a sword that goes the direction your facing is the place if someone is there, gets damaged?
In response to Tazor07
client/Northeast(mob in oview(1))

When i press it and no one is near me i attack myself.

There is no argument to the Northeast() proc. You have to handle all of the finding of targets yourself.
In response to Spuzzum
How do you make it like for instance Zelda like. Like if you arent pointing the right way and there is no enemy where you aim the sword the monster doesnt get hurt
In response to Tazor07
Tazor07 wrote:
How do you make it like for instance Zelda like. Like if you arent pointing the right way and there is no enemy where you aim the sword the monster doesnt get hurt

When someone presses client/Northeast(), check src.mob.dir, and then use get_step() to find the turf that the user is facing. In that turf result, check for enemies, and hurt them appropriately.

Example process:

create variable my_turf = get step in src.mob.dir
create variable mob_found = 0
for every mob in my turf
attack mob
mob_found = 1
play hit sound effect
if mob_found is equal to 0
play miss sound effect

I leave it up to you to convert that to DM code! =)
In response to Spuzzum
i need a good example
In response to Tazor07
That was a good example.
In response to Foomer
foomer what i mean is its kinda confusing i havent used things like that so please give it in dm form
In response to Tazor07
Spuzzum wants you to do the work yourself and not rely on people to give you code. If you don't understand what things are, look them up in the reference. get_step() is really the only one you need to look into, if you're familiar with DM at all.
In response to Foomer
Ok im sorry that i asked so many examples please forgive me for wasting your time
In response to Spuzzum
for every mob in my turf

for (Var [as Type] [in List]) Statement

Im just alittle confused i dont want a example just a explanation on this so i can learn.
In response to Tazor07
Tazor07 wrote:
for every mob in my turf

for (Var [as Type] [in List]) Statement

Im just alittle confused i dont want a example just a explanation on this so i can learn.

You've never seen the for() proc before? =|

for(var/obj/O in whatever)
//do this
//do that
//yadda yadda

If the variable O already exists (i.e. you made it earlier), you use

for(O in whatever)
//do this
//do that
//yadda yadda
In response to Spuzzum
client/var/my_turf = get_step(src,mob.dir)
client/var/canAttack = TRUE as num
client/var/mob_found = 0
client/Northeast(mob/M in oview(1))
if (canAttack)
canAttack = FALSE
for(M in var/my_turf)
flick('Attack.dmi',usr)
if(mob_found = 1)
usr<<sound('Door.wav')
M.PCDeathCheck()
sleep(10)
canAttack = TRUE
if (mob_found = 0)
usr<<sound('Door.wav')
M.PCDeathCheck()
sleep(10)
canAttack = TRUE
I get many errors.

Missing Expression
Missing Expression
=: expected a constant expression
src: undefined var