Search the Community
Showing results for tags 'pick ups'.
-
So I have a weapon pick up code (from Piller's youtube video). Now I like it, think it works alright; but I want to know if there is a way to edit it for "if used" but have no clue how that would work. I am not the strongest programmer. Also would it remove the currently equipped weapon? Like "if weapon == true, drop weapon.pickup"(weapon.pick up to drop the currently carried weapon and spawn a pick up identified in the weapons code infront of the player). It may be to much to ask just seeing if it is possible. I have other programming questions but will just try this for now (as it is very important). Thanks all and here is the code that I currently have. Script.vwepfile=""--path "VWep" "Prefab (*pfb):pfb|Prefabs" --Script.vwep=nil--entity function Script:Start() if self.vwepfile~="" then local prefab = Prefab:Load(self.vwepfile) if prefab~=nil then if prefab.script~=nil then self.vwep = prefab.script else prefab:Release() end end end end function Script:Use(player) if self.vwep then if type(player.AddWeapon)=="function" then if player.weapons~=nil then if player.weapons[self.index]==nil then player:AddWeapon(self.vwep) self.entity:Hide() end end end end end function Script:Collision(entity, position, normal, speed) if self.vwep then if entity.script~=nil then self:Use(entity.script) end end end Edit# the build in pick up code works kinda but if you already have a weapon then it wont let me switch to the pick-ed up weapon. So maybe just an edit to that to fix that? Like having an inventory or something?