Drunkennewbie

Initiate
Sorry if this is in the wrong location.

I am trying to figure out how to design the Potted Coffee Plant

https://uo.com/wiki/ultima-online-wiki/items/the-potted-coffee-plant/

I am not 100% sure the best method to run it like the original design. I dont want to run it like a normal plant.. just it updates everyday at the time it was placed, then it produced coffee plants.

Is it possible to do that?

I am not asking for someone to write the code for me, unless you already have it made then please share.
 
Well you could either go with the plant day or the actual plant time, then you would also serialize and deserialize that value so in case the server reboots / crashes it will continue as normal.

Then have a timer that starts in the constructor but also in the deserialize method. That way you can make it grow on the same day if the time for it arrived.

You porbably also want a integer or maybe an enum based stage property so in case you set the stage the plant would adjust in graphic as well. Dont forget to serialize and deserialize properly

Override the ondoubleclick method of the plant and check if the stage is equal to the mature stage and then give the player the pods. Also have a datetime for the time you last picked it / can pick again. You should use the UtcNow for this and the planttime. Dont forget to serialize and deserialize properly

and yea I think thats all you need for it :p
 
Well you could either go with the plant day or the actual plant time, then you would also serialize and deserialize that value so in case the server reboots / crashes it will continue as normal.

Then have a timer that starts in the constructor but also in the deserialize method. That way you can make it grow on the same day if the time for it arrived.

You porbably also want a integer or maybe an enum based stage property so in case you set the stage the plant would adjust in graphic as well. Dont forget to serialize and deserialize properly

Override the ondoubleclick method of the plant and check if the stage is equal to the mature stage and then give the player the pods. Also have a datetime for the time you last picked it / can pick again. You should use the UtcNow for this and the planttime. Dont forget to serialize and deserialize properly

and yea I think thats all you need for it :p

Thank you, that helps alot. I was thinking numerous methods in my head last night but couldnt get the one down. I will post what I have hopefully later today or tomorrow.
 

Active Shards

Donations

Total amount
$50.00
Goal
$1,000.00
Back