ID:271793
 
i copyed this from other attack
mob
weapon
verb
Sword_Slash1()
set category = "Fighting"
for(var/mob/G in oview(1))
var/damage = round(usr.attack/1.5)
damage+=rand(damage/2,damage/1.5)
damage+=usr.swordD
damage -= G.defence / 2
usr.health += damage
G.health -= damage
if(usr.health >= usr.mhealth)
usr.health = usr.mhealth
if(damage <= 1)
damage = 1
if(G.enemy)
usr.hollowprotection = 1
view(usr,8) << "<b><font color = red>[usr] slashed [G] for [damage] damage!"
G.Death(usr)


but when i press this verb and stand face to the enemy its not attack i just want to create a attack calld sword slash and that will do the same work as normal attack
its a verb form BSOC rip
i am new at this so i am still working with rips till i will be good enough to create a street RPG or cool RPG game
here is the real verb
mob
yumichika
verb
Cyclone_Slash()
set category = "Fighting"
if(!usr.firing)
usr.firing = 1
new/obj/hurricane(locate(usr.x-1,usr.y,usr.z))
new/obj/hurricane(locate(usr.x+1,usr.y,usr.z))
new/obj/hurricane(locate(usr.x+1,usr.y-1,usr.z))
new/obj/hurricane(locate(usr.x-1,usr.y-1,usr.z))
new/obj/hurricane(locate(usr.x,usr.y-1,usr.z))
new/obj/hurricane(locate(usr.x+1,usr.y+1,usr.z))
new/obj/hurricane(locate(usr.x-1,usr.y+1,usr.z))
new/obj/hurricane(locate(usr.x,usr.y+1,usr.z))
for(var/mob/G in oview(1))
var/damage = round(usr.attack/1.5)
damage+=rand(damage/2,damage/1.5)
damage+=usr.swordD
damage -= G.defence / 2
usr.health += damage
G.health -= damage
if(usr.health >= usr.mhealth)
usr.health = usr.mhealth
if(damage <= 1)
damage = 1
if(G.enemy)
usr.hollowprotection = 1
view(usr,8) << "<b><font color = red>[usr] slashed [G] for [damage] damage!"
G.Death(usr)
sleep(65)
usr.firing = 0

now i have maked a sword slash state so when i use this verbr its should move the sword to the state
but when i press the verb its not attacking and its not show the state :S please help
i know its hard to understand what i am saying but please try
Please don't delete the code snippet section, it's there so your code copy/pastes correctly. We may be unable to follow your code properly, since it has now been displayed with errors.
In response to Cheeseburgermafia
Cheeseburgermafia wrote:
Please don't delete the code snippet section, it's there so your code copy/pastes correctly. We may be unable to follow your code properly, since it has now been displayed with errors.

yeah.but how i can put the code here so its will look like on byond?
In response to Sasuke_EX
place <-dm-> before the code, and <-/dm-> after the code. Omit the - so it looks like <this>.

This will make the stuff between the dm and /dm look like this.

It will also preserve any indenting you have done.
In response to Cheeseburgermafia
Like this

<put dm in here> your code here <put /dm here>
In response to Jman9901
Jman9901 wrote:
Like this

<put dm in here> your code here <put /dm here>
ok thanks here i edited the first messege so its will show the code good now can you help me please?
In response to Sasuke_EX
mob
yumichika
verb
Cyclone_Slash(mob/M in get_step(src,src.dir)) //Edited
set category = "Fighting"
if(!src.firing) //Edited
src.firing = 1 //Edited
new/obj/hurricane(locate(usr.x-1,usr.y,usr.z))
new/obj/hurricane(locate(usr.x+1,usr.y,usr.z))
new/obj/hurricane(locate(usr.x+1,usr.y-1,usr.z))
new/obj/hurricane(locate(usr.x-1,usr.y-1,usr.z))
new/obj/hurricane(locate(usr.x,usr.y-1,usr.z))
new/obj/hurricane(locate(usr.x+1,usr.y+1,usr.z))
new/obj/hurricane(locate(usr.x-1,usr.y+1,usr.z))
new/obj/hurricane(locate(usr.x,usr.y+1,usr.z))
for(var/mob/G in oview(1))
var/damage = round(src.attack/1.5) //Edited
damage+=rand(damage/2,damage/1.5)
damage+=usr.swordD
damage -= G.defence / 2
usr.health += damage
G.health -= damage
if(usr.health >= usr.mhealth)
usr.health = usr.mhealth
if(damage <= 1)
damage = 1
if(G.enemy)
src.hollowprotection = 1 //Edited
view(usr,8) << "<b><font color = red>[usr] slashed [G] for [damage] damage!"
G.Death() //Edited
sleep(65)
src.firing = 0 //Edited


