SphereCommunity
Perishable food system - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Perishable food system (/Thread-Perishable-food-system)



Perishable food system - Gil Amarth - 09-18-2012 06:38 AM

I have thinking a few different system to make the food perishable, but I don´t know if they are efficient or not.

a) Through f_onserver_timer
Launching a globar foritems searching fot type t_food, and aplying the food decay.
Very expensive in resources. Sad

b) Through container timer, and player timer. My players have already a permanent timer runing over them, so no problem to aplying the food decay over them every time the Timer fires.
Also, all containers would need to have a @TIMER event, which search food type, FORCONTTYPE, and aplying the food decay. Relatively fast.

I´d like the second option. Do you see any problems before script it? Or do you see a better option.

Thanks in advance. Smile


RE: Perishable food system - WRWR - 09-18-2012 06:43 AM

why you won't use timer on food items?


RE: Perishable food system - Gil Amarth - 09-18-2012 07:24 AM

Because timers of items inside a container doesn´t work, at least a long time ago didn´t worked. Tongue

PD: Confirmed, Timers inside a containers never fires.

Another options:

c) Use FORITEMS 9999 just after [FUNCTION f_onserver_save_ok].
If there is a pause for saving the server, there is no problem if there is a bit more delay for a slow script.

d) Other option is using FORINSTANCES i_metal_chest, FORINSTANCES every_container, FORINSTANCES etc..., just before a save. A bit more faster but more complex because you have to define every BASEID of container in your server.


RE: Perishable food system - WRWR - 09-18-2012 08:09 AM

you can use something like this

Code:
ON=@CREATE
TAG.FRESH=<EVAL <SERV.TIME>+(10*60*60*3)> //3hour

AND check when player use it or picked up

Code:
IF <TAG0.FRESH> < <SERV.TIME>
SRC.SMSG It smells like shit.
REMOVE
ENDIF



RE: Perishable food system - Gil Amarth - 09-18-2012 07:47 PM

Yes, but then you can think you have a lot of food and really it´s all crap.

Or someone sells you a piece of food, and really is rotten. xD
But it´s a easy system, maybe with tooltips to describe the item, it would work.


RE: Perishable food system - Skul - 09-19-2012 06:28 AM

nice, lol