So despite looking around, is there anyway to create timed powerups/weapons? I tried creating a timer.simple function which didnt work for whatever reason. Heres my code which is basic and the timer most likely will be used for every weapon/powerup I make:
[CODE]ITEM.Name = 'Extreme Conditioning'
ITEM.Price = 0
ITEM.Material = 'vgui/entities/extreme_conditioning.vmt'
ITEM.SingleUse = true
local speed = 500
function ITEM:OnEquip(ply)
ply:SetWalkSpeed(speed)
end
function ITEM:PlayerDeath(ply)
ply:SetWalkSpeed(250)
end[/CODE]
[QUOTE=Bassnecter;50459322]So despite looking around, is there anyway to create timed powerups/weapons? I tried creating a timer.simple function which didnt work for whatever reason. Heres my code which is basic and the timer most likely will be used for every weapon/powerup I make:
[CODE]ITEM.Name = 'Extreme Conditioning'
ITEM.Price = 0
ITEM.Material = 'vgui/entities/extreme_conditioning.vmt'
ITEM.SingleUse = true
local speed = 500
function ITEM:OnEquip(ply)
ply:SetWalkSpeed(speed)
end
function ITEM:PlayerDeath(ply)
ply:SetWalkSpeed(250)
end[/CODE][/QUOTE]
Explain what your trying to do after x seconds and post the code you tried with the timer.
[QUOTE=rtm516;50460132]Explain what your trying to do after x seconds and post the code you tried with the timer.[/QUOTE]
Im trying to make it so the player after purchasing the perk is given a temporary speed boost for x seconds. After that, the perk/powerup is worn off
[QUOTE]ITEM.Name = 'Extreme Conditioning'
ITEM.Price = 0
ITEM.Material = 'vgui/entities/extreme_conditioning.vmt'
ITEM.SingleUse = true
local speed = 500
function ITEM:OnEquip(ply)
ply:SetWalkSpeed(speed)
timer.simple(5 ,function())
end
end
function ITEM:PlayerDeath(ply)
ply:SetWalkSpeed(250)
end[/QUOTE]
Okay, read the wiki page for timer.Simple - you don't seem to fully understand its usage as you have not inserted any code to be executed once it's finished
-snip- do what NiandraLades said then if you give up here [url]http://pastebin.com/tBsifYtv[/url]
[QUOTE=NiandraLades;50460740]Okay, read the wiki page for timer.Simple - you don't seem to fully understand its usage as you have not inserted any code to be executed once it's finished[/QUOTE]
Okay I will do thank you
[editline]5th June 2016[/editline]
[QUOTE=rtm516;50460752]-snip- do what NiandraLades said then if you give up here [url]http://pastebin.com/tBsifYtv[/url][/QUOTE]
thanks :), I'll use the link niandra gave and i can figure out how this all works
Sorry, you need to Log In to post a reply to this thread.