Not sure if that will fix you're problem, but I saw a lot of usrs, so I put in src. I also indented properly. Every 4 spaces is a tab.
In response to Jman9901
Jman9901 wrote:
mob
> yumichika
> verb
> Cyclone_Slash(mob/M in get_step(src,src.dir)) //Edited
> set category = "Fighting"
> if(!src.firing) //Edited
> src.firing = 1 //Edited
> new/obj/hurricane(locate(usr.x-1,usr.y,usr.z))
> new/obj/hurricane(locate(usr.x+1,usr.y,usr.z))
> new/obj/hurricane(locate(usr.x+1,usr.y-1,usr.z))
> new/obj/hurricane(locate(usr.x-1,usr.y-1,usr.z))
> new/obj/hurricane(locate(usr.x,usr.y-1,usr.z))
> new/obj/hurricane(locate(usr.x+1,usr.y+1,usr.z))
> new/obj/hurricane(locate(usr.x-1,usr.y+1,usr.z))
> new/obj/hurricane(locate(usr.x,usr.y+1,usr.z))
> for(var/mob/G in oview(1))
> var/damage = round(src.attack/1.5) //Edited
> damage+=rand(damage/2,damage/1.5)
> damage+=usr.swordD
> damage -= G.defence / 2
> usr.health += damage
> G.health -= damage
> if(usr.health >= usr.mhealth)
> usr.health = usr.mhealth
> if(damage <= 1)
> damage = 1
> if(G.enemy)
> src.hollowprotection = 1 //Edited
> view(usr,8) << "<b><font color = red>[usr] slashed [G] for [damage] damage!"
> G.Death() //Edited
> sleep(65)
> src.firing = 0 //Edited

Not sure if that will fix you're problem, but I saw a lot of usrs, so I put in src. I also indented properly. Every 4 spaces is a tab.
there is only one problme
that not the attack i wanted ti edit
this attack is good like this
but the Sword_Slash(the first code you see at the top of page)is my problme beacuze i just want its will attack normaly but i dont know how to do that :S
In response to Sasuke_EX
Okay then...

mob
weapon
verb
Sword_Slash1(mob/M in get_step(src,src.dir))
set category = "Fighting"
for(var/mob/G in oview(1))
var/damage = round(usr.attack/1.5)
damage+=rand(damage/2,damage/1.5)
damage+=usr.swordD
damage -= G.defence / 2
usr.health += damage
G.health -= damage
if(usr.health >= usr.mhealth)
usr.health = usr.mhealth
if(damage <= 1)
damage = 1
if(G.health == 0)
G.health = G.mhealth
G.death()
if(G.enemy)
usr.hollowprotection = 1
view(usr,8) << "\red [usr] slashed [G] for [damage] damage!"


Well that's what I got. You might want to change some of the usrs to srcs. I hope you understand all of that, if you don't, tell me. I hope it works for you! :D

-------
--Key--
-------

4 spaces = 1 tab
In response to Jman9901
usr or src doesn't matter when it's a mob we're taking about since only players can access verbs(unless you manually call a verb for an NPC mob.) If we are talking about an NPC right now then usr would be appropriate since we do not want things happening based on the reference of the NPC.
In response to Kakashi24142
Oh, I guess I'm just used to src so much I always replace usr unless it's the person's name, other than src.key...
In response to Kakashi24142
Correction - usr and src are equivalent in the case of a verb on a mob that is called by the mob that owns the verb. It is not always okay in the case of mobs:

mob/proc/New()
usr << "ERROR! ERROR!" //Won't work


It is not always okay in the case of mob verbs:

mob/verb/Push()
set src in view(0)
step(usr, get_dir(src, usr)) //Moves the pusher, not the pushee


In general, if src would work, use src. You always know what src is. usr can change - and there could be some unforeseen corner case that results in usr being something weird.

Only use usr where absolutely necessary.
In response to Jp
Yes I'm aware of that, I'm talking about cases like this:
mob/NPC/verb/Talk()
src<<"Hello" //this would just output the message to the NPC unless /mob/NPC was the value of world.mob
usr<<"Hello"//this is right.
In response to Jman9901
Jman9901 wrote:
Oh, I guess I'm just used to src so much I always replace usr unless it's the person's name, other than src.key...

all this but no answer
can someone create for me a attack just a verb calld attack and when you press it its will hurt the enemy that all then i will change the attack name into Sword SLash and all my problme sloved

i know its not for here but i dont want to open new topic
i want to make all who i can see on my screen blind and frozen
how am i doing it?
screen.frozen = 1?
scree.sight = BLIND?
In response to Sasuke_EX
please?