ID:140340
 
Code:
turf
Portal
One
icon = 'Portals.dmi'
icon_state = "1"
Enter(mob/M)
usr.loc = locate(7,2,2)

////
mob
verb
Fireballskill()
var/obj/Fireball/S=new(src.loc)
S.dir = src.dir
walk(S,src.dir)
obj
Fireball
icon = 'fireball.dmi'
icon_state = "small"
Bump(mob/M)
if(istype(M))
S = new(loc)
S.icon = 'fireball_hit.dmi'
src << "Hit"
del S
else
sleep(50)
del S
var/obj/Fireball/S


Problem description:

When the projectile hits a "portal" turf which relocates the mob, it doesnt go in, or delete on impact, it just sends a runtime error.

runtime error: Cannot modify null.loc.
proc name: Enter (/turf/Portal/One/Enter)
source file: turf,skin,npc.dm,96
usr: 0
src: One (9,43,1) (/turf/Portal/One)
call stack:
One (9,43,1) (/turf/Portal/One): Enter(Fireball (/obj/Fireball))



Edit: Megelic that didn't help or make sense no offense. You only restated what I said in a different way and caused the chance of someone coming to actually help me be less likeley because you posted....sorry!
Darkjohn66 wrote:
Code:
> turf
> Portal
> One
> icon = 'Portals.dmi'
> icon_state = "1"
> Enter(mob/M)
> usr.loc = locate(7,2,2)

Pretty sure what's entering is a obj, that may be your problem.
This is one of these errors where its no 'usr in proc'. There is no user of the fireball, so it wont allow you to use usr.loc, and returning the run-time error.


Dream Tutor: usr Unfriendly
http://www.byond.com/members/ DreamMakers?command=view_post&post=35932

To fix this, you would use the following code:
turf
Portal
One
icon = 'Portals.dmi'
icon_state = "1"
Enter(mob/M) // using the mob/M, you are saying that treat everything that bumps this as a mob. This does not limit M to only be mobs
if(ismob(M)) // make sure its a mob
M.loc = locate(7,2,2) // relocate the thing that ran into it.
else
return
In response to Pirion
Ah, thanks, I totally misenterpited it for automatically limiting it to mobs, and I thought since src didn't work I'd throw usr in there even though it was a proc I thought maybe there was some rare exception and I had to delete entering objects!

PS:I'd like to see usr unfreindly be the first required reading on start even if they don't get it ^_^.
In response to Darkjohn66
There are more variables than just src and usr. A good rule of thumb is that if src is not correct, and it's not a verb, usr is never, ever, ever, ever the correct choice.

Additionally, why the hell do you have a global S variable? Get rid of that, and just use a local variable for the fireball's Bump() proc.