ID:272194
 
OK, my pokemon game is up and running, a couple of days ago I came here asking how to make a pokeball code soon made one myself :),anyways I tried making the HM surf code by myself, I set it so when I right click the badge it says activate surf and when you activate it, it makes your var(Surf) to 1, so I was wondering how do I make it so If I have my surf set to 1, that I could go right through water?
You override the Enter() proc, which determines whether a mob (or obj) can enter (move into) an atom or not. Look it up in the DM Reference. It can return false to disallow the movement, and true to allow it. Though, to allow the movement through your override, you'll want to 'return ..()' and not 1, because if you return 1 the movement will take place no matter what, even if there are 10 dense objects at the destination turf.

In Enter(), if a mob can swim (or whatever), then allow them entry. Perhaps you should do this by temporarily making the turf's density = 0 while calling the default Enter() reaction ( ..() ). That way players that can swim will ignore the turf's density, but they still won't be able to swim into water that has other dense things in it (ie a boat or another player...).

However, the more foolproof method would probably be to do it the other way around; give the water an actual density of 0, and override Enter() in order to disable movement rather than enable it; in your Enter(), simply allow the proc to proceed only for certain specific conditions, ie: if what's trying to enter has either density = 0 or swim = 1 (another common condition would be, if what's trying to enter is a projectile, then allow it) - otherwise, return 0.

Good luck.
In response to Kaioken
Thanks,dude. I'm gonna try it out!