ID:166514
 
 mob/Move()
if(lifting)return 0
return ..()
obj
icon='Test Tube.dmi'
icon_state="weights"
layer=MOB_LAYER+1
verb
Lift()
set category="Action"
set src in oview(0)
if(usr.lifting == 1)
return
if(usr.lifting)
usr.lifting=0
icon_state="weights"
if(usr.stamina <= 0)
return
else
usr << "You start lifting"
icon_state="lifting weight"
usr.lifting=1
usr.stamkilla()

mob
proc
stamkilla()
if(usr.stamina <= 0)
icon_state = "weights"
usr.lifting=0
return
else
var/random=rand(1,2)
var/stam=rand(1,2)
usr.strength+=random
usr.stamina-=stam
sleep(10)
stamkilla()




Here's my problem, well ok, digital stompy helped me with this code a bit and it confused even him a bit, well I am trying to make it so when I click lift it lifts of course, and it slowly takes down stamina and when it reaches 0 it stops, well so far I've made it so when it reaches 0% the stats stop raising, but the weights still go up and down and I am able to move around, I just need somthing to stop the weights and make them return to still postion, I know it's something simple but I can't place what it is..


can somone help ...
if(usr.lifting) and if(usr.lifting == 1) are the same thing, your calling 2 different things each of them, and it so happens the first one is stoppign the code.
In response to Evidence
Could that be the problem?
The first thing i noticed was the icon_states. Is the icon_state "weights" for the obj or the mob?

From what i understand soo far, it appears that it is a state for the object. So that means in the stamkilla() proc, which is a mob proc, you aren't actually changing the weights back to the normal state from the lifting state. You would need to use the path operator(i think) to tell the compiler that u mean to change the /obj.icon_state? to "weights".
In response to Self Scientific
Also, just incase it isnt a typo, your testtube object has no object. You are declaring all that lifting stuff globally to the obj class. Here i edit to make it easier to understand what im saying. You have:
obj
icon='Test Tube.dmi'
icon_state="weights"
layer=MOB_LAYER+1

it should be like this:
obj/test_tube // or whaterver the name of the object is
icon='Test Tube.dmi'
icon_state="weights"
layer=MOB_LAYER+1


Now this isnt your problem though, im thinking this is just a typo. Refer to my first post to see about the icon states.
In response to Self Scientific
the 'test tube.dmi' looks fine to me, I think it's more of a center problem, like the icon_states, I tried also writing src.icon_state....
In response to Nexus6669
lol...read my first post...
In response to Self Scientific
Self Scientific wrote:
Also, just incase it isnt a typo, your testtube object has no object. You are declaring all that lifting stuff globally to the obj class.



Yeah I agree with your fist post but I didn't agree with this one.
In response to Nexus6669
Ok i see. I think you just misunderstood what i was tryin to say, now that i look back on it doesnt make sense to me either. Just look at the example the nyou will understand.
You have:
obj
icon='Test Tube.dmi'
icon_state="weights"
layer=MOB_LAYER+1

it should be like this:
obj/test_tube // or whaterver the name of the object is
icon='Test Tube.dmi'
icon_state="weights"
layer=MOB_LAYER+1


In response to Self Scientific
Isn't it the same though but just different depending on how a coder wants to write it out example tree indention etc?
In response to Nexus6669
yea that is true but what im tryn to say is you dont have test_tube object defined. YOur giving the icon and verbs to the obj class not to an actualy obj. All the test_tube code needs to be assigned to an actuall atom. The obj class is just a template of what vars and procs a obj can have. IM sorry im prolly just confusing u more. Here another example:
obj
test_tube // <------ You need an object
icon='Test Tube.dmi'
icon_state="weights"
layer=MOB_LAYER+1


IN the code u posted there is no object. Like i said before im pretty sure this is a typo though because the code wouldnt work if it were like this:
obj
icon='Test Tube.dmi'
icon_state="weights"
layer=MOB_LAYER+1

Which is what u had in the example.
Anyway, did you get your problem fixed?
In response to Self Scientific
I seee what you mean now, Ill give it a go, but I don;t actually think it will give me he route to my problem lol
In response to Self Scientific
I haven't currently, but I think it's simple but I just can't place on how to do it, I need to do it so when stamina hits 0 the weights return to a still...


But it's actually an annoying problem, I'm sure Ill work it out.
In response to Nexus6669
Try this:
mob
proc
stamkilla()
if(usr.stamina <= 0)
/obj/test_tube.icon_state = "weights"
usr.lifting=0
return

This is ofcourse assuming that the name of the obj is test_tube. But to whatever it needs be as long as it corresponds to the obj.
obj
test_tube //name of obj
icon='Test Tube.dmi'
icon_state="weights"
layer=MOB_LAYER+1
//....
In response to Self Scientific
I now get this error


"loading Red Divinity.dme
Red Divinity.dm:215:error:/obj/Test_Tube.icon_state:undefined type path

Red Divinity.dmb - 1 error, 0 warnings (double-click on an error to jump to it)
"
In response to Nexus6669
can u repost ur updated code?
In response to Self Scientific
 mob/Move()
if(lifting)return 0
return ..()
obj
Test_Tube
icon='Test Tube.dmi'
icon_state="weights"
layer=MOB_LAYER+1
verb
Lift()
set category="Action"
set src in oview(0)
if(usr.lifting == 1)
return
if(usr.lifting)
usr.lifting=0
icon_state="weights"
if(usr.stamina <= 0)
return
else
usr << "You start lifting"
icon_state="lifting weight"
usr.lifting=1
usr.stamkilla()

mob
proc
stamkilla()
if(usr.stamina <= 0)
/obj/Test_Tube.dmi.icon_state = "weights"
usr.lifting=0
return
else
var/random=rand(1,2)
var/stam=rand(5,10)
usr.strength+=random
usr.stamina-=stam
sleep(10)
stamkilla()



Here....
In response to Nexus6669
Take out the .dmi part in the path.
/obj/Test_Tube.icon_state ="weights"
In response to Self Scientific
Still get the error...
Page: 1 2