ID:171420
 
Hi guys, in my game you can swim, I have it set so that there is a random variable to gain strenght, well this is all fine and good, but, i want it to only gain strength when the player is moving, the problem is that i dont know how to make this happen, any one got any ideas?

Thanks in advance,

Farkas
you could do the check in client/Move(). As long as the North(),West(),etc. procs still use their standard movements, every time you move client/Move() is called.
In response to Jik
ok ive tried to implement this as

if(Move())
//then do the rest.


But this isnt happening, am i using the Move() thing wrong?

thanks in advance

Farkas
In response to Farkas
mob/Move()
..()
var/turf/T=locate(src.x,src.y,src.z)
if(istype(T,/turf/Water))Variable+=number
In response to Crashed
Actually, you don't need that extra variable, just use Move()'s argument(s).

mob
Move(New_Loc,New_Dir)
if(istype(New_Loc,/turf/Water))
src<<"You got stronger!"
In response to Teh Governator
Thankyou all so much, got it working the way i want to now!

Thanks again,

Farkas
In response to Farkas
To cut down on the check when your not in water, you could check it when the have entered the water:

turf
water
Entered(atom/movable/M)
if(ismob(M)&&M.client)
M.swimming+=rand(1,2)
..()


This way, rather than check if they have moved into water everytime they move, you are only doing it if they have actually gone into water.
In response to Nick231
On the note of swimming, any idea of how to add lag to the player swimming, as we all know swimming isnt the fastest mode of transport, so i want the player to struggle through the water, so making it twice as slow as walking normally.
I have attempted to do this, however I am being honest I dont have a clue!

any one know how to do this?

Thanks in advance

Farkas
In response to Farkas
Farkas wrote:
On the note of swimming, any idea of how to add lag to the player swimming, as we all know swimming isnt the fastest mode of transport, so i want the player to struggle through the water, so making it twice as slow as walking normally.
I have attempted to do this, however I am being honest I dont have a clue!

any one know how to do this?

Thanks in advance

Farkas

check out the movement delay demo.
In response to Jik
turf/Water
icon
icon_state
Enter(mob/M)
if(M&&istype(M))
sleep(2)
M.Swimming++
return 1