ID:1954580
 
(See the best response by Kaiochao.)
Code:
obj
Dodgeball
density=1
icon = 'dodgeball.dmi'
var/Owner
verb
Get()
set src in view(1)
if(!src)return
var/list/L=new()
for(var/obj/Dodgeball/C in get_step(usr,turn(usr.dir,45)))L.Add(C)
if(L.Find(src))goto skip
for(var/obj/Dodgeball/C in get_step(usr,usr.dir))L.Add(C)
if(L.Find(src))goto skip
for(var/obj/Dodgeball/C in get_step(usr,turn(usr.dir,315)))L.Add(C)
skip
if(L.Find(src))
var/obj/Dodgeball/B
for(B in usr)break
walk(src,0)
if(B)
src.Owner=usr
walk(src,get_dir(usr,src))

else
src.loc=usr
src.icon_state="Ball"
usr.overlays.Add(src.icon)
hands.Add(src)

Throw()
for(var/obj/Dodgeball/A)
if(A in hands)
hands-=src
usr.loc=A.loc
flick("Punch2",usr)
icon_state = "Ball"
walk(A,get_dir(usr,A))
Bump(A)
if(ismob(A))
var/mob/Player/M=A
if(M.Team==src.Owner:Team)walk(src,0)
else
if(OutSide.Find(M))walk(src,0)
else
walk(src,0)
if(src.Owner:Team<>M.Team)
OutSide.Add(M)
M.loc=locate(/turf/Event/DodgeBall/Center)
if(M.Team=="Red")M.x+=11
else M.x-=2
if(OutSide.Find(src.Owner))
src.Owner:loc=locate(/turf/Event/DodgeBall/Center)
if(src.Owner:Team=="Blue")src.Owner:x+=9
OutSide.Remove(src)
DodgeballCheck()
else walk(src,turn(src.dir,180))
else
if(A:type==src.type)
if(A:dir==turn(src.dir,180))
walk(A,0)
walk(src,0)
else walk(src,0)


Problem description:I'm trying to throw the ball in the players hands but it just causes a bunch of runtime errors.

The runtime errors are not random mistakes. They are diagnostic information. Use them to fix your code.
In response to ZOMGbies
I didn't say they were mistakes, I posted here as to why I was getting the errors.
In response to DagonMage
What do the errors say? (In future, try to give the information relevant to the problem, and leave out all the irrelevant info - I'm not psychic.)
In response to ZOMGbies
runtime error: Cannot read null.Team
proc name: Bump (/obj/Dodgeball/Bump)
source file: Turfs, Areas and Objs.dm,97
usr: 0
src: Dodgeball (/obj/Dodgeball)
call stack:
Dodgeball (/obj/Dodgeball): Bump(dagonmage (/mob/Player))
source file: Turfs, Areas and Objs.dm,97

So the bug is on line 97 of the file "Turfs, Areas and Objs.dm"

Use CTRL+G to Go-To line 97, and examine that.


(It looks like there is no value for "A" in your Bump(A) proc)
Bump(A)
if(ismob(A))
var/mob/Player/M=A
if(M.Team==src.Owner:Team)walk(src,0)</dm<

if(M.Team==src.Owner:Team)walk(src,0) is line 97.
In response to DagonMage
runtime error: Cannot read null.Team

So in M.team, the "M" value doesn't exist (it == null)

The runtime error will stop if you write:

if(M && M.team == src.Owner:Team)


It may however mean that the proc doesn't activate.
Nope, it's still happening.
In response to DagonMage
Then src.Owner:team has the same problem; so apply the same band-aid.
if(M && src.Owner && M.team == src.Owner:Team)


I don't expect this to get your code working, but rather stop the errors so you can better identify the cause.
Okay now, only one runtime error comes up.
runtime error: Cannot read null.Team
proc name: Bump (/obj/Dodgeball/Bump)
source file: Turfs, Areas and Objs.dm,102
usr: 0
src: Dodgeball (/obj/Dodgeball)
call stack:
Dodgeball (/obj/Dodgeball): Bump(dagonmage (/mob/Player))
In response to DagonMage
Oh. I dont know. That error is totally different from the other one.
I mean, the first one was on line 97, but this one is on line 102.
if(src.Owner:Team<>M.Team)
In response to DagonMage
How do you not know what to do?
In response to ZOMGbies
if(src.Owner:Team<>M && src.Owner && M.Team)
?
In response to DagonMage
Best response
Stop writing code. You need to figure out your game logic in plain English (or whatever your native language is) first.
posted for help not insult
In response to DagonMage
DagonMage wrote:
posted for help not insult

Kaiochao was actually offering sage advice. I've been the one coming close to insults (but it went over your head anyway).

You posted for someone to do it for you, we're trying to give you help.

The answer you gave before-- You blindly added all of the same code I gave you before without a thought about why it was necessary. Why are you checking if(M.team)?

If you don't understand why the errors are happening, you're going to be back literally every 10 minutes with [what you think is] a new problem.

edit: I didnt notice, at first but you've garbled up your own code since the OP.

if(src.Owner:Team<>M.team && src.Owner && M.Team)

^yes after fixing the error you just made, this will probably stop that particular runtime error.