ID:147332
 
obj
hoix7
icon = 'towns.dmi'
icon_state = "hoix7"
density = 1
obj/hoix7/Bump(mob/M)
M.loc = locate(5,4,2)
return..()

I have no idea why this isn't working. It's most likely my inexperience with the Bump proc but can anyone help me out?

Here's what im trying to do. I will eventually add the rand_walk() proc to the obj so it will be a mobile random moving city. But I want it to be so when someone bumps the obj, they will enter the city.
Bump() is called when something bumps into an object. If a mob bumps into a wall, the mob's Bump() proc is called with the turf as the argument. So you've got it the wrong way around, waiting for the object to bump into the mob, which isn't likely to happen. Its an easy mistake to make, but here's a useful way to fix it:

Its called, "The Bumped() proc":

<code>atom/proc/Bumped(atom/movable/A) return atom/movable/Bump(atom/A) A.Bumped(src) return</code>

Now instead of calling Bump() for your object, call Bumped() instead.

The same trick works good for things like Click() --> Clicked(), or pretty much any proc that isn't followed by another proc with the same name plus "ed". (Enter, Entered, Exit, Exited, etc...)
In response to Foomer
obj
hoix7
icon = 'towns.dmi'
icon_state = "hoix7"
density = 1
proc
Bumped(atom/movable/A)
usr << "bump"
src.loc = locate(5,4,2)//(/turf/machines/aat)
return..()


Man... Im really trying this out but im still getting no luck from the game... I just can't wonder what im doing wrong.

Oh, and does it have to be atom/movable? Is that just an example for a path of an object? If not, how am I supposed to link this proc directly to the object?
In response to ZLegend
ZLegend wrote:
obj
hoix7
icon = 'towns.dmi'
icon_state = "hoix7"
density = 1
proc
Bumped(atom/movable/A)
usr << "bump"
src.loc = locate(5,4,2)//(/turf/machines/aat)
return..()


Man... Im really trying this out but im still getting no luck from the game... I just can't wonder what im doing wrong.

Oh, and does it have to be atom/movable? Is that just an example for a path of an object? If not, how am I supposed to link this proc directly to the object?


You don't understand this proc stuff very well do you?

<code>obj hoix7 Bumped(atom/movable/A) A.loc = locate(5,4,2)</code>

A is whatever bumped this object. Since only movable objects can bump something, its safest to define A as /atom/movable.

Since you want to warp whatever bumped the warp object somewhere, and A is the object that bumped it, you want to change A's location.

Since the Bumped() proc has no default behavior, you don't need to call its default behavior with ..().

That's all there is to it.


I'm not sure exactly what you're doing with this, but it would probably be better to create a generic warp object with x, y and z destination variables, then just edit them individually in the map editor.

<code>obj hoix var destx = 0 desty = 0 destz = 0 Bumped(atom/movable/A) A.loc = locate(destx, desty, destz) return</code>

Now just place it in the map editor, and using the state editor, change destx, desty and destz to whatever coordinates you want it to warp stuff too.
so, you're positive you want a bump thing, u sure u dont want it so that when u touch it, it will take you somewhere, for example

<code> turf/something//the name of our turf icon='something.dmi' icon_state = "something" Entered(mob/M) if(istype(M,/mob))//is it a mob that entered? M.loc=locate(x,y,z) </code>
In response to Chibi_Gohan123
what's the istype instruction do?
In response to ZLegend
ZLegend wrote:
what's the istype instruction do?

Well, there's that wonderful link over to the left for the DM Reference that you could check out. The help function in Dream Maker is good for that kind of thing, too. Basically, however, istype checks to see what type of thing a variable is, and if it is what you're checking (in this case /mob) it returns 1(true).