ID:145881
 
Code:
mob
Game_verbs
verb
Toggle_water_walking()
set category = "Commands"
if(usr.waterwalking==0)
for(var/turf/Water/W in world)
W.density = 0
usr.waterwalking=1
usr<<"<font color=red>You are now able to walk on water."
else
for(var/turf/Water/W in world)
W.density = 1
usr.waterwalking=0
usr<<"<font color=red>You are now not able to walk on water."


Problem description:
Well there isn't an error just something to do to the code as u can see i am doing a water walking code also that when i activate it all the water in the world goes undense make everyone able to walk on the water well i am trying to get it it so if you are using water walk then u can walk onto the water i tried using a enter proc and using return but wont work so help me please

turf/Water
icon = 'water.dmi'
density = 1
Enter(mob/M)
for(var/atom/R in src) if(R.density) return 0
if(usr.waterwalking) return 1
else return 0


I think this explains himself...
In response to Mysame
Mysame wrote:
> turf/Water
> icon = 'water.dmi'
> density = 1
> Enter(mob/M)
> for(var/atom/R in src) if(R.density) return 0
> if(usr.waterwalking) return 1
> else return 0


A couple of problems:

- There's no need to rewrite what Enter() already has when that stuff you wrote is already done if you return ..(). Just make water dense-less, and do the correct checks

- You are using usr in a proc. You uselessly defined mob/M but never used it

- You assume the thing that enters the water is a mob. If an obj flew in the water, it would give out a runtime error

In other words, fix your own errors before trying to help other people.

The way to do it (without the useless object check) is this:

turf/water
Enter(mob/M)
if(ismob(M) && (M.waterwalk || !M.density))
return ..()
return 0


~~> Unknown Person
In response to Unknown Person
That waterwalking code works nice ... but how can I modify it so that it also makes waterwalking person's chakra drop at constant rate? (Tried Entered but it resulted in Chakra drain speed going rapidly up after short time :/)
In response to Hastur
Hastur wrote:
That waterwalking code works nice ... but how can I modify it so that it also makes waterwalking person's chakra drop at constant rate? (Tried Entered but it resulted in Chakra drain speed going rapidly up after short time :/)

It sounds like you're adding to the drain speed every time they step onto water. Why not also subtract from it every time they step out, via Exited()? That way once they leave the water, that drain stops.

Lummox JR
In response to Lummox JR
That worked. Thank you ^^