ID:142454
 
Code:
mob/var/zanzoken = 0

mob/learn
verb/Zanzoken()
set category = "Techniques"

if(usr.zanzoken)
usr << "You stop using your Zanzoken Ability"
usr.zanzoken = 0
return
else
usr << "You start using your Zanzoken Ability"
usr.zanzoken = 1
return

turf
DblClick()
var/ki_cost = round(rand(50,250))
if(usr.zanzoken)
for(var/turf/T in view(8))
if(istype(T,/turf/Floors/No_Walking))
return
if(istype(T,/turf/SnakeWay/Clouds))
return
if(istype(T,/turf/SnakeWay/SnakeWay1))
return
if(istype(T,/turf/SnakeWay/SnakeWay2))
return
if(istype(T,/turf/SnakeWay/SnakeWay3))
return
if(istype(T,/turf/SnakeWay/SnakeWay4))
return
if(istype(T,/turf/SnakeWay/SnakeWay5))
return
if(istype(T,/turf/SnakeWay/SnakeWay6))
return
if(istype(T,/turf/SnakeWay/SnakeWay7))
return
if(istype(T,/turf/SnakeWay/SnakeWay8))
return
if(istype(T,/turf/Cliffs/Cliff_Wall_East))
return
if(istype(T,/turf/Cliffs/Cliff_Wall_West))
return
if(istype(T,/turf/Cliffs/Cliff_Wall_North))
return
if(istype(T,/turf/Cliffs/Cliff_Wall_South))
return
if(istype(T,/turf/Cliffs/Cliff_Wall_South_East))
return
if(istype(T,/turf/Cliffs/Cliff_Wall_South_West))
return
if(istype(T,/turf/Cliffs/Cliff_Wall_North_East))
return
if(istype(T,/turf/Cliffs/Cliff_Wall_North_West))
return
if(istype(T,/turf/Buildings/Wall))
return
if(istype(T,/turf/Buildings/Roof))
return

if(usr.ki >= ki_cost)
if(T in oview(12))
flick("IT",usr)
usr.ki = ki_cost
usr.loc = T.loc
usr.afk_time = 0
else
usr << "You don't have enough Ki!"
usr.afk_time = 0
return


Problem description:

Eh.. i had a problem with this code, it has not worked at all. Now it works BUT it takes up almost all of my "ki" and teleports me RANDOMLY on the whole map(all Z levels). i know the list of turfs i cant teleport too is preety bad and i will fix that up but what is the reason of it happening? also i noticed as a GM when i left click on a turf in the box only "area" shows up...
You're setting the players location to the turfs location (which is an area). What you want to do is set their location to the turf itself. You're setting ki to the cost of the technique as well, what you want to do is subtract it (usr.ki -= ki_cost). Also, when using istype() it checks if the object is derived from the type. So if you use if(istype(T,/turf/SnakeWay)) it will return true if it's any of the snake way parts. In Zanzoken() (and at the very end of DblClick()), you're returning when you don't have to. With the if()/else there the two blocks are mutually exclusive. You might also think about setting up a toggle in there just because it's prettier. =)

mob/learn
verb/Zanzoken()
set category = "Techniques"

if(usr.zanzoken)
usr << "You stop using your Zanzoken Ability"
else
usr << "You start using your Zanzoken Ability"
usr.zanzoken = !usr.zanzoken
In response to YMIHere
but i want the verb to teleport to the place they double click to. And if its something in that list they cant teleport to it. You know what i mean yea.

HAHAHAHAHA and omg i didnt notice... LOL i put usr.ki = ki cost instead -= ki cost xD
In response to Gogeta126
Oh wow, I didn't even notice the loop there. src is the turf that they clicked on. Get rid of T and use src.
In response to YMIHere
yup noticed and changed. but now.. should i make layer of grass higher than the /area because area is on top and i cant even left click anything under it. :(
In response to Gogeta126
If you don't need mouse actions for areas, you could set areas' mouse_opacity var to 0.
In response to Jemai1
done that. but still,.

also area layer is 0(changed it from 1) and the turf layer is 2.

so why every turf action works only on /area :/
In response to Gogeta126
fixed ;)

i jst changed
usr.loc = src.loc

to
usr.Move(src)


and i werkzzz :)