Slimwaffle Posted October 26, 2018 Share Posted October 26, 2018 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 Quote Link to comment Share on other sites More sharing options...
gamecreator Posted October 26, 2018 Share Posted October 26, 2018 I assume you copied all the tex and mat settings from a decal in the Materials/Decals folder and that you've verified your png has transparency? Quote Link to comment Share on other sites More sharing options...
Slimwaffle Posted October 26, 2018 Author Share Posted October 26, 2018 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. Quote Link to comment Share on other sites More sharing options...
gamecreator Posted October 26, 2018 Share Posted October 26, 2018 If you want to upload the whole thing (png, tex, mat) or a test that also didn't work, I'll take a look at it. Also, just a heads up that I haven't really looked at your code because I don't use Lua. Quote Link to comment Share on other sites More sharing options...
Slimwaffle Posted October 26, 2018 Author Share Posted October 26, 2018 The material and texture are the default ones for wound. That come with leadwerks. And the only code I had to reference it was the code I used above. Quote Link to comment Share on other sites More sharing options...
Thirsty Panther Posted October 26, 2018 Share Posted October 26, 2018 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. Quote Link to comment Share on other sites More sharing options...
Slimwaffle Posted October 26, 2018 Author Share Posted October 26, 2018 If I don't set it to red then it just shows grey squares instead. Quote Link to comment Share on other sites More sharing options...
Thirsty Panther Posted October 26, 2018 Share Posted October 26, 2018 Have you looked at this thread? Quote Link to comment Share on other sites More sharing options...
Slimwaffle Posted October 26, 2018 Author Share Posted October 26, 2018 Yeah that was one of the first ones I read. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.