ID:141032
 
Code:
mob
Ships
ship1
icon='Ship.dmi'
icon_state="Movement"
ship=1
Bump()
if(usr.ship)
return
if(!usr.ship)
usr.loc=(locate(5,4,2))



when you bump the ship, nothing happens. but ur soppost to teleport 5,4,2. can someone help ?


no put usr in proc. ungh.
In response to Jeff8500
mob
Ships
ship1
icon='Ship.dmi'
icon_state="movement"
ship=1
Bumped(var/mob/M)
if(M.ship)
return
if(!M.ship)
M.loc=(locate(33,28,1))

---
but theres an error :
error:Bumped :undefined proc
In response to XskyflakezX
Use bump instead...also, the first if under bumped is un-needed, you can delete it completely.
In response to Dan0971
it still doesn't work.
mob
Ships
ship1
icon='Ship.dmi'
icon_state="Movement"
ship=1
Bump(var/mob/M)
if(istype(M))
if(M.ship)
return
if(!M.ship)
M.loc=(locate(33,28,1))
---
when i bump to it. nothing happens
In response to Dan0971
Dan0971 wrote:
Use bump instead...also, the first if under bumped is un-needed, you can delete it completely.

This is poor advice considering Bump() would have to be called from the thing doing the bumping not the thing being bumped...

To OP:
atom/proc/Bumped(atom/movable/A)
atom/movable/Bump(atom/A)
A.Bumped(src)


That should work for what you want. Then of course you have to switch it back to Bumped()

*EDIT*: BTW: I forgot to include (src) as the argument for Bumped(). That would create problems. :) Corrected.
idk.
Ripper man5 wrote:
why the heck can't you use usr in this case isn't it fine?

Bump() is not usr-safe. Bump's only argument is the atom that src bumped into.

mob/Bump(atom/obstacle)
if(istype(obstacle,/mob/ship)) src << "You bumped into a ship! It's not like it could pop out of the bushes or something..."
Ripper man5 wrote:
> mob
> Ships
> ship1
> icon='Ship.dmi'
> icon_state="Movement"
> ship=1
> Bump()
> if(usr.ship)
> return
> else
> usr.loc=(locate(5,4,2))
>

try that.

Bump() doesn't call when someone bumps the atom
Bump() does call when someone bumps someone else.

You are using Bump() in the wrong manner...

EDIT: BTW: I made a mistake with my example. Forgot to include the src argument in Bump().
In response to AJX
atom/proc/Bumped(atom/movable/A)
atom/movable/Bump(atom/A)

mob
Ships
ship1
icon='Ship.dmi'
icon_state="Movement"
ship=1
A.Bumped(src)
if(usr.ship)
return
if(!usr.ship)
usr.loc=(locate(5,4,2))
---- is that wat ur thinking? ----
well it doesn't work :( nothing happens when u bump into it
In response to Frozenflake
Frozenflake wrote:
atom/proc/Bumped(atom/movable/A)
atom/movable/Bump(atom/A)

mob
Ships
ship1
icon='Ship.dmi'
icon_state="Movement"
ship=1
A.Bumped(src)
if(usr.ship)
return
if(!usr.ship)
usr.loc=(locate(5,4,2))
---- is that wat ur thinking? ----
well it doesn't work :( nothing happens when u bump into it
I'm not sure that should even compile.... I'm actually pretty sure that should generate many different compile issues.

The code would look something more like this:
atom/proc/Bumped(atom/movable/A)
atom/movable/Bump(atom/A)
A.Bumped(src)

mob
Ships
ship1
icon='Ship.dmi'
icon_state="Movement"
ship=1
Bumped(mob/M)
if(M.ship)
return
if(!M.ship)


Something like that.
In response to AJX
Don't forget to include if(istype(M)), to avoid errors.
Ripper man5 wrote:
why the heck can't you use usr in this case isn't it fine?

Because if - for example - somebody was to push another player into the ship, it would cause the first player to board the ship, not the one being pushed onto it.

As a rule of thumb: usr is not safe in any procs except mouse-related procs.
In response to Garthor
Garthor wrote:
Don't forget to include if(istype(M)), to avoid errors.

Yer. I never really consider having anything but mobs moving that are dense because I've never encountered that situation.
In response to AJX
Well, it's not like it's much of a stretch here: it's entirely reasonable to think that these ships could be shooting each other with cannonballs.