ID:163366
 
OK, my problem is that I'm trying to feed...say chickens. I am making it so that my game only uses switches when people talk. What I want is that when you Click() A (which I have set) that you feed the chicken. What I have done is made it so that when you talk to a man he gives you Feed which I defined as a variable and you get Feed=4. Then I made it so that if you click yes to the switch for feeding the chicken you get usr.Feed-=1. This works, but the problem is that what I want is for you to only be able to feed the chicken 1 time and then move on to the next and feed it, ONE TIME. I have tried many things for this but the main thing I tried was to make it so that when you feed the chicken the chicken becomes a new icon_state. So what I did was that if you feed it and its icon_state="chicken2" a new switch somes up saying that you can't feed it and you DON'T. But my problem is that you DO feed it a second time. Not only that but the second after you feed it, the switch saying that you cannot feed it comes up because the chickens icon_state is chicken2 the second after you feed it so it goes right into the you cannot feed it switch. Did you get all that? I want the "you cannot feed it" switch to only some up if you click it a second time. and I want it to not be able to be fed a second time. I hope you got all that and can help me!

Thanks in advance!
does anyone know?
In response to Moocow696 (#1)
im working on it right now... just hang on a sec...
In response to Jman9901 (#2)
you have to define a variable, let's call it... fed. and another variable variable, let's call it... feed. so this is what we have so far...

mob
var
feed = 4 //so you can feed the chickens...
fed = 0 //zero cause you haven't fed any chickens...


now we need to make the chicken...

mob
Chicken
icon = 'animals.dmi'
icon_state = "chicken"
density = 1 //you can put whatever density you want, it doesnt really matter...


now, on to the verb! away!

mob/Chicken/verb/Feed(mob/M in get_step(src,src.dir)) //so when you walk next to it the verb pops up.
feed -- //takes away 1 out of your 4 chickenfeed.
fed = 1 //shows that you fed the chicken, and now you have to make the overlay...
if(fed == 1) //if you fed the chicken.
var/obj/Chicken/C = new('animals.dmi',"fatchicken")
M.overlays += C
fed = 0 //fed equals zero again so you can do this with other chickens. :)


okay, that probably won't work because there is still a mob chicken there, but if you could do a repop thing or make an 'allowfeed' variable, that would probably work. oh and IDK if you can do the 'var/obj/Chicken/C' thing cause i haven't tried that out yet, but if it doesnt work, do this...

var/icon/I = new('animals.dmi',"fatchicken")


now all of this together should look like...

mob
var
feed = 4
fed = 0

mob
Chicken
icon = 'animals.dmi'
icon_state = "chicken"
density = 1

mob/Chicken/verb/Feed(mob/M in get_step(src,src.dir))
feed --
fed = 1
if(fed == 1)
var/obj/Chicken/C = new('animals.dmi',"fatchicken")
M.overlays += C
fed = 0


or

var/icon/I = new('animals.dmi',"fatchicken")


i hope all of that helps!

P.S. some other coders might find minor errors on it, so anyone feel free to correct it!
In response to Jman9901 (#3)
You forgot to check if they don't have any feed or not.

With that, they could go to -293012 Feed and still be able to feed it.
In response to LucifersHellion (#4)
yea I actually was able to figure it out on my own with a little thought (and some luck)
In response to LucifersHellion (#4)
forgot about that... oh well, it will be easy to do that anyways... :)