I've been doing some coding on a bunch of Left 4 Dead style stuff and this is the latest script I have. A simple use timer. I haven't tested it very hard, but there should not be any glaring bugs. Information about the script:
http://i.imgur.com/ZuzDtap.gifv
--[[
Title: Use Timer
Author: Einlander
Start Date: 5-22-17
Version: 2
Description: A simple Left 4 Dead style use timer
Notes:
WHAT IT DOES: Allows player to use a script to force player/user to use an item for a set period of time.
Think Left 4 Dead when you need to pour gas or start generators.
WHAT IT DOESENT DO: It does not immobilize the player/user.
It does not cancel when the player/user looks away or is too far.
Changelog:
1 -Initial release
2 -style changes small fix
added self.entity:SetKeyValue("type","use_timer") .
This will help when trying to figure out what you are using and adjust accordingly.
ie:detect you are using the use timer and make it so the player cant move
-in Script:Start changed self.completed to true to prevent activating when not targeting entity.
3 -complete rewrite with less code, and smarter time management
]]
The script itself:
-- edit --
added self.entity:SetKeyValue("type","use_timer") . This will help when trying to figure out what you are using and adjust accordingly. ie:detect you are using the use timer and make it so the player cant move.
in Script:Start changed self.completed to true to prevent activating when not targeting entity.
-- edit --