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 ?
ID:141032
![]() Jul 5 2009, 10:52 am
|
|
Code:
mob when you bump the ship, nothing happens. but ur soppost to teleport 5,4,2. can someone help ? |
![]() Jul 5 2009, 11:27 am
|
|
no put usr in proc. ungh.
|
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 |
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 |
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) 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. |
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) |
Ripper man5 wrote:
> mob 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(). |
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 |
Frozenflake wrote:
atom/proc/Bumped(atom/movable/A)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) Something like that. |
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. |
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. |