ID:178201
Jun 9 2002, 9:27 pm
|
|
How would i make it when u dl click The item in your inventory it makes 4 new crop items around the user then he/she waits like 1 min and it grows and they dl click on it to harvest(get) it? and they must be on farm land to plant the seeds!(I saw this in pets-x and thought it would be cool for my fantasy life game..)
|
Possibly like this. NOTE: Code not tested
obj/crop/DblClick() set src in usr.contents if(usr.loc == /turf/farmland) var/obj/O = new/obj/Seeds(locate(usr.x+1,usr.y,usr.z)) var/obj/S = new/obj/Seeds(locate(usr.x,usr.y+1,usr.z)) var/obj/D = new/obj/Seeds(locate(usr.x-1,usr.y,usr.z)) var/obj/G = new/obj/Seeds(locate(usr.x,usr.y-1,usr.z)) Grow(O) Grow(S) Grow(D) Grow(G) del(src) else usr << "you need to be on farmland!" return obj/proc/Grow(obj/O) if(O.loc == /turf/farmland && istype(O,Seed)) sleep(600) var/obj/M = new/obj/seedgrowth O = M del(O) else return obj/seedgrowth/verb/Get() set src in oview(1) src.Move(usr) |
In response to Super16
|
|
Super16 wrote:
Possibly like this. NOTE: Code not tested I can see that, and you also have some ineffecient ways to solve the problem. To make the code smaller and easier to read, you can use many built-in functions, a for loop for example. obj/crop/DblClick() Something you need to do is test if the seeding locations actually are farmland. That can be done inside the for loop. /Andreas |
In response to ShadowSiientx
|
|
src.owner = usr.key
Click() if(usr.key == src.owner) etc... else usr << "That's not yours!" |
a check to say if(src == owner)
then get it and else.. O <<"Thats not yours!"?