Jump to content

burgelkat

Members
  • Posts

    203
  • Joined

  • Last visited

Blog Comments posted by burgelkat

  1. thanks Aggror for this hint i think  i know where i can do this in the script.

    by the way thats the prjectile script:

    Script.movespeed=1000
    Script.pickradius=0
    Script.damage=10
    Script.lifetime=20000
    Script.enabled=false--bool "Enabled"
    
    function Script:Start()
    	self.sound={}	
    	self.sound.ricochet={}
    	self.sound.ricochet[1]=Sound:Load("Sound/Weapons/Explosion.wav")
    	self.sound.ricochet[2]=Sound:Load("Sound/Weapons/Explosion.wav")
    	self.sound.ricochet[3]=Sound:Load("Sound/Weapons/Explosion.wav")
    	self.starttime=Time:GetCurrent()
    	self.emitter={}
    	
    	--Debris emitter - This will throw chunks off of walls and make it look like they are breaking
    	self.emitter[0]=Emitter:Create()
    	self.emitter[0]:SetCollisionType(Collision.Prop)--Enables particle bouncing
    	self.emitter[0]:SetMaterial("Materials/Effects/smoke.mat")
    	self.emitter[0]:SetEmissionVolume(0.05,0.05,0.05)	
    	self.emitter[0]:SetColor(0.1,0.1,0.1,1)
    	self.emitter[0]:SetVelocity(5.5,15,5.5,1)
    	self.emitter[0]:SetParticleCount(5)
    	self.emitter[0]:SetReleaseQuantity(5)
    	self.emitter[0]:SetMaxScale(0.9)
    	self.emitter[0]:SetDuration(1500)
    	self.emitter[0]:SetAcceleration(0,-12,0)
    	self.emitter[0]:SetLoopMode(false)
    	self.emitter[0]:Hide()
    	
    	--Smoke emitter - This will provide a soft dust effect around bullet impacts
    	self.emitter[1]=Emitter:Create()
    	self.emitter[1]:SetColor(1,1,1,0.25)
    	self.emitter[1]:SetMaterial("Materials/Effects/smoke.mat")
    	self.emitter[1]:SetEmissionVolume(0.1,0.1,0.1)
    	self.emitter[1]:SetVelocity(0.3,0.3,0.3,1)
    	self.emitter[1]:SetParticleCount(8)
    	self.emitter[1]:SetReleaseQuantity(3)
    	self.emitter[1]:SetMaxScale(15)
    	self.emitter[1]:SetDuration(3800)
    	self.emitter[1]:AddScaleControlPoint(0,0.5)
    	self.emitter[1]:AddScaleControlPoint(1,1)
    	self.emitter[1]:SetRotationSpeed(10)
    	self.emitter[1]:SetLoopMode(false)
    	self.emitter[1]:Hide()
    	
    	--Smoke emitter - This will provide a soft dust effect around bullet impacts
    	self.emitter[2]=Emitter:Create()
    	self.emitter[2]:SetColor(1,1,1,0.25)
    	self.emitter[2]:SetMaterial("Prefabs/Effects/Explosion/explosion.mat")
    	self.emitter[2]:SetEmissionVolume(0.1,0.1,0.1)
    	self.emitter[2]:SetVelocity(0.3,0.3,0.3,1)
    	self.emitter[2]:SetParticleCount(1)
    	self.emitter[2]:SetReleaseQuantity(1)
    	self.emitter[2]:SetMaxScale(25)
    	self.emitter[2]:SetDuration(2500)
    	self.emitter[2]:AddScaleControlPoint(0,0.5)
    	self.emitter[2]:AddScaleControlPoint(1,1)
    	--self.emitter[2]:SetRotationSpeed(10)
    	self.emitter[2]:SetLoopMode(false)
    	self.emitter[2]:Hide()
    end
    
    function Script:Enable()--in
    	if self.enabled==false then
    		self.enabled=true
    	end
    end
    
    function Script:FindScriptedParent(entity,func)
    	while entity~=nil do
    		if entity.script then
    			if type(entity.script[func])=="function" then
    				return entity
    			end
    		end
    		entity = entity:GetParent()
    	end
    	return nil
    end
    
    function Script:UpdateWorld()
    	if self.enabled==false then return end
    	if self.entity:Hidden() then return end
    	local pickinfo=PickInfo()	
    	local pos = self.entity:GetPosition(true)
    	local targetpos = Transform:Point(0,0,self.movespeed/60.0 * Time:GetSpeed(),self.entity,nil)
    	local result = self.entity.world:Pick(pos,targetpos,pickinfo,self.pickradius,true,Collision.Projectile)
    	if result then
    		local enemy = self:FindScriptedParent(pickinfo.entity,"Hurt")
    		if enemy then
    			if self.owner then
    				--if self.owner.teamid==enemy.script.teamid then
    				--	result=false
    				--end
    			end
    			if result then
    				if enemy.script.health>0 then
    					enemy.script:Hurt(self.damage,self.owner)
    				end
    			end	
    		end
    		if result then
    			self:Explode()
    			--Bullet mark decal
    			local mtl
    			local scale = 2
    			if enemy~=nil then
    				mtl = Material:Load("Materials/Decals/wound.mat")
    				scale = 0.1
    			else
    				if pickinfo.surface~=nil then
    					local pickedmaterial = pickinfo.surface:GetMaterial()
    					if pickedmaterial~=nil then
    						rendermode = pickedmaterial:GetDecalMode()
    					end
    				end
    				mtl = Material:Load("Materials/Decals/BombCrater.mat")
    			end
    			local decal = Decal:Create(mtl)
    			decal:AlignToVector(pickinfo.normal,2)
    			decal:Turn(0,0,Math:Random(0,360))
    			decal:SetScript("Scripts/Objects/Effects/BulletMark.lua")
    			if mtl~=nil then mtl:Release() end
    			decal:SetPosition(pickinfo.position)
    			decal:SetParent(pickinfo.entity)
    			
    			--Apply global scaling
    			local mat = decal:GetMatrix()
    			mat[0] = mat[0]:Normalize() * scale
    			mat[1] = mat[1]:Normalize() * scale
    			mat[2] = mat[2]:Normalize() * scale	
    			decal:SetMatrix(mat)
    			decal:EmitSound(self.sound.ricochet[math.random(#self.sound.ricochet)],30)
    
    			self.entity:Release()
    		else
    			self.entity:SetPosition(targetpos)
    		end
    	else
    		self.entity:SetPosition(targetpos)
    	end
    	if Time:GetCurrent()-self.starttime>self.lifetime then
    		self.entity:Release()
    	end
    end
    
    function Script:Explode()	
    	self.emitter[0]:Show()
    	self.emitter[0]:SetPosition(self.entity:GetPosition(true))
    	self.emitter[0]:Reset()
    	self.emitter[0]:Play()	
    	self.emitter[1]:Show()
    	self.emitter[1]:Reset()
    	self.emitter[1]:SetPosition(self.entity:GetPosition(true))
    	self.emitter[1]:Play()
    	self.emitter[2]:Show()
    	self.emitter[2]:Reset()
    	self.emitter[2]:SetPosition(self.entity:GetPosition(true))
    	self.emitter[2]:Play()
    end

     

  2. i updated my project. i bind more objects in blender together and importet it to LW. This allowed me to reduce batches.In addition, I changed some camera settings, so the FPS has increased.But for the FPS break, I currently have really no solution.

    The scenes now have to be displayed as they are. otherwise I will not continue in my project. There is, of course, a solution in the further course.

  3. mhm (there is no crash by me) but

    GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
                            Not all framebuffer attachment points are framebuffer
                            attachment complete. This means that at least one
                            attachment point with a renderbuffer or texture
                            attached has its attached object no longer in existence
                            or has an attached image with a width or height of
                            zero, or the color attachment point has a
                            non-color-renderable image attached, or the
                            depth attachment point has a non-depth-renderable
                            image attached, or the stencil attachment point has a
                            non-stencil-renderable image attached.
                        
                            Color-renderable formats include GL_RGBA4,
                            GL_RGB5_A1, and
                            GL_RGB565.
                            GL_DEPTH_COMPONENT16 is the only
                            depth-renderable format.
                            GL_STENCIL_INDEX8 is the only
                            stencil-renderable format.
                       

    i have to look at the models.. i think there is something.. and this is and this could be the reason for the short frame break at this point as well

×
×
  • Create New...