reepblue Posted December 3, 2016 Share Posted December 3, 2016 Like the flicker script, this will modify an entities intensity to create a pulsing effect. If any improvements can be made, let me know! Script.frequency=10.0--float "Frequency" Script.Recursive=true--bool function Script:Start() self:SaveIntensity(self.entity,self.Recursive) end --Store the original intensity values function Script:SaveIntensity(entity,recursive) entity:SetKeyValue("Pulse_Intensity",entity:GetIntensity()) if recursive then local n for n=0,entity:CountChildren()-1 do self:SaveIntensity(entity:GetChild(n),true) end end end --Apply a modified intensity value function Script:ApplyIntensity(entity,intensity,recursive) local i = entity:GetKeyValue("Pulse_Intensity") if i~="" then entity:SetIntensity(tonumber(i) * intensity) if recursive then local n for n=0,entity:CountChildren()-1 do self:ApplyIntensity(entity:GetChild(n),intensity,true) end end end end function Script:Draw() if self.color==nil then self.color = self.entity:GetColor() end local alpha = Math:Sin(Time:Millisecs()/self.frequency)*0.25+0.75 self:ApplyIntensity(self.entity,alpha,self.Recursive) end 5 Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Berken Posted December 3, 2016 Share Posted December 3, 2016 Wow! Great effect. Thanks bro Quote Link to comment Share on other sites More sharing options...
mdgunn Posted December 5, 2016 Share Posted December 5, 2016 It would be good if there was a delay before it flashed I think......then you could have a long time between short flashes, acting as a sort of visual hint rather than it seeming to be a continuously pulsing object (which may be jarring in a more realistic game). Also I'd move the magic numbers (0.25 and 0.75) to the top and comment them and possibly expose them. It could be handy if the object went 50% brighter and 50% darker say. I actually had a go at modifying it to do all this but got a bit bogged down and didn't complete it in the end. If I do I'll post it. 1 Quote Link to comment Share on other sites More sharing options...
reepblue Posted December 6, 2016 Author Share Posted December 6, 2016 Cool, if you manage to get to finishing it, I'd be more than happy to have a look. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! 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.