• Problem attempting to get the growing effect of the perp weed plant.
    5 replies, posted
I'm working on making custom content for my DarkRP server, and ran into a problem creating the drug plant's "grow" effect of a PERP drug plant. This is the error I get, [ERROR] gamemodes/darkrp/entities/entities/plant_coca/init.lua:78: attempt to call method 'Grown' (a nil value) 1. unknown - gamemodes/darkrp/entities/entities/plant_coca/init.lua:78 Timer Failed! [Simple][@gamemodes/darkrp/entities/entities/plant_coca/init.lua (line 77)] Here is my code [lua]AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include("shared.lua") function ENT:Initialize() self:SetModel("models/props_c17/pottery06a.mdl") self:PhysicsInit(SOLID_VPHYSICS) self:SetMoveType(MOVETYPE_VPHYSICS) self:SetSolid(SOLID_VPHYSICS) self:SetUseType(SIMPLE_USE) local phys = self:GetPhysicsObject() if phys and phys:IsValid() then phys:Wake() end Usable = false Plantable = true self.damage = 25 end function ENT:OnTakeDamage(dmg) self.damage = (self.damage or 25) - dmg:GetDamage() if self.damage <= 0 then local rnd = math.random(1, 10) if rnd < 2 then self:DropSeed() self:Remove() self:Destruct() else self:Remove() self:Destruct() end end end function ENT:Destruct() local vPoint = self:GetPos() local effectdata = EffectData() effectdata:SetStart(vPoint) effectdata:SetOrigin(vPoint) effectdata:SetScale(1) util.Effect("pickup", effectdata) GAMEMODE:Notify(self.dt.owning_ent, 1, 4, "Your Coca Plant has been destroyed!") end function ENT:DropSeed() local SeedSpawn = ents.Create("seed_coca") local Spawnpos = self:GetPos() SeedSpawn:SetPos(Spawnpos) SeedSpawn:Spawn() end function ENT:Use( activator ) if Usable == true then Usable = false Plantable = true if(activator:IsPlayer()) then activator:AddMoney(self:GetDrugWorth()); GAMEMODE:Notify(self.dt.owning_ent, 1, 4, "You sold your Cocaine for $"..self:GetDrugWorth().."!") self:SetDrugWorth(0) end local rnd = math.random(1, 10) if rnd < 3 then self:DropSeed() end end end function ENT:Grown() leaf:SetScale( 100 ) self:SetDrugWorth(2500) end function ENT:Touch(hitEnt) if hitEnt:GetClass() == "seed_coca" then if Plantable == true then Plantable = false timer.Simple(300, function() self:Grown() end ) local LeafPos = self:GetPos() leaf = ents.Create( "prop_physics" ) leaf:SetModel( "models/props_foliage/bush2.mdl" ) leaf:SetScale( CurTime()/3 ) leaf:SetPos( Vector(LeafPos.x, LeafPos.y + 26, LeafPos.z) ) leaf:SetParent( "plant_coca" ) hitEnt:Remove() Usable = true self:SetPhase(1) self:FindAge() end end end function ENT:Think() end[/lua]
Give up, or use aura system Garry added. Why can't people use the help thread instead of making these useless threads that drown out the more useful threads?
This isn't to the fault of the glowing effect, it's you trying to port a Garry's Mod 12 over to DarkRP/pretending you are porting it to DarkRP; stop trying to defibrillate perp, just let it die.
I'm not at all trying to defibrillate PERP, I'm just asking how I can get the effect of it "growing." That was I can add a nice looking weed plant to my server along with other possible codes. On a side note, I remember trying to ask for help a few times before on the help thread they never got answered, so I posted this here instead to save time of trying. Otherwise there should be a subsection to this section of facepunch for Lua Help (if I recall correctly there used to be one) instead of a thread where it's less likely lua problems will get answered, and is easier for people with problems in lua to see.
[URL="http://www.facepunch.com/showthread.php?t=1236397"]http://www.facepunch.com/showthread.php?t=1236397[/URL]
Well, that weed plant does not use the growing effect PERP weed plants do. Instead what it does is just change the model every set amount of time.
Sorry, you need to Log In to post a reply to this thread.