ID:144948
 
Code:
mob/verb
Ki_Blast()
set category = "Techniques"
var/kicost= 5
stamcost= 5
if(src.Tired_Check())
src<< "[RESTRICTIVEFONT]You are too tired to do that. Maybe you should get some rest.[FONTCLOSURE]"
return

Busy()
if(!busy)

if(src.ki<= kicost)
src << "[RESTRICTIVEFONT]You can't seem to gather enough energy.[FONTCLOSURE]"

if(src.ki >= kicost)
busy= 1
sleep(4)
src.ki-= kicost
src.stamina-= stamcost
view(src)<< sound('Ki Blast.wav')
var/obj/Ki_Blast/O = new /obj/Ki_Blast(src.loc)
O.shooter= src
O.damage= src.pl/5
walk(O,src.dir)
busy= 0


obj/Ki_Blast
var/mob/shooter as mob
var/damage
icon= 'Ki Blast.dmi'
density= 1
Bump(mob/combatant/M)
if(istype(M,/mob/combatant/))
if(M.kiresistance/10>= damage)

if(prob(50))
view(src)<< "[COMBATFONT][M] has deflected away [shooter]'s [src]![FONTCLOSURE]"
del(src)
return

if(prob(50))
view(src)<< "[COMBATFONT][M] has dodged [shooter]'s [src]![FONTCLOSURE]"
del(src)
return
if(prob(5))
view(src)<< "[COMBATFONT][M] has dodged [shooter]'s [src]![FONTCLOSURE]"
del(src)
return

if(prob(5))
view(src)<< "[COMBATFONT][M] has dodged [shooter]'s [src]![FONTCLOSURE]"
del(src)
return

if(prob(round(M.kiresistance- damage/250)))
if(prob(50))
view(src)<< "[COMBATFONT][M] has deflected away [shooter]'s [src]![FONTCLOSURE]"
del(src)
return

if(prob(50))
view(src)<< "[COMBATFONT][M] has dodged [shooter]'s [src]![FONTCLOSURE]"
del(src)
return


M.pl-= damage
view(M)<< "[COMBATFONT][shooter]'s ki blast slams into [M]![FONTCLOSURE]"

if(M.Death_Check())
world<< "[BATTLEINFOFONT][M] has been killed by [shooter]![FONTCLOSURE]"
var/x= M.x
var/y= M.y
var/z= M.z
del(M)
new/obj/Crater(locate(x,y,z))
shooter.exp+= M.expgiven
shooter.Exp_Check()
del(src)


Problem description: This is the code for my ki blast. It Makes a blast and saves the src of the verb ki blast to the ki blast's variable shooter. It is then supposed to give the shooter the exp. But it doesn't give the shooter anything. I obviously did this wrong so how should I do it?

Double u te ef, mate.

Busy()
if(!busy)

... ? Indendation?

var/obj/Ki_Blast/O = new /obj/Ki_Blast(src.loc)
O.shooter= src
O.damage= src.pl/5
walk(O,src.dir)

All of that junk should be passed in the New() proc

if(prob(5))
view(src)<< "[COMBATFONT][M] has dodged [shooter]'s [src]![FONTCLOSURE]"
del(src)
return

if(prob(5))
view(src)<< "[COMBATFONT][M] has dodged [shooter]'s [src]![FONTCLOSURE]"
del(src)
return


Eurr? .. Wha? Why's that twice over there?
5/100*2= 10/200 = 5/100

del(M)
new/obj/Crater(locate(x,y,z))
shooter.exp+= M.expgiven

Eurr. What if M is a player? Constant disconnect!
And how is it going to give the shooter M.expgiven, when there is no M!

Bump(mob/combatant/M)
if(istype(M,/mob/combatant/))

Redundant!
Should be;
Bump(mob/combatant/M)if(istype(M))
...


obj/Ki_Blast
var/mob/shooter as mob


Makes no sense. Does nothing.



Snippet of how I see it should be;
obj/var/mob/owner
mob/verb/shoot()
new /obj/shoot(loc,dir,usr)

obj/shoot
New(location,direction,shooter)
loc=location
owner=shooter
walk(src,direction)
Bump(var/atom/movable/a)if(ismob(a))
var/mob/M=a
view()<<"[M]: AAIIEEEEE"
if(!M.client){del(m);return}
M<<"Pwoor you. You were kiwwed byw [src.owner]"
src.owner.exp+=M.expgiven



Any mistakes, I'll edit, it's 8 in the morning. >.>;



In response to Mysame
Oh I see. I can't believe I missed that before. I put del(src) in there before because I was just testing it.