ID:145804
 
Code:
obj
tree
icon = 'Tree.bmp'
density = 1
Bump()
if(usr.Chakra >= 10)
if(usr.rest == 0)
usr.icon_state="Invis"
sleep(20)
usr.icon_state=""
usr.Chakra -= 20-usr.treeclimb
usr.exp += 10
Treelvlcheck()
else
usr<< "Not while resting"
else
usr<< "Not enough chakra"


Problem description:I run into the tree but nothing happens :S its a multi tiled image too btw

usr in Bump(). Get rid of that, oh and use if(!var) / if(var).
I beleive what Xzdog was trying to state was that Bump() accepts arguments. There is no usr in Bump(). src in Bump() is the atom that is being bumped into.

And, when you have a boolean variable, it is always best and more robust to use if(variable) to return a true value, which is anything that is not null, "", or 0. Those are all false. To check to see if a variable is false, use if(!variable).
That is because you're mis-using Bump(). usr is useless in Bump(), and wrong to use. The argument for Bump() is the atom that src is bumping into. I think you would want a Bumped() function to do what you would do.

On another note, I see that you aren't passing an argument through Treelvlcheck(). This leads me to believe that you are using usr, or at least attempting to do it correctly. A general rule of thumb is not to use usr in any procs, since it is always the atom that calls the proc. It will not always be the thing that you are assuming it might be, so you should pass an argument for more information if needed.

atom
proc/Bumped(atom/movable/A)
movable
Bump(atom/A)
A.Bumped(src)

obj/tree
Bumped(atom/movable/A)
if(ismob(A))
var/mob/M = A
if(M.Chakra >= max(1, 20-M.treeclimb))
if(!M.rest)
M.icon_state = "Invis"
spawn(20)
M.icon_state = ""
M.Chakra -= max(1, 20-M.treeclimb)
M.exp += 10
Treelvlcheck(M)
else
M << "Not while resting."
else
M << "Not enough chakra."


~~> Unknown Person
In response to Unknown Person
Unknown Person wrote:
> atom
> proc/Bumped(atom/movable/A)
> movable
> Bump(atom/A)
> A.Bumped(src)
>
> obj/tree
> Bumped(atom/movable/A)
> if(ismob(A))
> var/mob/M = A
> if(M.Chakra >= max(1, 20-M.treeclimb))
> if(!M.rest)
> M.icon_state = "Invis"
> spawn(20)
> M.icon_state = ""
> M.Chakra -= max(1, 20-M.treeclimb)
> M.exp += 10
> Treelvlcheck(M)
> else
> M << "Not while resting."
> else
> M << "Not enough chakra."
>

Mind telling me what this little bit of code means. I've never seen it.
M.Chakra -= max(1, 20-M.treeclimb)
In response to CYN
That just never lets M.Chakra decrease a negative amount. If their Treeclimb is higher than 20, it will go negative. That could lead for their Chakra to increase. I assume you don't want that to happen. :P

max() just returns the higher amount, so it will never go under 1. On another note, min() returns the lower amount.

~~> Unknown Person
In response to Unknown Person
thanks a bunch :)
In response to Unknown Person
need help from you again.

how come the usr.move = 0 doesnt't work anymore? It used to work without defining it. And I'm a lil to slow to figure out how to define it without using move itself lol.