Jump to content

Blood Decals


Slimwaffle
 Share

Recommended Posts

I need help with blood decals for my game. They are loading in fine. But they are square looking patches and the keep flickering and vanishing.I have tried everything I can think of. And the fact that I can't see a preview in the material editor isn't helping. I will provide a screen shot and the code I am using. Ideally I would like them to look like pools of blood. And not vanish at all. So that I can create a whole other script that dictates how long to wait before vanishing.

--Moving Check
	if self.mode == "roam" then
	self.moving = 1
	elseif self.mode ~= "roam" then
	self.moving = 0

	end
	--Foot step sound
	if self.moving == 1 then
	if self.sound.foot ~= nil then
	self.footdelay2 = self.footdelay2 - 1
	if self.footdelay2 <= 0 then
	self.entity:EmitSound(self.sound.foot, 30 , 1 , 1 , false)
	self.footdelay2 = self.footdelay
	--Blood Texture for ground
	if wounded == 1 then
	--Bullet mark decal
	
	
			
			--Bullet mark decal
			local mtl
			local scale = 0.1
			
				mtl = Material:Load("Materials/Decals/wound.mat")
			end
			local decal = Decal:Create(mtl)
			
			--decal:SetScript("Scripts/Objects/Effects/BulletMark.lua")
			
			decal:SetColor(1,0,0,1)
			decal:SetPosition(self.entity:GetPosition())
			decal:SetParent(terrain.entity)

			
			

	
	
	end
	end
	end

 

error decal.jpg

Link to comment
Share on other sites

yeah pretty much exactly what happened.

As an alternative until I can fix this. I have made a prefab box with one surface textured to the blood. This has transparency and works perfectly (using the same material) and fixes all issues at once.I would like to however get this working with decals. Because scene overload from too many scripted prefabs is a big issue with my game. Every time I make something new I have to find ways to balance it.

blood1.jpg

Link to comment
Share on other sites

Aren't you setting the color of your decal to red?

decal:SetColor(1,0,0,1)

 

Looking at the Projectile.Lua script

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)

You might like to add decal:Turn line to your script so that the blood looks more natural.

Hope this helps.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...