Yeah, I actually deleted my /player because I thought it should look like his code. My bad.

if(istype(usr,/mob/players)) was the original paste I was going to put :) I use /mob/players in my game for my characters.

P.S. I didn't write that for him I copied it from my game because I am not primarily a programmer. So of course I knew it was wrong, I wasn't trying to provide a fix, just an example.
In response to Ter13
Ter13 wrote:
There's a little known syntax quirk in istype() where if the second argument isn't provided, it'll check against the cast type of the variable.

The DM Reference includes this in the arg description and it even provides an example for it.

I think it'd be nice if we could copy this behavior somehow in our own procs.
entity
var components[]

// "vartype" is a proc variable referring to the type of the variable this is being set to
proc/GetComponent(Type = vartype)
// this proc is basically a wrapper for:
return locate(Type) in components

// e.g. 1: "has component"
if(entity.GetComponent(/component/thingy))

// e.g. 2: "get component"
var component/thingy/thingy = entity.GetComponent()


AERProductions wrote:
So would adding the second argument help
It makes no difference, so it wouldn't help. It would help even less to use istype(usr, /mob/m), considering usr is not appropriate and /mob/m isn't the type you want (nor is it an existing type).
Lol. This is all interesting and extremely informative but I still can't seem to resolve my issue.

Ter13 wrote:
I have searched through the whole project and the above post is the only time where mob/Crossed() is declared. I am failing to understand.

In the above code, mob/Crossed() isn't declared, though.

I should have been more clear. This is the only time where I have a sequence of atom/movable/Crossed() within this project. I even used the find function for the just in case and I assure you, there is no mob/Crossed() nor obj/Crossed() or any other ones that I might have missed. I feel like I am on a different wavelength.

atom
movable
proc
onCrossed(atom/movable/O)

Crossed(atom/movable/O)
O.onCrossed(src)

obj/Projectile
onCrossed(atom/movable/O)
world.log << "[src] crossed [O]"
Crossed(atom/movable/O)
..()
world.log << "[O] crossed [src]"
New()
walk(src,EAST)
spawn(100)
loc = null


Try debugging your project. We can't really help you because there's not enough information here to be of any help at all.

All I can tell you, is that if Crossed()/onCrossed() are not being called, either you aren't using Move() properly, or you aren't calling default on Crossed() somewhere in your code.

Just saying: "It isn't working" tells us nothing.
In response to Ter13
Before I carry on, I think I might have confused the actually functionality of onCrossed(). What I believe it does, it looks for a mob within the same exact loc. My assumption is, if the mob is not moving and I get close to them and place an obj that I am calling a projectile right on of the mob, something should happen.

Note: Unleash is not a movable object.

Does this fact change everything?
onCrossed() doesn't LOOK for anything.

onCrossed() is triggered by Crossed(), which is triggered when you Move() an object over another one.

It will not be triggered if you manually set the location of the object on top of another one, because Crossed() is not called by manually setting the location of the object.

You should never directly set the location of an object to move it unless you don't need to depend on Cross()/Enter()/Entered()/etc. being called.
In response to Ter13
That makes perfect sense. I will tinker with it some more. Thank you Ter13 and those who have responded to this post.
Page: 1 2