• Adding a battery to printers
    4 replies, posted
Hey, i've made a base for a printer and i'm trying to figure out how to set it so when an entity is put onto the printer, the battery goes up and allows it to print. Any ideas how to do this? Thanks!
Use NWVars (ie ent:SetNWBool to know if battery is plugged in or not, ent:SetNWInt to know the percentage of battery, ent:GetNWInt/NWBool). After you have different ways to implement battery consumption. Actualy the most simple way would to remove a half of percentage each 30 ticks. But you can do some math, by calculating how much battery your printer needs to generate a money entity.
[QUOTE=Yuri6037;47697877]Use NWVars (ie ent:SetNWBool to know if battery is plugged in or not, ent:SetNWInt to know the percentage of battery, ent:GetNWInt/NWBool). After you have different ways to implement battery consumption. Actualy the most simple way would to remove a half of percentage each 30 ticks. But you can do some math, by calculating how much battery your printer needs to generate a money entity.[/QUOTE] Actually you should use datatable variables. There is an example on the page. [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/NetworkVar]Entity:NetworkVar[/url]
[QUOTE=Jeezy;47699321]Actually you should use datatable variables. There is an example on the page. [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/NetworkVar]Entity:NetworkVar[/url][/QUOTE] Seriously, there is a function like this, wow, never saw it. Did it exist before this update ? Maybe I should update some of the functions in RRP.
[QUOTE=Yuri6037;47701535]Seriously, there is a function like this, wow, never saw it. Did it exist before this update ? Maybe I should update some of the functions in RRP.[/QUOTE] Yes, this has been around forever. I've found that using either method listed above works just fine. Is there a definite reason as to why one's better than the other?
Sorry, you need to Log In to post a reply to this thread.