ID:271403
 
obj
Thunder
icon = 'Attacks.dmi'
icon_state = "Bubble"
density = 1
Bump(A)
del(src)


mob
verb
TB() // Verb used for firing the beam
set category = "Moves"
set name = "Thunder Bolt"

if(usr.PP <= 20)
usr<<"You dont have enough PP to use Thunder Bolt 20 is needed"
return

else
usr.firing = 1
usr.PP -= 20
var/obj/Thunder/K = new /obj/Thunder
K.loc = usr.loc
K.dir = usr.dir
K.name="[usr]"
walk(K,usr.dir)
var/random = rand(1,6)
if(random == 5||random==1)
sleep(45)
del(K)
sleep(10)
usr.firing = 0

else
var/random2 = rand (1,4)
if(random2 == 1||random2 == 4)
usr.firing = 1 // Sets the firing var to 1, so he cant fire another beam // Disables the mob's movement
view()<<"<font size=1><font face=verdana><b><font color=white>[usr]<font color=red> Says: *Thunder Bolt*"
var/obj/Thunder/T = new /obj/Thunder
T.loc = usr.loc
T.dir = usr.dir
T.name="[usr]"
walk(T,usr.dir)
sleep(45)
del(T)
if (target == null)
del(T)
sleep(10)
usr.firing = 0

else
usr<<"You Missed!"


1.how do I make it take out damage,2.whenever it reaches a turf that u can enter it spams alot how do I fix that?

Edit:I wanna make it so the Attack deals damage to a mob that it bumps into and I want to make it so if it bumbs into a Enter() turf no errors apear.
i can only answer one question

to take out dammage

hitpoints -= damage /* takes the hitpoints var and subtracts the damage var from it*\
You've got a whole bunch of stuff there that quite frankly doesn't make sense. How about you write out, in english, what is supposed to be happening, and then maybe we can provide some advice?
In response to Poisonstrike
I wanna make it so the Attack deals damage to a mob that it bumps into and I want to make it so if it bumbs into a Enter() turf no errors apear.
In response to Element Hero creator
Element Hero creator wrote:
if it bumbs into a Enter() turf no errors apear.

Let's start there. Obviously, you're doing something downright stupid in Enter(). Here are a few possibilities:

1) You're using usr. This is Wrong.
2) You are using the colon operator. This is Wrong.
3) You are defining the argument to Enter() as a type without checking it. As an example:
mob/var/canEnter = 0

turf/locked/Enter(mob/M)
if(M.canEnter) return 1
else return 0

Note the lack of any istype() checks. This is Wrong. Just because you call it a mob, doesn't make it a mob.

Here's a right way to do it:

turf/locked/Enter(mob/M)
if(istype(M)) //if M is the type we said it is (in this case, /mob)
if(M.canEnter) return 1
else return 0
else return 0


(Redundancy for clarity, anybody looking to get their jollies by saying "oh Garthor you could've done that with fewer lines of code" look elsewhere)

Without actually seeing your code I'm not sure what, exactly, your problem is, but I'm quite seriously willing to bet all the cash in my wallet that it's one of those three.

That's $4, by the way.

I wanna make it so the Attack deals damage to a mob that it bumps into

attack
parent_type = /obj
//this line means that we can just use /attack/foo and it will work as if it was /obj/attack/foo
//seriously. There's only so many times you can type /obj before you go insane.
var/damage = 0 //damage this attack does
Bump(atom/A)
if(istype(A, /mob)) //only damage mobs
src.attack(A)
del(src) //always delete ourselves when we bump into something
proc
attack(mob/M)
if(istype(M)) //never hurts to be absolutely sure
M.hurt(damage) //hurt them
lightning
damage = 10
lightening
damage = 1
In response to Garthor
Now it wont let me enter the turf o.O