ID:262241
 
Code:
        Pushup()
set category = "Training"
set hidden = 1
if(usr.Meditate)
usr << "<b><font color= blue><font size = 1>Not while Meditateing"
return
if(usr.situp)
usr << "<b><font color= red><font size = 1>not while doing situps"
return
if(usr.Resting)
usr << "<b><font color= blue><font size = 1>Not while Resting"
return
if(usr.flight)
usr << "<b><font color= blue><font size = 1>Not while flying"
return
if(usr.pushup)
usr << "<b><font color= blue><font size = 1>You stop doing pushups."
src.Update(src)
usr.move = 1
usr.icon_state = ""
usr.pushup = 0

else
usr << "<b><font color= blue><font size = 1>You begin doing pushups"
usr.icon_state = "pushup"
usr.move = 0
usr.pushup = 1
usr.PushUp()


Problem description:
i am trying to add

for(obj/hair/O in usr.overlays)

O.pixel_y=0

but i keep indenting wrong or putting it in the wrong place...



You can't loop through overlays. Overlays is a very strange list. What goes in doesn't come out, kinda like a black hole. ;)

Instead you need to keep track of whatever's in overlays seperately, in some other way.
In response to Jon88
other ways as in -_-.....
In response to Dranzer_Solo
Uh...think...how do we store stuff in DM?
How can we remember stuff?
In response to Elation
Nope ugh ive gone thorugh the DM but found notthing im going to explain what im doing a little better...


obj
hair
pixel_y=10
Click()
if(!usr.hair_type)
usr.hair_type=src.type
var/obj/hair/H=new usr.hair_type
if(H)
spawn(H.Color(usr,usr.hair_color))
usr.overlays.Add(H)
del(H)
proc
Color(mob/User,Color="#000000")
//Bla bla bla you get the point//




        Pushup()
set category = "Training"
set hidden = 1
for(obj/hair/O in usr.overlays)
O.pixel_y=0
if(usr.Meditate)
usr << "<b><font color= blue><font size = 1>Not while Meditateing"
return
if(usr.situp)
usr << "<b><font color= red><font size = 1>not while doing situps"
return
if(usr.Resting)
usr << "<b><font color= blue><font size = 1>Not while Resting"
return
if(usr.flight)
usr << "<b><font color= blue><font size = 1>Not while flying"
return
if(usr.pushup)
usr << "<b><font color= blue><font size = 1>You stop doing pushups."
src.Update(src)
usr.move = 1
usr.icon_state = ""
usr.pushup = 0

else
usr << "<b><font color= blue><font size = 1>You begin doing pushups"
usr.icon_state = "pushup"
usr.move = 0
usr.pushup = 1
usr.PushUp()


now everything works except when i call pushups
heres a pic

///////////////
Image Hosted by ImageShack.us
/////////////

when i call push ups i want the picel_y to move down to match the guys head and back to deafualt when he stops....



i hope this explains it better then my post above
In response to Dranzer_Solo
I understand what you're looking at.

Basically, what you need to do is keep experimenting with something like 'hair.pixel_y-=3' or something as the guy goes up and down, untill you get it right.
In response to AZA
'hair.pixel_y-=3' ???


if i try that i just get a undefined var
In response to Dranzer_Solo
'hair.pixel_y-=3' ???
if i try that i just get a undefined var

... Well lets see usually the Undefined Var means.... Var Undefined, It doesn't exist so it cant write to the var...
In response to Strawgate
yeah i know what it means...but theres diffrent ways of defining them....
In response to Dranzer_Solo
so do i just define it like


mob
var
hair



or is there any ohter way?
In response to Dranzer_Solo
Maybe something like this?

mob
var/obj/hair/Hair

verb
Pushup()
set category = "Training"
set hidden = 1
for(var/obj/hair/O in usr.overlays)
O.pixel_y=0
if(usr.Meditate)
usr << "<b><font color= blue><font size = 1>Not while Meditateing"
return
if(usr.situp)
usr << "<b><font color= red><font size = 1>not while doing situps"
return
if(usr.Resting)
usr << "<b><font color= blue><font size = 1>Not while Resting"
return
if(usr.flight)
usr << "<b><font color= blue><font size = 1>Not while flying"
return
if(usr.pushup)
usr << "<b><font color= blue><font size = 1>You stop doing pushups."
src.Update(src)
usr.move = 1
usr.icon_state = ""
usr.pushup = 0

else
usr << "<b><font color= blue><font size = 1>You begin doing pushups"
usr.icon_state = "pushup"
usr.move = 0
usr.pushup = 1
usr.PushUp()
spawn() usr.PushUpHair() // spawn the hair's pushup loop

proc
PushUpHair()
// if they have no hair, or their hair isn't really hair, return and do nothing
if(!Hair || !istype(Hair, /obj/hair)) return

var/up=1 // if the animation starts with the down position, set this to 0

while(pushup) // while they do pushups

overlays -= Hair // take the hair away

if(up) // they won't miss it
up=0
Hair.pixel_y = -12 // adjust this to the height of the up state

else
up=1
Hair.pixel_y = -10 // adjust this to the height of the down state

overlays += Hair // put it back

sleep(3) // adjust this for the delay in the animation


~X
In response to Dranzer_Solo
I'm talking about the layer of tha hair you're using. What ever variable you use to call it, use that in place of 'hair'
In response to Dranzer_Solo
Post the 'Pushup()' procedure.
Ugh...the easiest thing to do would be to create a "pushup" icon state for the hair icons.
In response to Dranzer_Solo
Your mistake was making the hair an overlay rather than overlaying icons to create a single character icon. This sort of situation really isn't suited to overlays at all.

Lummox JR