ID:2047672
 
(See the best response by FKI.)
So i'm trying to understand this code so i can figure out how to make it last longer because at the moment it last for a short period then ends. Perhaps someone can break down what it's doing so i can figure out how to extend it.

    WaterPrison
jutsutype="Ninjutsu"
icon='NarutoStuff.dmi'
icon_state="WaterPrison"
name="Water Prison"
JutsuRank="C1"
layer=MOB_LAYER+5
New()
.=..()
spawn(1)
while(src)
sleep(10)
if(!src)
return
if(!(src.owner in oview(1,src)))
src.owner<<"<font color=blue>You moved away from the Water Prison!</font>"
del(src)
if(src.owner.chakra<=0)
src.owner<<"<font color=blue>You ran out of chakra so you can no longer sustain the Water Prison!</font>"
del(src)
src.owner.chakra-=rand(100,1000)
Del()
for(var/mob/M in oview(0,src))
if("[M]" in src.owner.jutsutarget)
src.owner.RemoveJutsuTarget(M)
M.imprisoned=""
M.stuff=0
M<<"<font color=blue>You have been freed from the Water Prison technique!</font>"
..()


Best response
That snippet indicates the skill's duration is controlled by the user simply having chakra. So at the very least, you probably want to reduce the rate at which their chakra is drained, thus extending its duration.

Other than that: That code doesn't appear to be written with a lick of efficiency and I wouldn't recommend it for any type of "understanding" of programming. Do not expect to learn much of anything from that source you are using except how to start off programming on a bad note.
ok so what would be a proper way to efficiently code it?
there is also the proc code i tried it with reducing the chakra drain but after a few seconds it wears off

    WaterPrison()
var/found=0
for(var/mob/M in get_step(src,src.dir))
found=1
if(M.imprisoned=="")
if("Body of the Gecko" in M.Ability)
M<<"Using the Body of the Gecko ability, you escape harm!"
found=0
//add hydro mode here
else
var/obj/A=new/obj/Attack/Water/WaterPrison
A.owner=src
M.imprisoned="Water Prison"
M.stuff=1
src.AddJutsuTarget(M)
A.loc=locate(M.x,M.y,M.z)
view(M)<<"<font color=red size=4>[M] is caught in [M.imprisoned]!</font>"
else
src.chakra+=chakrarepeal
src.stamina+=chakrarepeal
src<<"<font color=red size=4>[M] is already caught in [M.imprisoned]!</font>"
return
if(!found)
src.chakra+=chakrarepeal
src.stamina+=staminarepeal
src<<"<font color=red size=4>There is no one in front of you to perform this on!</font>"
return